I am going to be starting with a basic Debian system. I have used this procedure with Debian Lenny (Current Testing), and Ubuntu Hardy (current release). Debian Etch (current Stable) can be used, but you will need backports and few other updates. Please read the Debian Live website for building on Etch. You can build an Etch Live CD (as I am about to show), but to do it on Etch requires a bit more finess.
Step1)
If you do not have a local repository, I highly recommend you proceed with this step and create one.
If you have a local repository, you can use that and skip this step. If you really don't want to use a local repository, you can also use the purge function: http://wiki.debian.org/DebianLive/FAQ#h ... f6e95f53ba
1.A)
The first thing you will need to do is install a repository manager. There are several out there but I recommend apt-cacher.
- Code: Select all
apt-get install apt-cacher
1.B)
Now we need to modify it.
- Code: Select all
vi /etc/apt-cacher/apt-cacher.conf
* The following is a series of personal preferences. It is important to note a few details and to properly adjust for your setup.
I like having the directory in /home as I usually have the most space there. Regardless of where you put it, make sure you have plenty of hard drive space and that the folder is accessible by the proper user and group.
- Code: Select all
cache_dir=/home/apt-cacher
group=www-data
user=www-data
Change this if you want your email displayed.
- Code: Select all
admin_email=root@localhost
I prefer to run on port 9999. Should you choose not to, this is where you can find out what port you will be running on or set it to a port of your choice. This will be important later as your mirror will be http://yourip:daemon_port/debian/. Therefore with this setting, my mirror is: http://10.5.35.214:9999/debian/.
- Code: Select all
daemon_port=9999
Depending on the setup and your network structure, you may want to do this. For this tutorial, I am not. Just want you to be aware that it is here.
- Code: Select all
allowed_hosts/denied_hosts=
Server mapping. Very important that this is configured properly. You need to have a valid server to pull files from. This can be expanded quite a bit and is very useful, but it goes beyond this tutorial. I am just going to use the one listed above and nothing else (security updates will still come from security.debian.org). A list of mirrors can be found here: http://www.debian.org/mirror/list
- Code: Select all
path_map= debian ftp.debian.org/debian
Now save out of the file (if using vi then type :wq).
1.C)
Now we need to create the directory and the permissions as we set within that file
- Code: Select all
mkdir /home/apt-cacher; chown www-data:www-data /home/apt-cacher
1.D)
Now to set apt-cacher to start on boot up
- Code: Select all
vi /etc/default/apt-cacher
- Code: Select all
AUTOSTART=1
Save and quit (:wq).
1.E)
Start apt-cacher
- Code: Select all
/etc/init.d/apt-cacher start
On first start you will probably see messages like the following. They are OK.
- Code: Select all
Starting Apt-Cacher: apt-cacherWarning: /home/apt-cacher/private missing. Doing mkdir(/home/apt-cacher/private, 0755)
Warning: /home/apt-cacher/import missing. Doing mkdir(/home/apt-cacher/import, 0755)
Warning: /home/apt-cacher/packages missing. Doing mkdir(/home/apt-cacher/packages, 0755)
Warning: /home/apt-cacher/headers missing. Doing mkdir(/home/apt-cacher/headers, 0755)
Warning: /home/apt-cacher/temp missing. Doing mkdir(/home/apt-cacher/temp, 0755)
Warning: /var/log/apt-cacher/access.log missing. Creating.
Warning: /var/log/apt-cacher/error.log missing. Creating.
Step 2) Install the Live CD helper scripts
- Code: Select all
apt-get install live-magic
Step 3) Configure and prepare the environment with lh_config
3.A)
I have created the folder /home/live to work in. I will reference back to this directory occasionally, so if your directory differs then make sure you change the commands accordingly.
- Code: Select all
mkdir /home/live; cd /home/live
3.B)
The configure script, lh_config, accepts several parameters which may be useful to you. I am only going to cover the ones of interest for this tutorial and at the end of this section (3.B) I will show you how your command should look with these options. Please see the links at the end of this post for more options.
Change the IP to match your own local apt-cacher mirror (run ifconfig if you do not know your IP). The bootstrap and chroot are for when you are building your Live CD. The chroot command is not needed for Ubuntu and may cause problems under Ubuntu.
- Code: Select all
--mirror-bootstrap "http://10.5.35.214:9999/debian/" --mirror-chroot "http://10.5.35.214:9999/debian/"
Once you have a Live CD, your mirror may not be available. This will replace the /etc/apt/source.list with a good mirror. Again, a list of mirrors can be found here: http://www.debian.org/mirror/list. So add:
- Code: Select all
--mirror-binary "http://ftp.debian.org/debian/"
Choose your desktop environment. Your choice will directly determine your CD size! You can choose XFCE, Gnome, or KDE
- Code: Select all
-p xfce-desktop
http://wiki.debian.org/DebianLive/Examples
Choose your Debian version (at the time of this writing: Etch=Stable,Lenny=Testing,Sid=Unstable). Due to the constantly changing nature of Sid and Lenny (Unstable and Testing respectively), I highly recommend sticking with Etch unless you know you need Sid/Lenny. When Lenny is released, you will want to update your live cd.
- Code: Select all
-d etch
http://wiki.debian.org/DebianLive/Examples
Choose the hostname and username for the LiveCD
- Code: Select all
--hostname StackLive --username stack
http://wiki.debian.org/DebianLive/FAQ#h ... d19318d022
If you want memtest86+ add this line. You can remove it if you do not wish to have it.
- Code: Select all
--memtest memtest86+
To build a USB thumbdrive image add the following. If you are building a CD, do not worry about this step.
- Code: Select all
-b usb-hdd
http://alioth.debian.org/~lamby-guest/l ... l#id243560
Your command should now look similar to this:
- Code: Select all
lh_config --mirror-bootstrap "http://10.5.35.214:9999/debian/" --mirror-chroot "http://10.5.35.214:9999/debian/" --mirror-binary "http://ftp.debian.org/debian/" -p xfce-desktop -d etch --hostname StackLive --username stack --memtest memtest86+
3.C) Add packages you wish to install. I am providing a list of packages I prefer to have installed.
- Code: Select all
vi config/chroot_local-packageslists/packages
- Code: Select all
smartmontools
hddtemp
htop
vim
kazehakase
openssh-server
clamav
rdesktop
atanks
Step 4) Build Live CD
This next step will take some time. Especially the first time.
- Code: Select all
lh_build
Step 5) Testing the build
You will need to transfer files so ssh, ftp, or whatever you want will be needed. I will use ssh. If you have another ssh server you want to use, substitute here. I will be using Qemu for testing the iso images. You can use whatever emulation software you want as other programs like VMWare server will do just fine.
5.A)
- Code: Select all
apt-get install qemu openssh-server
5.B) You will need to change the IP of the following to suit your needs. You will also need to change the memory (-m 256) to be more/less for you.
- Code: Select all
qemu -m 256 -cdrom binary.iso -boot d -redir tcp:4222:10.0.2.15:22
http://wiki.debian.org/DebianLive/FAQ#h ... 79dd350520
5.C) Now customize the layout however you desire, but DON'T reboot it yet. Your changes will not last! Once you are done configuring and changing the desktop background or whatever, copy your /home/ on your liveCD to your system.
- Code: Select all
scp -r /home root@YourHost:/home/live/config/chroot_local-includes/.
5.D) Back on your system (not the live CD) edit the following file. Do remember to change your user name and make it executable!
- Code: Select all
vi /home/live/config/chroot_local-hooks/01-change_owner.sh
- Code: Select all
#!/bin/sh
chown 999:999 /home/stack -R
- Code: Select all
chmod +x /home/live/config/chroot_local-hooks/01-change_owner.sh
http://wiki.debian.org/DebianLive/FAQ#h ... 79dd350520
Step 6)Rebuilding
Back on the command line in your /home/live directory, you will need to clean up the build before you can rebuild. Do be aware that this will delete your binary.iso! If you want to keep it, copy it out somewhere else!
- Code: Select all
lh_clean
lh_build
http://wiki.debian.org/DebianLive/FAQ#h ... b9dcbd343b
Now retest your liveCD (Step 5.B). If it works, burn off the iso. If there are still changes to do, then rebuild!
If you have a problem, please post and I will do what I can to help out.
Have fun!
~S~
Useful links
http://debian-live.alioth.debian.org/
Customize Artwork
http://wiki.debian.org/DebianLive/Howto/Custom_Artwork
Configure Splash Screen
--syslinux-splash 'config/binary_syslinux/splash.rle'
Examples
http://wiki.debian.org/DebianLive/Examples
[Edit #1] Typos fixed thanks to Bob Cox
[Edit #2] lh_config clarification thanks to Paul Cartwright