The harddisk of the server is 3GB and it is partitioned as seen in the figure.
hda1 hda2 hda3 +---------------+-------------+-----------------------------------+ | rescue 800 MB | swap 200 MB | server 2GB | +---------------+-------------+-----------------------------------+
Figure 1. Partitions of the disk
The first partition holds a minimal linux installation, which can be used as a rescue system in case that something goes wrong in the server and it becomes inaccessible. The swap partition is about twice as the size of RAM. The server partition must be about 2GB. The rescue partition can be omitted, however the configurations described here assume the above configuration of the disk partitions.
The installation is based on Fedora1 and it is done from Internet, using a boot floppy and a network drivers floppy.
An installation server contains the installation disks of linux and makes them accessible through NFS or FTP or HTTP. Our installation server will make available Fedora1 through HTTP.
First download linux. I will describe a scenario below however it may change according to the distribution, ftp server, etc. For a list of download mirrors where you can find Fedora, see http://fedora.redhat.com/download/mirrors.html .
bash# mkdir /var/local/fedora1 bash# cd /var/local/fedora1 bash# lftp ftp://ftp.easynet.nl lftp ftp.easynet.nl:~> cd mirror/fedora/1/i386/iso/ lftp ftp.easynet.nl:~> ls -rw-r--r-- 1 ftp easynet 669122560 Sep 3 21:54 yarrow-i386-disc1.iso -rw-r--r-- 1 ftp easynet 677511168 Mar 14 2003 yarrow-i386-disc2.iso -rw-r--r-- 1 ftp easynet 508592128 Mar 14 2003 yarrow-i386-disc3.iso lftp ftp.easynet.nl:~> at 00:30 tomorrow -- get yarrow-i386-disc1.iso & lftp ftp.easynet.nl:~> at 02:30 tomorrow -- get yarrow-i386-disc2.iso & lftp ftp.easynet.nl:~> at 04:30 tomorrow -- get yarrow-i386-disc3.iso & lftp ftp.easynet.nl:~> exit bg
The download is scheduled for after midnight, so that it does not block the network traffic.
Create a script that will mount the Fedora1 ISO disks:
bash# vi /var/local/fedora1/mount-fedora-discs.sh
#!/bin/bash cd /var/local/fedora1 mount -t iso9660 -o loop yarrow-i386-disc1.iso disc1/ mount -t iso9660 -o loop yarrow-i386-disc2.iso disc2/ mount -t iso9660 -o loop yarrow-i386-disc3.iso disc3/
Make it executable:
bash# chmod 755 /var/local/fedora1/mount-fedora-discs.sh
Mount the Fedora1 ISO disks:
bash# cd /var/local/fedora1/ bash# mkdir disc1 bash# mkdir disc2 bash# mkdir disc3 bash# ./mount-fedora-discs.sh
Mount them also each time that the computer is rebooted:
bash# vi /etc/rc.d/rc.local ### mount fedora1 discs /var/local/fedora1/mount-fedora-discs.sh
Make them accessible from the web:
bash# cd /var/www/html/ bash# mkdir fedora1 bash# cd fedora1/ bash# lndir /var/local/fedora1/disc1 bash# lndir /var/local/fedora1/disc2 bash# lndir /var/local/fedora1/disc3
Note | |
---|---|
Make sure that apache is up and running: bash# /sbin/chkconfig --list httpd bash# /sbin/chkconfig --level 2345 httpd on bash# /sbin/service httpd status bash# /sbin/service httpd restart |
To prepare the floppies we will use the floppy images that we can download from the installation server. The IP 11.22.33.44 that is used as the IP of the installation server, should be replaced by the IP of your installation server. In case that you couldn't prepare an installation server (for any reason), you can use any public HTTP installation server that can be found at http://fedora.redhat.com/download/mirrors.html . For example, instead of http://11.22.33.44/fedora1/ you can use http://mirrors.kernel.org/fedora/core/1/i386/os/ .
To prepare the floppies, follow these steps:
Download bootdisk.img and drvnet.img from http://11.22.33.44/fedora1/images/
In linux, use the command dd to write the floppies, like this:
bash$ dd if=bootdisk.img of=/dev/fd0 bs=1440k bash$ dd if=drvnet.img of=/dev/fd0 bs=1440k
In windows, download rawrite.exe from http://11.22.33.44/fedora1/dosutils/ , and use it like this:
C:> rawrite Enter disk image source file name: bootdisk.img Enter target diskette drive: a: Please insert a formatted diskette into drive A: and press --ENTER-- : [Enter] C:>
The installation of Rescue can be done using the first installation floppy. At the boot: prompt type linux dd :
boot: linux dd
The parameter dd tells to the kernel that we have a driver disk , so, after the kernel is loaded, it will ask for driver floppies. At this time we insert the network drivers floppy (the second floppy), and after that the kernel will be able to configure and use the network cards, so that it can perform the rest of the installation from the Internet.
Before continuing with the installation, it will ask for the installation method (select HTTP ), for the installation server and path (set http://11.22.33.44/fedora1/ ), for the parameters of the network card and the network (IP, NETMASK, GATEWAY, DNS SERVER, etc.). It will retrieve the installation program from the installation server and the rest of the installation is just like a normal (CD-ROM) installation. Make sure that when you select the packages, you select no packages at all; this does not mean that no packages at all will be installed, it means that only the most necessary packages will be installed and no additional packages (a minimal installation).
Alternatively, the installation of the Rescue system can be done almost automatically like this:
Create a kickstart file :
bash$ vi ks.cfg # Kickstart file network --device eth0 --bootproto static --ip 10.10.3.101 --netmask 255.255.255.0 --gateway 10.10.3.253 --nameserver 11.22.33.44 --hostname rescue network --device eth1 --bootproto static --ip 10.10.3.100 --netmask 255.255.255.0 --gateway 10.10.3.253 --nameserver 11.22.33.44 --hostname rescue url --url http://11.22.33.44/fedora1 lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 timezone Europe/Tirane keyboard us install rootpw --iscrypted $1$FpTm50gJ$gL82MlzncIjZA6MPUGkBD/ firewall --enabled --http --ssh authconfig --enableshadow --enablemd5 mouse none skipx bootloader --location=mbr --lba32 #use existing partitions part / --fstype ext3 --onpart hda3 part swap --onpart hda2 reboot %packages %post
Write it to the first floppy:
bash$ mount /mnt/floppy bash$ cp ks.cfg /mnt/floppy
At the time of installation write this at the boot: prompt:
boot: linux dd ks=floppy
Then the rest of the installation should continue without intervention.
Note | |
---|---|
It is better to write ks.cfg in both floppies, in case that you forget to swap the floppies after the network drivers are loaded. |
Create the file ks-server.cfg and write it on both floppies. If there is not enough space in the first floppy, remove some of the files *.msg .
Modify the file syslinux.cfg in the boot floppy (first floppy) by adding these lines:
default server prompt 1 timeout 300 [. . . . .] label server kernel vmlinuz append dd ks=floppy:/ks-server.cfg initrd=initrd.img ramdisk_size=8192 [. . . . .]
(It may be readonly, make it writable first.)
Reboot the machine with the boot floppy in and write at the prompt:
boot: server
or just pres [enter], since it is the default.
Wait until the installation is finished.
The post-install script at the end of the file does the configuration of the server after installation. However, the configuration steps will be described in detail later, so that they can be done manually, in case that something goes wrong at the installation time.
# Kickstart file network --device eth0 --bootproto static --ip 10.10.3.101 --netmask 255.255.255.0 --gateway 10.10.3.253 --nameserver 11.22.33.44 --hostname gateway network --device eth1 --bootproto static --ip 10.10.3.100 --netmask 255.255.255.0 --gateway 10.10.3.253 --nameserver 11.22.33.44 --hostname gateway url --url http://11.22.33.44/fedora1 lang en_US.UTF-8 langsupport --default en_US.UTF-8 en_US.UTF-8 timezone Europe/Tirane keyboard us install rootpw --iscrypted $1$FpTm50gJ$gL82MlzncIjZA6MPUGkBD/ firewall --enabled --http --ssh authconfig --enableshadow --enablemd5 mouse none skipx bootloader --location=mbr --lba32 #use existing partitions part / --fstype ext3 --onpart hda3 part swap --onpart hda2 reboot %packages --resolvedeps @ web-server @ mail-server @ dns-server @ dialup @ sql-server @ editors @ admin-tools @ system-tools @ ftp-server @ text-internet grub kernel samba samba-swat %post ### This script configures the system after installation ### downloaded them from the web cd / wget http://11.22.33.44/backup/config-webserver.tgz wget http://11.22.33.44/backup/cache-5.0.4-1.i386.rpm ### alternatively, if they are backed up in the Rescue partition, ### mount /dev/hda1 in order to access the config backup and the cache rpm # mkdir /mnt/hda1 # mount /dev/hda1 /mnt/hda1 ### restore some configuration files cd / tar xvpfz config-webserver.tgz # tar xvpfz /mnt/hda1/backup/config-webserver.tgz ### install boot menu grub-install --force-lba /dev/hda ### start httpd /sbin/chkconfig --level 2345 httpd on /sbin/service httpd start ### configure and start samba /usr/sbin/useradd samba chgrp samba /var/www/html chmod 775 /var/www/html /sbin/chkconfig --level 2345 smb on /sbin/service smb start ### install cache rpm -Uhv cache-5.0.4-1.i386.rpm # rpm -Uhv /mnt/hda1/backup/cache-5.0.4-1.i386.rpm # the rest of cache installation must be done manually # bash# ssh root@localhost # bash# cd /usr/cachekit/5.0.4/ # bash# ./cinstall
The bootloader menu will be installed in the Rescue partition, because it is safer there. Follow these steps:
Open the file /boot/grub/grub.conf and edit it so that it looks like this:
bash# vi /boot/grub/grub.conf default=1 timeout=10 splashimage=(hd0,0)/boot/grub/splash.xpm.gz title Fedora Core (2.4.22-1.2115.nptl) rescue root (hd0,0) kernel /boot/vmlinuz-2.4.22-1.2115.nptl ro root=/dev/hda1 initrd /boot/initrd-2.4.22-1.2115.nptl.img title Fedora Core (2.4.22-1.2115.nptl) gateway root (hd0,2) kernel /boot/vmlinuz-2.4.22-1.2115.nptl ro root=/dev/hda3 initrd /boot/initrd-2.4.22-1.2115.nptl.img
Now mount the rescue partition and chroot there:
bash# mkdir /mnt/hda1 bash# mount /dev/hda1 /mnt/hda1 bash# /usr/sbin/chroot /mnt/hda1
After chroot , we are in the Rescue system. Modify the file /boot/grub/grub.conf same as above.
Now re-install grub (it was installed first during installation):
bash# /sbin/grub-install --help bash# /sbin/grub-install --force-lba /dev/hda