Elemental Linux Server Help


System requirements and limitations

The Elemental Linux Server (ELS) is a niche distribution and is not intended to run on every imaginable hardware configuration. Specifically, it is designed to run on standard x86 PC architecture using IDE/ATAPI hard drives and CD-ROMs. USB and SCSI are not supported nor are SATA controllers (except when running in IDE compatibility mode).

ELS does not coexist well with other operating systems. It expects to have full control over all hard drives it detects. You cannot configure ELS to dual-boot another OS using the included setup utility.

On the positive side, ELS has very low system requirements. It can easily run on older, discarded hardware or newer, "value PCs". Minimum recommended requirements are a first generation Pentium with 16M RAM and a 500M hard disk. An old Pentium II with 64M RAM and a 3G hard drive should be a very capable system.


Installation

The most straightforward way to install ELS is from a bootable CD-ROM. Visit the ELS home page, download the latest .iso image and burn it to CD. The instructions in the following sections are centered around CD-ROM based installation.

Initial install

Upon booting from the ELS CD-ROM you will find yourself at a shell prompt. To begin installation, type setup with the appropriate command-line options for your system. If you're not sure what options you need, type setup --help for guidance.

Running setup does not actually do the installation, instead it generates a non-interactive installation script. This script, /tmp/auto-install, contains all of the commands needed to complete the initial installation of the system. You should review the script and, provided everything looks okay, run it with the command sh /tmp/auto-install --delete-existing-data to wipe out your hard drive(s) and install ELS.

When the auto-install script is finished you will be returned to a shell prompt with a message instructing you to reboot using CTRL-ALT-DELETE. After restart, the system will boot into single-user mode. At this point you can log onto the server console as root and begin configuration.


System configuration

ELS does not have any specialized system administration tool. Everything is done by issuing standard commands at the shell prompt or editing files in the /etc directory. Methods for performing common tasks are detailed below.

Initial config

The system is not very useful after the initial installation. If you want to do anything interesting, you'll need to configure the system further. A checklist for getting started is provided below.

  1. Configure the system time.
  2. Create swap space.
  3. Create filesystems for additional software and home directories.
  4. Change the root password and set up at least one non-privileged user.
  5. Configure IP networking.
  6. Configure system startup.
  7. Verify the configuration.

Configuring system time

There are two steps in setting the system time. First, you must set the CMOS clock to Coordinated Universal Time (UTC). You can either do this using the hwclock command or with your PC's BIOS setup utility. Next, you need to set the time zone for your location. If you choose not to set the time zone, your server will time will always be set to UTC. This is not necessarily a bad thing.

To set the time zone use the zic command to compile time zone data and then copy the appropriate zone file to /etc/localtime.

Here are the steps to set the time zone:

  1. Remount /usr as read-write.
  2. Change directory to /usr/share/tzdata and find the text file named after the continent where you live.
  3. Compile the time zone information with the command zic continent-file.
  4. Browse through the continent file looking for lines that start with the word "Zone" followed by a nearby city that you know to be in your time zone. Make a note of the city name. If the city is preceeded by a country name, you'll need that too.
  5. Find a file in /usr/share/zoneinfo that matches your city name and copy it to /etc/localtime
  6. Remount /usr as read-only.

Example

The following example shows how you might set the system time and the time zone if you lived in Chicago, USA.

hwclock --set --utc --date="4/22/2008 21:39:00"
hwclock --utc --hctosys
cd /
mount -o remount,rw /usr
cd /usr/share/tzdata
zic northamerica
grep ^Zone northamerica | less
rm -f /etc/localtime
cp /usr/share/zoneinfo/America/Chicago /etc/localtime
cd /
mount -o remount,ro /usr

Note

Occasionally countries make changes to Daylight Saving Time rules. If this happens to you, you'll need to download an updated timezone file from ftp://elsie.nci.nih.gov/pub/ and extract it to /usr/share/tzdata.

Creating swap space

You will probably want to create some swap space on the hard drive so that your system doesn't risk running out of memory. How much you need depends on how much RAM you have, how much load you intend to put on the system and how much hard drive space is available. A general rule of thumb is to make the swap space double the amount of RAM. So if you have 32M of RAM, you would want to configure 64M of swap space. Of course, there are exceptions to this rule. If you have 256M of RAM in a system that you only intend to use to practice your command-line skills for the LPI exam, you probably won't need 512M of swap space. In fact you may not need any.

Once you determine how much swap space you need, here's how to set it up:

  1. Create a new partition using fdisk.
  2. If you use mirroring, create a second partition of equal size and mirror the two using mdadm.
  3. Create the swap filesystem using the mkswap command.
  4. Add the swap filesystem to the /etc/fstab file.
  5. Activate the swap space with the swapon command.

Example

The following example shows how to set up swap space on a system that uses mirrored disks.

fdisk /dev/hda
fdisk /dev/hdb
mdadm --create /dev/md3 -l mirror -n 2 /dev/hda5 /dev/hdb5
mkswap /dev/md3
echo "/dev/md3  swap  swap  defaults  0  0" >> /etc/fstab
swapon -a

Note

If you use mirroring, you may be tempted to not mirror the swap partition and instead split the swap space between two hard drives. While this will improve swap performance and make more efficient use of disk space, there is one major drawback. Your swap space cannot survive a hard drive failure and the system will crash over the loss of a single disk. No doubt, this is exactly the situation you were trying to avoid when you chose to use mirroring in the first place.

Creating additional filesystems

The base installation of ELS does not set aside any space for additional programs or user data. You will need to carve out more space for these things depending on how you want to use your system.

Here is how would set up swap space:

  1. Create a new partition using fdisk.
  2. If you use mirroring, create a second partition of equal size and mirror the two using mdadm.
  3. Create a filesystem using the mke2fs command.
  4. Add the new filesystem to /etc/fstab.
  5. Mount the filesystem.

Depending on the available hard drive space you'll want to create a filesystem for /opt that is about 500M. All ELS add-on software is configured to install in /opt and 500M should give enough room for future growth. Any remaining space can be given to /home.

Example

The following example shows how to create a filesystem for /opt on a system that uses mirrored disks.

fdisk /dev/hda
fdisk /dev/hdb
mdadm --create /dev/md4 -l mirror -n 2 /dev/hda6 /dev/hdb6
mke2fs /dev/md4
echo "/dev/md4  /opt  ext2  defaults  1  2" >> /etc/fstab
mount /opt

Setting up a non-privileged user

One of the first steps you should take to secure the system is to set the root password and get in the habit of logging in as a non-privileged user. To set the root password simply issue the passwd command while logged in as root.

The process for setting up a non-privileged user is as follows:

  1. Create a primary group for the user using the groupadd command.
  2. Create a new user account with the useradd command.
  3. Set the user's initial password by issuing the command passwd username.

Example

The following example show the commands you could use to set up new group called "users" and a non-privileged user named "Joe Smith".

groupadd -g 500 users
useradd -c "Joe Smith" -g 500 -m -s /usr/bin/bash joe
passwd joe

Note

To further secure the system, you can use the pwconv and grpconv commands to switch over to shadow password and group database files.

Configuring IP networking

If you plan to attach your system to a LAN or the internet, there is a bit more configuration to do. If you choose not to connect to a network, you may skip this section.

The ELS system has limited built-in support for network hardware. Currently only a few 10/100 network cards are supported in the stock kernel. These include the following:

If you have a different network card, you will need to build a custom kernel or module for it before you can finish configuring the network settings.

Steps to enabling IP networking are listed below:

  1. Enter the IP address and mask in /etc/interfaces.
  2. Set the gateway address in /etc/routes.
  3. Set the hostname in /etc/hostname.
  4. Add the fully-qulified domain name to /etc/hosts.
  5. Add your DNS server information to /etc/resolv.conf.
  6. Configure any desired firewall rules in /etc/firewall.
  7. Start the networking subsystem using the /etc/init.d/network script or by entering runlevel 3.

Example

The following example shows a typical setup for a home or small office network. The names of the network configuration files are given followed by the information that was added to them.

/etc/interfaces:
eth0  192.168.1.10 netmask 255.255.255.0

/etc/routes:
default gw 192.168.1.1

/etc/hostname:
els.mydomain.tld

/etc/hosts:
192.168.1.10    els.mydomain.tld    els

/etc/resolv.conf:
domain        mydomain.tld
nameserver    10.10.1.21
nameserver    10.10.1.22

/etc/firewall:
# Allow everything in from the loopback network to come in.
-A INPUT -i lo -s 127.0.0.0/8 -j ACCEPT

# Allow everything from the local ethernet network to come in.
-A INPUT -i eth0 -s 192.168.1.0/16 -j ACCEPT

Note

Each of the network configuration files mentioned above has a man page associated with it to help you with configuration.

Configuring system startup

When ELS is first installed, it is configured to boot into runlevel 1 (single-user mode.) Single-user mode is generally only entered when doing system maintenance and is not used for everyday tasks. After you have finished configuring the system, you will want to change the default runlevel, particularly if you plan to have the system attached to the internet or a local area network. To do this, edit the initdefault entry of /etc/inittab. Choose runlevel 2 for a non-networked machine or runlevel 3 for a machine with a network connection.

Example

The following entry shows the system configured to start in networked mode:

id:3:initdefault:

Verifying the configuration

Congratulations, the basic system configuration is finished. Restart the system by issuing the command shutdown -r now. If all goes well, you should be greeted with a login prompt.

Perform the following steps to verify the configuration:

  1. Log into the system as the non-privileged user.
  2. Check the system time using the date command.
  3. Verify that your swap space appears when you issue the free command.
  4. Issue the mount command and verify that all the filesystems appear.
  5. Ping another host by its DNS name and verify that a reply comes through.

Example

The following example shows output from a typical system when verifying the configuration.

els.domain.tld login: joe
Password:

els:~$ date
Tue Apr 22 10:53:59 CDT 2008

els:~$ free
           total       used       free     shared    buffers     cached
Mem:      257360      43600     213760          0       4004      26220
-/+ buffers/cache:    13376     243984
Swap:       506008        0     506008

els:~$ mount
/dev/md0 on / type ext2 (rw)
proc on /proc type proc (rw)
/dev/md1 on /usr type ext2 (ro)
/dev/md2 on /var type ext2 (rw)
/dev/md3 on /opt type ext2 (rw)
/dev/md4 on /home type ext2 (rw)

els:~$ ping -c3 www.kernel.org
PING pub.us.kernel.org (204.152.191.37): 56 octets data
64 octets from 204.152.191.37: icmp_seq=0 ttl=57 time=56.7 ms
64 octets from 204.152.191.37: icmp_seq=1 ttl=57 time=56.1 ms
64 octets from 204.152.191.37: icmp_seq=2 ttl=57 time=56.5 ms

--- pub.us.kernel.org ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 56.1/56.4/56.7 ms

els:~$

Additional administrative tasks

This section provides a reference for things that you may need to do after the basic system configuration is finished.

Managing users and groups

As an administrator, you will need to set up user accounts and groups to give access to the system's resources.

To set up a new group, simply use the groupadd command. You may choose to provide a group id or simply accept the default, which is to use the next one that is available.

The process for setting up users includes the following steps:

  1. Use the useradd command to add the account, optionally specifying things like additional groups, home directory, default shell, etc.
  2. Set an initial password for the user with the passwd command.
  3. Use smdpasswd to create a Samba account if the user will be sharing files via the Common Internet File System (CIFS) protocol.
  4. Use htpasswd or htdigest to create an Apache account if the user will be using WebDAV or accessing restricted files via HTTP.

Note

You can make your life easier by creating some default values for the useradd command. The command useradd -D shows the current defaults and useradd -D with additional command-line options will set new default values for those options.

Installing additional pre-packaged software

Add-on packages for ELS are found in the /extra directory on the installation CD-ROM. They are packaged as simple .tar.gz files and are designed to reside in the /opt directory.

The procedure for installing add-on software is outlined below.

  1. Preview the contents of the package with the tar -ztvf command.
  2. Check for available space in the /opt filesystem using df.
  3. Change to the / directory and extract the package with the tar -zxf command.
  4. Create necessary symbolic links in /opt/bin, /opt/man and /opt/sbin directories.
  5. If needed, create customized configuration files in the /etc/opt directory.

Example

The following example shows how you might install the ProFTPD server daemon on your system.

mount /media/cdrom
tar -ztvf /media/cdrom/extra/proftpd-1.3.1.i586.tar.gz
df /opt
cd /
tar -zxf /media/cdrom/extra/proftpd-1.3.1.i586.tar.gz
cd /opt/bin
ln -s ../proftpd-1.3.1/bin/* .
cd /opt/man/man1
ln -s ../../proftpd-1.3.1/man/man1/* .
cd /opt/man/man5
ln -s ../../proftpd-1.3.1/man/man5/* .
cd /opt/man/man8
ln -s ../../proftpd-1.3.1/man/man8/* .
cd /opt/sbin
ln -s ../proftpd-1.3.1/sbin/* .
mkdir /etc/opt/proftpd
cp /opt/proftpd-1.3.1/etc/proftpd.conf /etc/opt/proftpd
vi /etc/opt/proftpd/proftpd.conf

Note

Sample configuration files for add-on packages will usually be found in /opt/package-name/etc. It is up to you to decide if you want to copy the config file(s) to /etc/opt/package-name. If you are installing a package for the first time, you will probably want to copy the config file. If you are upgrading a package, you may be able to use existing config file(s) from the previous version with little or no modification.

Building software from source code

There may be times that you need to compile programs from source code rather than using a pre-packaged binary. There are a few steps you must take to prepare the system for this task.

To set up the system to build from source, do the following:

  1. Remount /usr as read-write.
  2. Create a directory outside of the /usr hierarchy in which to store source code.
  3. Create a symbolic link from the traditional /usr/src that points to the directory created in the previous step.
  4. Remount /usr as read-only.
  5. Install the Linux kernel source code from the ELS CD.
  6. Install the Linux kernel config file from the ELS CD.
  7. Run make oldconfig and make dep

Example

The following example shows the commands you would use to prepare a typical system to build software from source.

cd /
mount -o rw /usr
mkdir /home/joe/src
ln -s /home/joe/src /usr/src
mount -o ro /usr
mount /media/cdrom
cd /usr/src
tar -zxf /media/cdrom/src/linux-2.4.36.tar.gz
ln -s linux-2.4.36 linux
cd linux
cp /media/cdrom/src/build-scripts/linux-2.4.36.config .config
make oldconfig
make dep

Maintaining info pages

Info pages are different than man pages in that they have a directory file that serves as a top-level table of contents. This file, /usr/share/info/dir needs to be maintained or the info page collection will appear incomplete. If new packages with info pages are installed they will not appear in the table of contents until the directory is updated. Also, if the dir file is missing, typing info at the shell prompt will result in an error.

The command used to add info pages to the dir file is install-info. To create a table of contents that includes all info pages, first delete the existing dir file and then use the command ( cd /usr/src/info ; for INFOFILE in *.info.gz; do install-info $INFOFILE; done )

Configuring network services

Basic network services like telnet, tftp, pop3 and imap are controlled from /etc/inetd.conf. They generally do not require any configuration other than uncommenting a line in inetd.conf and telling inetd to re-read its config file.

Other network daemons like Apache, Samba and ProFTPD are controlled using scripts in /etc/init.d. These daemons also have configuration files within the /etc/opt directory. See the documentation included with these daemons for more information on how to configure them.

Example

The following example shows how to enable telnet and proftpd (assuming the proftpd add-on package has been installed and configured):

cp inetd.conf inetd.conf.old
sed 's/^#telnet/telnet/' inetd.conf.old >inetd.conf
kill -HUP `pidof inetd`

ln -s ../init.d/proftpd S45proftpd
cd /etc/rc0.d
ln -s ../init.d/proftpd K55proftpd
cp -d K55proftpd /etc/rc1.d
cp -d K55proftpd /etc/rc2.d
cp -d K55proftpd /etc/rc6.d

Note

Be sure to configure firewall rules to grant or restrict access to the desired network services.

Controlling what runs at startup and shutdown

The runlevels in ELS are defined as follows:

The scripts used during system startup and shutdown are located in the /etc/init.d directory. Controlling which of these scripts runs at which runlevel is done by entering the directory for a particular runlevel and creating a symbolic link to the desired script in /etc/init.d. Creating a link name that begins with the letter 'S' will cause the script to be given a start argument. Conversely, any link name that begins with the letter 'K' will cause the script to be given a stop (kill) argument. Linked scripts are executed in alpha-numerical order. For example, K90local_fs will execute before K99poweroff and K scripts always execute before the S scripts.

Example

Below is an example of how you would set up links to start the web server in runlevel 3 and stop it in runlevels 0, 1, 2 and 6.

cd /etc/rc3.d
ln -s ../init.d/httpd S45httpd
cd /etc/rc0.d
ln -s ../init.d/httpd K55httpd
cp -d K55httpd /etc/rc1.d
cp -d K55httpd /etc/rc2.d
cp -d K55httpd /etc/rc6.d

Note

The scripts in the /etc/init.d directory may also be run manually from a shell prompt. Each of the scripts takes a start or stop argument to respectively start or stop a daemon or process. For example, /etc/init.d/crond stop will manually stop the cron daemon. Some scripts also take a status argument to show the current state of the daemon and a restart argument to stop and start with a single command.