You need the following with you before we start:
Ready? Good. Let us get started!
You should have the ISO image of OpenBSD4.5 with you. If not you can download it from one of the mirrors. You can download using HTTP, FTP or rsync.
Or simply click here for an x86 machine. Please download the ISO image, if necessary check the MD5 checksum and optionally also loopback mount and check its contents.
Next step is installing OpenBSD 4.5 into a qemu filestore. You can install OpenBSD with all the packages and dependencies into a flat file using the qemu emulator.
Create a 1G qemu flatstore. This will finish in a second.
#qemu-img create livecd.qemu.hd0 1G
Install OpenBSD 4.5 into the filestore just created by booting with the install4.5 ISO file you just downloaded. You have to install OpenBSD the usual way except that you are installing into a Qemu virtual machine. OpenBSD installation is a very fast and painless process. Install all distributions except Xwindow. This site will help you in case you are not familiar with OpenBSD installation.
This procedure could take some time as it requires manual intervention.
#qemu -hda livecd.qemu.hd0 -cdrom <path-to-install45.iso> -boot d
Please install the following packages. You can download this text file and type this command inside the qemu session(On the liveCD target virtual machine).
# pkg_add -i `cat SpamCheetah-pkg.txt`
GeoIP drill ghostscript-8.63p3-a4-no_x11 ifstat mod_gzip p5-Compress-Raw-Zlib p5-Compress-Zlib p5-Crypt-SSLeay p5-Digest-HMAC p5-Digest-SHA1 p5-Email-Valid p5-Geo-IP p5-Geo-Inverse p5-HTML-Parser p5-HTML-Tagset p5-HTTP-GHTTP p5-IO-Compress-Base p5-IO-Compress-Zlib p5-Mail-Tools p5-Net-DNS p5-Net-IP p5-RRD p5-Time-TimeDate p5-URI p5-libwww pftop png psutils qdbm rrdtool t1utils
Next step is transferring the qemu installation as a tar file into the host machine. This can be done by loopback mounts with vnconfig(1).
# vnconfig svnd0 ~/livecd.qemu.hd0
# mount /dev/svnd0a /mnt
# (cd /mnt/ && tar zcpf /livecd_root.tar.gz *)
# mkdir -p /usr/livecd/ramdisk/dev
# chmod 755 /usr/livecd/ramdisk/dev
# tar pxzf livecd_root.tar.gz -C /usr/livecd/
# umount /mnt
# vnconfig -u svnd0
Now you have to untar the above file and create devices on the host machine in the /usr/livecd directory we created above.
This procedure could take some time as it requires manual intervention.
# tar pxzf livecd_root.tar.gz -C /usr/livecd/
# cp -pR /usr/livecd/{var,etc,root,home} /usr/livecd/ramdisk/
# cp -pR /usr/livecd/dev/MAKEDEV /usr/livecd/ramdisk/dev/
# cd /usr/livecd/dev && ./MAKEDEV all
Next step is compiling the OpenBSD kernel after modifying a single line that specifies the root filesystem.
# cd /usr/src/sys/arch/`uname -m`/conf && cp GENERIC LIVE_CD
Modify this line in LIVE_CD kernel config file
config bsd swap generic < - we have to change this entry
that specifies the root filesystem to:
config bsd root on cd0
Compile the modified kernel
# config LIVE_CD && cd ../compile/LIVE_CD/
&& make clean && make depend && make
Command: Copy the compiled kernel in the root directory of livecd
# cp bsd /usr/livecd && chown root:wheel /usr/livecd/bsd && \
chmod 644 /usr/livecd/bsd
Now we have to create the RAMDISK directories and files. We also need to create devices with the MAKEDEV script.
# cp -pR /usr/livecd/{var,etc,root,home} /usr/livecd/ramdisk/
# cp -pR /usr/livecd/dev/MAKEDEV /usr/livecd/ramdisk/dev/
# cd /usr/livecd/dev && ./MAKEDEV all
# cd /usr/livecd/ramdisk/var/anjal/dev && ./MAKEDEV all
Now download the code for the web interface and other helper scripts from sourceforge.
$pwd
/home/foobar/cvs
$cvs
-d:pserver:anonymous@spamcheetah.cvs.sf.net:/cvsroot/spamcheetah
login
(Press enter)
$cvs -z3
-d:pserver:anonymous@spamcheetah.cvs.sf.net:/cvsroot/spamcheetah
co -P ramdisksrc
Next step is setting up the RAMDISK image files which will be uncompressed at boot. Then we copy over the bootrecords for the ISO image /usr/mdec/cdbr and /usr/mdec/cdboot. They will be found on all OpenBSD machines.
# cd /home/foobar/cvs/ramdisksrc/ramdisk-src && \
tar pzcf /usr/livecd/ramdisk/var.tar.gz var && \
tar pzcf /usr/livecd/ramdisk/etc.tar.gz etc && \
tar pzcf /usr/livecd/ramdisk/dev.tar.gz dev && \
tar pzcf /usr/livecd/ramdisk/home.tar.gz home && \
tar pzcf /usr/livecd/ramdisk/root.tar.gz root && \
mv /usr/livecd/etc/{rc,fstab,group,passwd,boot.conf,login.conf}\
/usr/livecd/ && \
rm -rf /usr/livecd/{root,home,var,etc}/* && \
mv /usr/livecd/{rc,fstab,group,passwd,boot.conf,login.conf}\
/usr/livecd/etc/ && \
rm -rf /usr/livecd/ramdisk/{var,etc,dev,home,root}
cd /usr/livecd/ && \
chmod 700 root && \
chmod 755 {var,etc,dev,home,ramdisk} && \
chmod 1777 tmp && \
cp /usr/livecd/usr/mdec/{cdbr,cdboot} /usr/livecd/
mkdir /usr/livecd/persist
cp \
/home/foobar/cvs/ramdisksrc/scriptfiles/whitelist_table.txt \
/usr/livecd/persist
Now copy the SpamCheetah specific perlscripts.
# cd /home/foobar/cvs/ramdisksrc/ &&
$ cp perlscripts/usr/local/sbin/greyscanner \
/usr/livecd/usr/local/sbin
$ cp perlscripts/usr/local/bin/askintf /usr/livecd/usr/local/bin
$ cp perlscripts/usr/local/bin/nwcfg /usr/livecd/usr/local/bin
Now create the ISO image for burning to CD/DVD.
# /usr/local/bin/mkisofs \
-no-iso-translate \
-R -T \
-allow-leading-dots \
-l -d -D -N -v \
-V "SpamCheetah LiveCD OpenBSD${vers}" \
-A "SpamCheetah LiveCD OpenBSD${vers}" \
-p "Your Name <your.mailaddress.>" \
-publisher "Your Name <your.mail@address.>" \
-b cdbr -no-emul-boot \
-c boot.catalog \
-o /home/SpamCheetah.iso \
/usr/livecd/
You can optionally test that the ISO is booting properly with qemu.
# qemu -cdrom livecd.iso -boot d
You can burn the ISO with cdrecord(1) if your medium is a CD or growisofs(1) if your medium is a DVD. Remember that growisofs is part of the package dvd+rw-tools under OpenBSD.
# cdrecord [-speed=16] [-overburn] -data livecd.iso
# growisofs -dvd-compat -Z /dev/rcd1c=livecd.iso
Please contact support should you have any problems!
Best of luck and have fun with SpamCheetah!