In case you find these instructions hard to follow or you feel lazy, then you can always install SpamCheetah to a USB stick by booting SpamCheetah liveCD and installing it to the USB stick from the Curses UI. See this for details.
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 liveusb.qemu.hd0 1G
Install OpenBSD 4.5 into the filestore just created by booting with the install4.5 ISO file. 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 liveusb.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 ~/liveusb.qemu.hd0
# mount /dev/svnd0a /mnt
# (cd /mnt/ && tar zcpf /liveusb_root.tar.gz *)
# mkdir -p /stick/ramdisk/dev
# chmod 755 /stick/ramdisk/dev
# tar pxzf liveusb_root.tar.gz -C /stick/
# umount /mnt
# vnconfig -u svnd0
Now you have to untar the above file and create devices on the host machine in the /stick directory we created above.
This procedure could take some time as it requires manual intervention.
# tar pxzf liveusb_root.tar.gz -C /stick/
# cp -pR /stick/{var,etc,root,home} /stick/ramdisk/
# cp -pR /stick/dev/MAKEDEV /stick/ramdisk/dev/
# cd /stick/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 LIVEUSB
Modify this line in LIVEUSB kernel config file
config bsd swap generic < - we have to change this entry
that specifies the root filesystem to:
config bsd root on sd0
Compile the modified kernel
# config && cd ../compile/LIVEUSB/
&& make clean && make depend && make
Command: Copy the compiled kernel in the root directory of liveusb
# cp bsd /stick && chown root:wheel /stick/bsd && \
chmod 644 /stick/bsd
Now we have to create the RAMDISK directories and files. We also need to create devices with the MAKEDEV script.
# cp -pR /stick/{var,etc,root,home} /stick/ramdisk/
# cp -pR /stick/dev/MAKEDEV /stick/ramdisk/dev/
# cd /stick/dev && ./MAKEDEV all
# cd /stick/ramdisk/var/anjal/dev && ./MAKEDEV all
Now download the code for the web interface and other helper scripts from sourceforge.
$pwd
/home/foobar/spamcheetah-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/spamcheetah-cvs/ramdisksrc/ramdisk-src && \
tar pzcf /stick/ramdisk/var.tar.gz var && \
tar pzcf /stick/ramdisk/etc.tar.gz etc && \
tar pzcf /stick/ramdisk/dev.tar.gz dev && \
tar pzcf /stick/ramdisk/home.tar.gz home && \
tar pzcf /stick/ramdisk/root.tar.gz root && \
mv /stick/etc/{rc,fstab,group,passwd,boot.conf,login.conf}\
/stick/ && \
rm -rf /stick/{root,home,var,etc}/* && \
mv /stick/{rc,fstab,group,passwd,boot.conf,login.conf}\
/stick/etc/ && \
rm -rf /stick/ramdisk/{var,etc,dev,home,root}
cd /stick/ && \
chmod 700 root && \
chmod 755 {var,etc,dev,home,ramdisk} && \
chmod 1777 tmp && \
mkdir /stick/persist
cp \
/home/foobar/cvs/ramdisksrc/scriptfiles/whitelist_table.txt \
/stick/persist
Now copy the SpamCheetah specific perlscripts.
# cd /home/foobar/spamcheetah-cvs/ramdisksrc/ &&
$ cp perlscripts/usr/local/sbin/greyscanner \
/stick/usr/local/sbin
$ cp perlscripts/usr/local/bin/askintf /stick/usr/local/bin
$ cp perlscripts/usr/local/bin/nwcfg /stick/usr/local/bin
Now transfer the binary image to the USB memory stick.
# fdisk -iy sd0
# disklabel -R sd0 \
/home/foobar/spamcheetah-cvs/ramdisksrc/scriptfiles/disklabel.txt
# newfs sd0a
# newfs sd0d
# mount /dev/sd0a /stick
# mkdir /stick/persist
# echo "Installing boot sectors...."
# cd /stick
# cp /usr/mdec/b* /stick
# ./usr/mdec/installboot -v boot biosboot sd0
# cd /root
# umount /stick
Please contact support should you have any problems!
Best of luck and have fun with SpamCheetah!