This is a walkthrough on how I setup VMWare for Tiny Core linux 3.82 to host my Codebreaker Day1 Server. Start by downloading VMWare player and multicore-current.iso. Create a new virtual machine for generic linux 2.6 kernel using the multicore iso image as the boot CD.
Don’t run the VM when complete. Instead find the folder where the VM was created (%userprofile%\Documents\Virtual machines\VMNAME) and delete the vmdk file. Now reconfigure the VM and remove the SCSI hard disk. Add a new hard disk but this time make it IDE.
Remove any unnecessary hardware (printers, floppy, etc.) from the VM, change the network adapter to bridged with a physical connection, then start it up. I chose to install Tiny Core as a USB/HDD install, menu option “tci”. Once Tiny Core is loaded, open a terminal and:
sudo fdisk /dev/hda
n (enter) p (enter) 1 (enter 3 times) to create default full sized primary partition
a (enter) 1 (enter) to make the partition bootable
w (enter) to write the changes
This preps the virtual hard disk for installation, go ahead and reboot selecting “tci” once again. TC_Install as “Tiny Core”, “frugal”, “whole disk” to “hda” browsing to /hdc/boot/tinycore.gz as required. Let the installer reformat the drive as EXT4 (or ext2/3) then choose the boot options “tce=hda1 home=hda1 opt=hda1 “. When install is complete you may optionally mount hda1 and (sudo editor /mnt/hda1/boot/extlinux/extlinux.conf) to remove the USB wait and UUID kernel options as they really aren’t necessary. You may wish to add “syslog” as a kernel option so that you can view /var/log/messages later on.
You’ll notice that I setup the virtual hard disk and then rebooted. This was because “hda” didn’t show up in the mount tool until I did so.
Reboot again and this time you should be running Tiny Core from the VM’s hard disk. Before we start loading software, run “AppsAudit” “Install Options” and “Toggle Default Copy Install” which should generate a message “copy2fs.flg set”. Open “Panel” and “Network”, then set the IP Address to 192.168.0.10, Gateway to 192.168.0.1, and Nameserver to 192.168.0.1 (or whatever values are approriate for your network), then click apply.
Because I’m setting up a DNS/FTP/Web server open “AppsBrowser”, “Connect”, then search for Apache2-mod-php5.tcz and click on it. Hit “Go” next to “OnBoot” to install it. Now click on Apache2.tcz and notice in the notes that there are vague instructions on how to install apache.
Because Tiny Core is modular with minimal persistence we are going to have to edit certain system files to get our settings to stick. Open up a terminal and enter “sudo editor /opt/bootlocal.sh &” then “sudo editor /opt/.filetool.lst &” In .filetool.lst append “usr/local/apache2/htdocs” along with “usr/local/apache2/conf/httpd.conf” to the end of the document. In bootlocal.sh add “apachectl -k start”.
Notice that “/opt/eth0.sh &” line in bootlocal.sh. We always want that line to be first because it initializes the network that every other service requires (apache/bind/bftpd).
Back in “AppsBrowser” search for, and install, both bind.tcz and php5.tcz. Install bftpd.tcz and add “usr/local/etc/bftpd.conf” to .filetool.lst, and “bftpd -d -c /usr/local/etc/bftpd.conf” to bootlocal.sh. Now (sudo editor /usr/local/etc/bftpd.conf.sample &). Scroll through the file and edit these lines as shown:
#DENY_LOGIN=”Anonymous login disabled.”
Save the file as bftpd.conf (not bftpd.conf.sample).
In “AppsBrowser” find MySql.tcz. It turns out this package was installed along with php5.tcz but we need to add “usr/local/etc/my.cnf” and “usr/local/var/mysql” to .filetool.lst. Now install rsync.tcz and openssh.tcz.
At this point I’m going to begin configuring DNS Bind. To do so I’m going to cop out and get a GUI, in this case, probind at http://probind.svn.sourceforge.net/viewvc/probind/trunk/?view=tar . Unfortunately I have not, and am not, going to install a web browser in Tiny Core so I opened the url in the host machine’s web browser which downloaded the file “probind-trunk.tar.gz”.
On the host machine I installed and ran Filezilla (which is a very nice FTP client). On the VM I ran “sudo bftpd -d -c /usr/local/etc/bftpd.conf” to start the FTP server. In Filezilla I typed in the address of the VM (192.168.0.10) and hit enter. On the left pane I selected probind-trunk.tar.gz, right-clicked on it and pressed upload.
Back in the VM:
tar -xvf probind-trunk.tar.gz
mv trunk probind
sudo apachectl -k start
Now I can access the probind GUI from the host machine’s web browser by typing in the URL http://192.168.0.10/probind but let’s not get ahead of ourselves. Before I even touch the GUI there’s a bunch more configuration to do:
sudo mkdir /usr/local/etc/bind /usr/local/etc/bind/slave
sudo chmod 770 /usr/local/etc/bind/slave
dig +bufsize=1200 +norec NS . @a.root-servers.net > /usr/local/etc/bind/db.root
sudo mkdir /var/named
sudo chown tc:staff /var/named
Add “usr/local/etc/bind” and “var/named” to .filetool.lst.
Probind expects to find certain programs in certain paths and I didn’t feel like editing all sorts of scripts so I just added symlinks:
sudo cp -s /usr/local/sbin/named* /usr/sbin
sudo cp -s /usr/local/sbin/rndc* /usr/sbin
sudo cp -s /usr/local/bin/php* /usr/bin
At this point, go ahead and save .filetool.lst (if you haven’t already done so). I need to add the paths to those symlinks but I’m lazy so I used these commands:
ls -1 /usr/sbin/named* >> /opt/.filetool.lst
ls -1 /usr/sbin/rndc* >> /opt/.filetool.lst
ls -1 /usr/bin/php* >> /opt/.filetool.lst
BE AWARE; the command is “ls -1 ” (as in the number ONE and not the letter L). In the editor for .filetool.lst click “File”, “Open File” then click “OK” to re-open .filetool.lst. You should see a bunch of new entries that start with “/usr”. Go ahead and delete that leading “/”, then save.
With that out of the way it’s time to start configuring probind itself with (editor /usr/local/apache2/htdocs/probind/templates/v9-master/named.tmpl). Add or edit these lines:
Then (editor /usr/local/apache2/htdocs/probind/inc/config.tmpl.php) and edit these lines:
$TOP = ‘/usr/local/apache2/htdocs/probind';
$MYSQL_USER = ‘root';
$MYSQL_PASSWD = ”;
$DEFAULT_PUSH = “push.local”;
$DEFAULT_DIR = “/var/named”;
Notice that $MYSQL_PASSWD equals two single-quotes (empty string) and not a single double-quote. Save the file as config.php in the same folder, then (mkdir /usr/local/apache2/htdocs/probind/LOGS). Let’s go ahead and prep the probind mysql database.
create database probind;
sudo mysql probind < /usr/local/apache2/htdocs/probind/etc/mktables.sql
Probind is now configured and ready for first use which brings up a little chicken and the egg scenario. We can’t start DNS with bind’s “named” command without a valid “/var/named/named.conf” and probind will error out if DNS isn’t started. At any rate, this is as good a time as any to add “named -c /var/named/named.conf” to bootlocal.sh, then save and close that file.
On the host machine go ahead and open http://192.168.0.10/probind. Let’s start by clicking on “Misc. Tools” then the “Settings” link on the far left side. Type “tinycore.net” in all four boxes and set “Show All” to “on” then “Update Settings”.
Now click the “Servers” link on the far left and “Add Another Server”. Enter the “IP number” as 192.168.0.10, then “Type” as “Master”, “Update” as “Update”, and “NS Record” as “NS Record”. “Directory on the server containing Zone files” should read “/var/named”, “Template directory” is “v9-master” and “Script used to push data to the server” is “push.local”.
I suppose we could generate named.conf now but let’s press on and add some Zones by clicking “Add a zone”. In the top box I added thegshi.com and cmgsccc.com (two sites I wish to redirect to my local apache web server), then clicked “Add Master Domain(s)”. Click on “Browse Zones” then the cmgsccc.com link on the far left. Click the “Add RR” button and fill in “Domain” as “cmgsccc.com.”, “Type” as “A”, “Data” as “192.168.0.10 “, “Generate PTR?” as “no”, then click the “Add this record” button. Enter another record with “Domain” as “www.cmgsccc.com.”, “Type” as “CNAME”, and “Data” as “cmgsccc.com.” When done, click the zone thegshi.com and fill it out the same way except using “thegshi” in place of “cmgsccc”.
With that done, click the “Push Updates” button at the top, then “START UPDATE”. This should fail but will generate /var/named/named.conf and the zone files (assuming every other step of this tutorial was followed properly). At this point we can finally start DNS with (sudo named -c /var/named/named.conf). Once that is done, go back to Probind and click “Misc. Tools”, the “Bulk Update” link to the far left, the big “Go ahead – Do it!” button, “Push Updates” at top, and finally “START UPDATE”. This time the updates should be successful with only a couple of minor errors, regarding getopt.inc and mkzonefile, displayed.
With all that done it’s time to tell Tiny Core that it is its own network nameserver (sudo editor /opt/eth0.sh). Change the following line as shown:
echo nameserver 127.0.0.1 > /etc/resolve.conf
Save the file then (sudo echo nameserver 127.0.0.1 > /etc/resolve.conf). We should now be able to test the DNS redirection with a couple of linux commands “host”, and “nslookup”. I’m just going to use (nslookup thegshi.com).
Now let’s try (nslookup http://www.thegshi.com).
http://www.thegshi.com canonical name = thegshi.com.
To setup the Codebreaker Day1 server I found and extracted “CodeBreaker PS2 File Server Script-1.1.rar” to the host computer, then FTP uploaded the entire “ps2 ” folder to the VM. You can then test it on the host by typing in the URL http://192.168.0.10/ps2/day1/cb.php. Alternatively you can change the network settings on the host computer so that it’s name server is 192.168.0.10 (using the VM for DNS) then open http://www.cmgsccc.com/ps2/day1/cb.php. I found that I can still surf the internet without issues on the host computer so only the DNS entries for thegshi and cmgsccc redirect locally while everything else goes out.
And there you have it, 200 simple steps to a Tiny Core DNS/FTP/Web server. Now before you start filling my mailbox with comments, keep in mind that this is just the method that I used. I’m not saying it’s the best, most convenient, etc. If you have a better way then blog about it on your own space.