Tuesday, March 19, 2013

HOWTO : Rebuild Kali Linux 1.0.1

This article has been deleted for several days due to this reason. However, more than 2 readers request this article back. Thus, it is back, enjoy!

To rebuild Kali Linux takes time but it worths when you need the most updated Kali Linux on Live DVD or USB thumb drive.

Step 0 :

Download the Kali Linux 1.0.1 and install to the hard drive. Make sure you enable the "mirror" when asked. Otherwise, your Kali will not working properly.

If you don't, please append the following to the /etc/apt/sources.list :

deb http://http.kali.org/kali kali main non-free contrib
deb-src http://http.kali.org/kali kali main non-free contrib


Then, do the following may fix the problem :

apt-get update && apt-get dist-upgrade

Make sure you DO NOT edit the GNOME menu yourself as it will mess the Kali Menu. However, if you messed the Kali menu, you can do the following to fix :

rm ~/.config/menus

Step 1 :

To prepare your Kali box to be capable to rebuild the Kali iso files :

apt-get install git live-build cdebootstrap kali-archive-keyring apt-cacher-ng

Step 2 :

touch standard.list.chroot

Append some package name to the file in order to tell the maker to include such package to the .iso file.

Or copy and paste to the file namely "standard.list.chroot" to /root/ which includes some useful packages instead (you may edit this file) :

! Packages Priority standard
gedit
radiotray
preload
gtk-recordmydesktop
galculator
synaptic
axel
cpuid
network-manager-pptp
network-manager-pptp-gnome
network-manager-openvpn
network-manager-openvpn-gnome
network-manager-vpnc
network-manager-vpnc-gnome
isomaster
xchat-common
xchat
libreoffice
shutter
bluez-gstreamer
bluez-compat
bluez-alsa
bluez-cups


Step 3 :

Copy and paste to file "update-kali" to your /root/ directory :

apt-get update
apt-get -y dist-upgrade
apt-get --purge -y autoclean
apt-get --purge -y autoremove


Make it execuatable :

chmod +x update-kali

Step 4 :

Copy and paste to file "rebuild-kali" to your /root/ directory :

# clean the previous live-build-config directory and pull the new config file
echo "Removing the previous live-build-config direcotry ...."
cd /root/
rm -R live-build-config
echo "Getting the new live-build-config file ...."
git clone git://git.kali.org/live-build-config.git
echo "Copying the customized standard.list.chroot from /root/ ...."
cp /root/standard.list.chroot /root/live-build-config/config/package-lists/
echo "Copying the update-kali and rebuild-kali scripts from /root/ ...."
cp /root/update-kali /root/live-build-config/config/includes.chroot/root/
cp /root/rebuild-kali /root/live-build-config/config/includes.chroot/root/
echo "Enable the apt-cacher-ng ...."
/etc/init.d/apt-cacher-ng restart
export http_proxy=http://localhost:3142/
cd live-build-config
echo "Be patient .... Building amd64.iso and i386.iso ...."
echo "It will takes 4-6 hours or more to complete ...."
echo "Please DON'T close this terminal ...."
./build_all.sh


Make it execuatable :

chmod +x rebuild-kali

Step 5 :

If you have 64-bit Kali Linux installed, you can build amd64.iso and i386.iso (PAE) at the same time. If you have 32-bit Kali Linux installed, you can only build i386.iso (PAE). To build the amd64.iso and i386.iso at the same time by executing the following command :

./rebuild-kali

The .iso files will be created at /root/live-build-config/images/ and it will takes 4 to 6 or more hours to complete. It depends on the power of your CPU and amount of RAM you have. I recommend you have at least 2 GB RAM to do the rebuild.



Bouns #1

If your CPU is too old that does not support PAE, you need to rebuild your Kali Linux.

Follow Step 1 to Step 4 as above.

cd /root/
rm -R live-build-config


git clone git://git.kali.org/live-build-config.git

cp /root/standard.list.chroot /root/live-build-config/config/package-lists/
cp /root/update-kali /root/live-build-config/config/includes.chroot/root/
cp /root/rebuild-kali /root/live-build-config/config/includes.chroot/root/


cd live-build-config
cd auto
nano config


Locate the following :

lb_opts="--debian-installer live --linux-flavours 686-pae"

and replaces with :

lb_opts="--debian-installer live --linux-flavours 486"

Save it and exit.

cd ..

or

cd /root/live-build-config

/etc/init.d/apt-cacher-ng restart
export http_proxy=http://localhost:3142/


lb config --architecture i386
lb build


That's all! See you.