We are all living in a technological wasteland.


Slitaz project – Part 1 – Building a base system

One of the main advantages of virtualization is that you can copy your machines. With one base system you can generate a lot of machines quite fast without having to install each machine individually.

This is exactly what we are going to do in Part 1. In this part I am using VMWare, eventually I am planning to make this tutorial also available for VirtualBox.

Let’s start. Fire up your VMWare (or VirtualBox) and create a virtual machine with:
– 1 CPU
– 512 MB of RAM (I’ll explain this later)
– A hard drive of 512 MB – Use IDE! not SCSI. (I don’t know if this is fixed in Slitaz 4.0 but SCSI drives didn’t work for me back in version 3.0.) EDIT: in Oracle VM Virtual Box it is possible to use a SCSI drive.
– Bridged internet connection (in VMWare) or (I think) direct access in VirtualBox
– Other Linux 2.6 kernel

Once this machine has been created, download Slitaz at: http://mirror.slitaz.org/iso/4.0/slitaz-4.0.iso and use it as boot CD for your virtual machine.

Why the 512 MB RAM and why a regular Slitaz 4.0 image?
Explanation:In Slitaz 3.0 I found the slitaz-installer located in the base system (~8MB iso) but since Slitaz 4.0 I found it much easier using the GUI installer to install the Slitaz base package. Which needs, offcourse, more RAM. 512 MB is way too much but we can still change the amount of RAM our machine uses later on.

Ok, let’s continue. Boot up the virtual machine and watch the Slitaz magic do it’s job. Select ‘SliTaz Live’ and continue the booting with default settings. (I changed my keymap to be-latin1 as that is the layout of my keboard.)

First things first. We need to prepare our disk. Slitaz comes with GParted built in, which is super easy to use.

Just jump to: ‘Applications > System Tools > Gparted Partition Editor’ pop in the root password (which is ‘root’) and off we go.

In Gparted we select our /dev/hda (if not already selected) and use, ‘Device > Create Partition Table’. Press Apply and rightclick on the gray block. Select ‘New’ and press the ‘Add’ button. (EDIT: In virtual box it’s /dev/sda by default)
After this just press ‘Apply’ to apply the settings.

Voila, partition set. Quite easy.

Now to install Slitaz: Go to the Slitaz Panel, which can be found ‘System Tools > SliTaz Panel’. Use root/root as username/password. And go for the ‘Install’ option on the right top corner.

Skip the partitioning ‘Continue Installation’ (we just did this).

Now we need the base system. From inside SliTaz download the base iso from http://mirror.slitaz.org/iso/4.0/flavors/slitaz-4.0-base.iso . (Use Midori)

Select ISO and fill in your downloaded file(mine is: /home/tux/slitaz-4.0-base.iso)
Go to ‘Install Slitaz to partition’ and select ‘/dev/hda1’.

Set the hostname to ‘base’ and the user login to ‘base’.
Also click on the box that says ‘Install GRUB bootloader’.

That’s it. Press proceed and watch Slitaz install and reboot. Now shutoff the machine and cut the RAM to 64 MB and boot. One slim base install.

Look at these stats. Quite sexy, no?

root@base:~# free
total         used         free       shared      buffers
Mem:         58556        13668        44888            0         1668
-/+ buffers:              12000        46556
Swap:            0            0            0
root@base:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root               494.8M     29.5M    439.8M   6% /
tmpfs                    28.6M         0     28.6M   0% /dev/shm

Now let’s continue to install SSH. SSH is definitely a must.

Login with root/root and install nano (I really prefer this one above vi because its simplicity.)

tazpkg get-install nano

By default dropbear is already installed. We simply need to enable it in our startup file. This file is located in /etc/rcS.conf. Find the line that says ‘RUN_DAEMONS’ and add dropbear.
By default apache and mysql are also in the deamon list but you can remove these. (Reboot the server and continue with putty)

nano /etc/rcS.conf
RUN_DAEMONS="dbus hald slim firewall dropbear"

Now we can use putty to connect to our server. (Hint: command for finding out the server ip address is ‘ifconfig’)

Usually I like to know what’s happening on my servers. For this I’ve used phpsysinfo in the past. It offers me a quick overview through the web. However this requires a webserver and php.

So download all packages needed for lighttpd (press ‘y’ to install missing dependencies).

tazpkg get-install pcre-dev
tazpkg get-install lighttpd
tazpkg get-install php

Add lighttpd to the daemons:

nano /etc/rcS.conf
RUN_DAEMONS="dbus hald slim firewall dropbear lighttpd"

For security reasons I will be running this admin section of lighttpd on a different port and a different folder.

mkdir /var/domains/
mkdir /var/domains/admin

Let’s edit our virtual hosts file:

nano /etc/lighttpd/vhosts.conf

And add these lines:

$SERVER["socket"] == ":81" {
server.document-root = "/var/domains/admin"
server.errorlog = "/var/domains/admin-error.log"

Install phpsysinfo.

cd /home/base/
wget http://downloads.sourceforge.net/project/phpsysinfo/phpsysinfo/2.5.4/phpsysinfo-2.5.4.tar.gz
tar xzvf /home/base/phpsysinfo-2.5.4.tar.gz
mv /home/base/phpsysinfo/* /var/domains/admin/
rm -rf /home/base/phpsysinfo
rm /home/base/phpsysinfo-2.5.4.tar.gz
mv /var/domains/admin/config.php.new /var/domains/admin/config.php

By default phpSysInfo doesn’t recognizes the Slitaz distribution. But this can be fixed. Just make following changes:

Edit the file ‘class.Linux.inc.php’ and search (Ctrl+W) for ‘who’ and change function users. (As slitaz doesn’t supports ‘who -q’)

nano /var/domains/admin/includes/os/class.Linux.inc.php
function users () {
$strResult = 0;
$strBuf = "users=".execute_program('who', '-a | grep -i pts -c');
if( $strBuf != "ERROR" ) {
$arrWho = split( '=', $strBuf );
$strResult = $arrWho[1];
return $strResult;

Also search for the hostname function and comment out the ‘else’ rule.

function chostname () {
$result = rfts( '/proc/sys/kernel/hostname', 1 );
if ( $result == "ERROR" ) {
$result = "N.A.";
} else {
//      $result = gethostbyaddr( gethostbyname( trim( $result ) ) );
return $result;

Also an edit of ‘class.parseProgs.inc.php’ is required. (For glusterfs because parsing of the glusterfs string is incorrect.)

nano /var/domains/admin/includes/os/class.parseProgs.inc.php

Move to the function ‘parse_filesystems’ and add following line:

$df = execute_program('df', '-k' . $this->df_param );
$df = str_replace("volume\n", "volume", $df );
$df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);

Download the Slitaz icon and add it to the images dir. (I know png isn’t the same as ico, but sue me. These are details.)

wget -O /var/domains/admin/images/slitaz.png http://www.slitaz.org/favicon.ico

Finally edit the distros.ini file and add a Slitaz rule:

nano /var/domains/admin/distros.ini
Name = "Slitaz"
Image = "slitaz.png"
Files = "/etc/slitaz-release"

Now let’s change ownership of the files (as lighttpd is running using the www user).

chown -R www /var/domains

Voila server ready, reboot the server or use ‘/etc/init.d/lighttpd restart’. (Lighttpd is probably already running after the install.)

Just a few final steps and we are finished:

a) cleanup

b) download/create an IP shell script

c) add a swap file (of 64 MB) just for keeping everything a little bit more healthy. (Alternative: create a swap partition, this partition should be recognized by Slitaz and automatically used.)

This will cleanup our package cache:

tazpkg clean-cache

(Only cleans around 3 MB but hey, we are not on a server using terrabyte hard drives.)

Now creating the IP script is just for convenience later on. This script can be used to change static IP’s fast.

Update 1: script can be downloaded: wget -O /home/base/ip.sh http://www.enira.net/wp-content/uploads/2012/06/ip.txt

nano /home/base/ip.sh
if [ $# -eq 4 ]
echo "Backing up script..."
cp /etc/network.conf /etc/network.conf.bck
echo "Setting ip..."
echo INTERFACE=\"eth0\" > /etc/network.conf
echo DHCP=\"no\" >> /etc/network.conf
echo STATIC=\"yes\" >> /etc/network.conf
echo  >> /etc/network.conf
echo IP=\"$2.$3\" >> /etc/network.conf
echo NETMASK=\"\" >> /etc/network.conf
echo GATEWAY=\"$2.$4\" >> /etc/network.conf
echo DNS_SERVER=\"$2.$4\" >> /etc/network.conf
echo  >> /etc/network.conf
echo  >> /etc/network.conf
echo DHCP=\"no\" >> /etc/network.conf
echo STATIC=\"yes\" >> /etc/network.conf
echo  >> /etc/network.conf
echo IP=\"$2.$3\" >> /etc/network.conf
echo NETMASK=\"\" >> /etc/network.conf
echo GATEWAY=\"$2.$4\" >> /etc/network.conf
echo DNS_SERVER=\"$2.$4\" >> /etc/network.conf
echo  >> /etc/network.conf
echo  >> /etc/network.conf
echo WIFI="no" >> /etc/network.conf
echo "Setting hostname..."
cp /etc/hostname /etc/hostname.bck
echo $1 > /etc/hostname
echo "Done."
echo "Usage: ip.sh    "
echo "Example: ip.sh testname 192.168.1 41 1"
chmod +x /home/base/ip.sh

And create the swap file:

dd if=/dev/zero of=/swap bs=1024 count=65536
mkswap /swap

Add this to the local.sh script (this is the boot script of Slitaz) so it will enable the swap file at boot.

nano /etc/init.d/local.sh
swapon /swap

Finished! This will be the base system on which I will continue to build all others.

You can download the base vmware I generated here: base.7z (15.0 MB)
Or the virtual box image:base-virtualbox.7z (15.2 MB)

Leave a Reply

You must be logged in to post a comment.