Docsity

Installing and Configuring the Linux Environment-Learn The Linux-Handout, Exercises of Linux skills

Toggle sidebar
bg1
ITL WORKSHOP INSTALLING UNIX - PAGE 2 SPRING 2001
Recommended Hardware
Hard disk space with at least 2GB space reserved for Linux;
CD-Rom and floppy drive;
Two Ethernet cards;
Video card and Monitor;
Keyboard and mouse;
FDDI card (optional).
Installing RedHat7.1
The following steps go through a RedHat7.1 Linux Installation from a CD-ROM. We
assume that a copy of the RedHat7.1 CD-ROM distribution is available.
Step 1: Preparing the Installation.
• Insert the disk 1 of RedHat7.1 CD-ROMs in the CD-ROM driver. Reboot the
machine, press “Del” to enter into BIOS setup program. Select “CDROM” as
the 1st boot device. Save the settings and exit.
• When the machine reboots, it will automatically enter the RedHat7.1
installation process. Follow the instructions on the screen to finish your
customized installation step by step.
• Choose a the installation mode. In the Installation Mode Selection screen,
select "text <ENTER>".
Step 2: Starting the Installation.
• Choose a language. In the Language Selection dialog box, select English. .
• Selecting a keyboard type. In the Keyboard Selection dialog box, select
U.S.-style keyboard.
• Select installation type. In the Installation Type dialog box, select "Custom
System".
Step 3: Creating Partitions.
• If you are installing Linux on a brand-new system, this is a good opportunity to
allocate and create partitions for the Linux operating system.
• Select partition mode. In the Automatic Partitioning dialog box, choose
"Manually partition".
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Installing and Configuring the Linux Environment-Learn The Linux-Handout and more Exercises Linux skills in PDF only on Docsity!

ITL WORKSHOP INSTALLING UNIX - PAGE 2 SPRING 2001

Recommended Hardware

Hard disk space with at least 2GB space reserved for Linux; CD-Rom and floppy drive; Two Ethernet cards; Video card and Monitor; Keyboard and mouse; FDDI card (optional).

Installing RedHat7.

The following steps go through a RedHat7.1 Linux Installation from a CD-ROM. We assume that a copy of the RedHat7.1 CD-ROM distribution is available.

Step 1: Preparing the Installation.

  • Insert the disk 1 of RedHat7.1 CD-ROMs in the CD-ROM driver. Reboot the machine, press “Del ” to enter into BIOS setup program. Select “CDROM” as the 1st^ boot device. Save the settings and exit.
  • When the machine reboots, it will automatically enter the RedHat7. installation process. Follow the instructions on the screen to finish your customized installation step by step.
  • Choose a the installation mode. In the Installation Mode Selection screen, select "text ".

Step 2: Starting the Installation.

  • Choose a language. In the Language Selection dialog box, select English..
  • Selecting a keyboard type. In the Keyboard Selection dialog box, select U.S.-style keyboard.
  • Select installation type. In the Installation Type dialog box, select "Custom System".

Step 3: Creating Partitions.

  • If you are installing Linux on a brand-new system, this is a good opportunity to allocate and create partitions for the Linux operating system.
  • Select partition mode. In the Automatic Partitioning dialog box, choose "Manually partition".

ITL WORKSHOP INSTALLING UNIX - PAGE 3 SPRING 2001

  • Select disk setup mode. In the Disk Setup dialog box, you can choose “Disk Druid” or “Fdisk”, to view, add, delete and modify the partitions for the Linux system.
  • Execute the partition. In the Current Disk Partitions dialog box, add, delete and edit partitions. Each partition typed "Linux native" should be arranged a mount point. One Linux partition with type “Linux native” and size of at least 600MB, should be added, and mounted on root directory “/”. This partition will be used to install the system.

It is suggested to create a Linux swap partition. The size of the Linux swap partition depends on the amount of RAM on your machine, but not less than 16MB. It is recommended that

Size of SWAP = 2 x (Size of RAM)

Press "Ok" if the partitioning is finished.

  • Execute the formatting. In the Choose Partitions to Format dialog box, select all "Linux native" partitions. Select "Check for bad blocks during format", but that will take a long time to format the partitions. Press "OK".

Step 4: Configuring LILO.

  • In the LILO Configuration dialog box, press "OK".
  • Choose the place where LILO is running. In the LILO Configuration dialog box (continuous), select "Master Boot Record (MBR)".
  • In the LILO Configuration dialog box(continuous), check the LILO configuration. Edit it if necessary. Press "OK".

Note : The default configuration file for LILO is /etc/lilo.conf. You can manually update this file as root and execute the command "lilo" to make the new configuration permanent for the following reboots.

Step 5: Configuring Network.

  • Configure network. In the Network Configuration dialog box, unselect "Use bootp/dhcp". Input IP address, netmask, default gateway (IP), primary nameserver (IP), second nameserver (IP) and ternary nameserver (IP). Press "OK".
  • Input the hostname. In the Hostname Configuration dialog box, Input a hostname such as gold.
  • Select the security level. In the Firewall Configuration dialog box, choose "No firewall" for "Security Level".

ITL WORKSHOP INSTALLING UNIX - PAGE 5 SPRING 2001

  • A Package Installation progress window pops up, showing the progress that all selected packages are being installed. Disc 2 is needed during the package installation process.

Step 9 : Creating a Bootdisk.

  • We strongly recommend to create a boot diskette. When the operating system fails to boot after changing some configuration files or recompiling the kernel, the boot diskette can be used to boot the system, and correct any settings.
  • In the Bootdisk dialog box, choose "Yes".
  • In the Bootdisk dialog box (continuous), insert a blank floppy into the floppy driver. Press "OK".

Step 10: Configuring X Windows.

  • In the Monitor Probe dialog box: Check the parameters of the monitor detected by the system. Choose "Yes" if it's correct. Otherwise you need to choose "No" to configure the monitor manually.
  • In the Probing to begin dialog box, press "OK".
  • In the Probing finished dialog box, choose "Use Default" if the probed result is correct.
  • In the Starting X dialog box, choose "Ok". Choose "Yes" in the following two questions.

Step 11: Completing the Installation.

  • In the Complete dialog box: Press "OK".
  • The installation is completed and the machine is rebooted automatically.

ITL WORKSHOP INSTALLING UNIX - PAGE 6 SPRING 2001

Recompiling the RedHat7.1 Kernel

The installation program described above creates a kernel with default settings. For the ITLab, the Linux installation needs to be customized, e.g., add FDDI card support, turn on IP forwarding. A customization of the kernel requires that the kernel be recompiled. For customized installations, the RedHat7.1 kernel source code package is needed. You can download the kernel source code package (named linux-2.4.5.tar.gz) from the website: http://www.kernel.org/pub/linux/kernel/v2.4/. The following steps describe how to compile the kernel using linux-2.4.5.tar.gz.

Step 1: Download the source codes package of kernel 2.4.5, linux-2.4.5.tar.gz from

http://www.kernel.org/pub/linux/kernel/v2.4/ and put it on the directory /usr/src.

Step 2: Go to /usr/src and install the software with the following command:

tar –zxvf linux-2.4.5.tar.gz A subdirectory /usr/src/linux will show up after installing the kernel package.

Step 3: cd /usr/src/linux/, type the command:

make menuconfig when the kernel configuration menu is popped up, select the required items:

main-menu ‡ Networking options ‡ [] IP: advanced router [] IP: verbose route monitoring (NEW) [] IP: multicast routing main-menu ‡ Networking device support ‡ Ethernet (10 or 100Mbit) ‡ <> PCI NE2000 and clones support (see help) main-menu ‡ Networking device support ‡ [] FDDI driver support <> Digital DEFEA and DEFPA adapter support (NEW) PPP (point-to –point protocol) support SLIP (serial line) support [] Fibre Channel driver support main-menu ‡ File systems ‡ <> DOS FAT fs support <> MSDOS fs support <> VFAT (Windows 95) fs support main-menu ‡ Console drivers ‡ [*] Video mode selection support

Return to the main menu. Select exit to save the selected items and exit the

configuration program.

Step 4: In /usr/src/linux, execute the following commands:

make dep make clean

ITL WORKSHOP INSTALLING UNIX - PAGE 8 SPRING 2001

Customizing Linux

In order for the RedHat7.1 system to have the required features, the system often needs to be reconfigured. This section describes various customization of the system that may be need for the ITL Labs.

1. Set up IP forwarding.

IP forwarding must be enabled whenever a PC has to act as a router. The file /etc/sysconfig/network specifies whether a machine supports IP forwarding or not. If the machine acts as a router, this file includes a line:

FORWARD_IPV4=yes

If the machine is a host, the line does not exist or is set to FORWARD_IPV4=no.

Unfortunately, according to our experience, there is no system script file which reads and deals with the above configuration line during the initialization phase of the system. To ensure the system can process the configuration of IP forwarding function correctly, the following lines are added to the end of the script file, /etc/rc.d/rc.local.

. /etc/sysconfig/network if [ -d /proc/sys/net/ipv4 ]; then if [ ${FORWARD_IPV4} = "yes" -o ${FORWARD_IPV4} = "true" ]; then echo 1 > /proc/sys/net/ipv4/ip_forward else echo 0 > /proc/sys/net/ipv4/ip_forward fi fi

2. Set up a permanent IP address and a startup static routing table.

In RedHat7.1, suppose you have two Ethernet interfaces on the machine, there are two files which contain the network configurations of these Ethernet interfaces:

/etc/sysconfig/network-scripts/ifcfg-eth0 //for interface eth /etc/sysconfig/network-scripts/ifcfg-eth1 //for interface eth

The contents of ifcfg-eth0 may read like this: DEVICE=eth BOOTPROTO=static BROADCAST=10.0.14. IPADDR=10.0.14. NETMASK=255.255.255. NETWORK=10.0.14. ONBOOT=yes If the content of this file is modified, the updates will take effect during the next reboot of the machine.

The start-up static routing table is specified in the file:

ITL WORKSHOP INSTALLING UNIX - PAGE 9 SPRING 2001

/etc/sysconfig/static-routes, whose contents may be:

eth0 net 10.0.1.0 netmask 255.255.255.0 gw 10.0.13. eth0 net 10.0.6.0 netmask 255.255.255.0 gw 10.0.1. eth1 net 10.0.7.0 netmask 255.255.255.0 gw 10.0.13. eth0 default gw 10.0.11. When the system is booted, each line of the file static-routes is run as the parameters of the command "route".

3. Change the hostname

In RedHat7.1, there is no "easy" way to change the hostname. The command, hostname host-name , just changes the hostname until the next reboot of the system. To permanently change the hostname, you need to edit the following files manually:

/etc/HOSTNAME /etc/sysconfig/network /etc/hosts //if necessary /etc/resolv.conf //if necessary

4. The boot manager Lilo

Lilo is a program which can send/receive information to/from the boot sectors. The configuration file of Lilo, /etc/lilo.conf, contains the data Lilo uses. Below is a typical example of lilo.conf:

boot=/dev/hda map=/boot/map install=/boot/boot.b prompt timeout= linear default=linux

image=/boot/vmlinuz-2.2.14-5. label=linux initrd=/boot/initrd-2.2.14-5.0.img read-only root=/dev/sda other=/dev/hda label=bsd The above setting is for a system with two operating systems, so-called dual-boot system. Here, Lilo lets you boot the computer with Linux (with boot label linux) or FreeBSD (with boot label bsd).

When the machine is booted, the prompt lilo, appears. You select one of the operating systems, by typing the label name followed by the Enter key. Pressing the "Tab" keep displays all label names managed by lilo.

ITL WORKSHOP INSTALLING UNIX - PAGE 11 SPRING 2001

Installing software for the ITLab

There are several network tools or software used in the lab manual for the ITLab. All of them can be found on the Internet, and downloaded at no cost. We have downloaded the software required to run ITL Labs, and made it available at http://www.cs.virginia.edu/~itlab/software.

Below is a summary of the software packages, with summaries of the installation procedures.

Installing inetd, in.telnetd, in.ftpd, in.fingerd, in.talkd, in.ntalkd,

in.rshd, in.rlogind

The inetd server, also called superserver, is a network daemon program that manages incoming network connections. It monitors all network interfaces. The configuration file of inetd has information on the program to run when an incoming connection is received. For example, when receiving a telnet connection, inetd calls in.telnetd to deal with the request. As a exercise, you will install them manually.

Note: For security resons, you should close more network servers as possible, such as ftp, telnet, shell, login, exec, talk, ntalk, imap, pop-2, pop-3, finger, auth, etc. If a machine acts as a www and ftp server, only port 80, port 20 and port 21 need to be used for www and ftp services. All other unrelated ports should be closed.

  • You can check if inetd is running on your system by typing:

ps –aux | grep "inetd"

  • If inetd is not installed, download the following packages from the website http://www.cs.virginia.edu/~itlab/software. All of them are in .rpm format:.

inetd-0.16-4.i386.rpm telnet-server-0.16-6.i386.rpm wu-ftpd-2.6.0-3.i386.rpm finger-server-0.16-5.i386.rpm talk-server-0.16-4.i386.rpm rsh-server-0.16-12.i386.rpm

  • To install a package in rpm format, execute the following command:

rpm –ivh inetd-0.16-4.i386.rpm To uninstall the above rpm format package, type:

rpm –e inetd

ITL WORKSHOP INSTALLING UNIX - PAGE 12 SPRING 2001

  • Customize the configuration file /etc/inetd.conf. Below is the contents of /etc/inetd.conf. The bold lines indicate important network services.

inetd.conf This file describes the services that will be available

through the INETD TCP/IP super server. To re-configure

the running INETD process, edit this file, then send the

INETD process a SIGHUP signal.

Version: @(#)/etc/inetd.conf 3.10 05/27/

Authors: Original taken from BSD UNIX 4.3/TAHOE.

Fred N. van Kempen,

Modified for Debian Linux by Ian A. Murdock

Modified for RHS Linux by Marc Ewing

Echo, discard, daytime, and chargen are used primarily for testing.

To re-read this file after changes, just do a 'killall -HUP inetd'

echo stream tcp nowait root internal echo dgram udp wait root internal discard stream tcp nowait root internal discard dgram udp wait root internal daytime stream tcp nowait root internal daytime dgram udp wait root internal #chargen stream tcp nowait root internal #chargen dgram udp wait root internal time stream tcp nowait root internal time dgram udp wait root internal

These are standard services.

ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd

Shell, login, exec, comsat and talk are BSD protocols.

shell stream tcp nowait root /usr/sbin/tcpd in.rshd login stream tcp nowait root /usr/sbin/tcpd in.rlogind #exec stream tcp nowait root /usr/sbin/tcpd in.rexecd #comsat dgram udp wait root /usr/sbin/tcpd in.comsat talk dgram udp wait nobody.tty /usr/sbin/tcpd in.talkd ntalk dgram udp wait nobody.tty /usr/sbin/tcpd in.ntalkd #dtalk stream tcp wait nobody.tty /usr/sbin/tcpd in.dtalkd

Pop and imap mail services et al

#pop-2 stream tcp nowait root /usr/sbin/tcpd ipop2d #pop-3 stream tcp nowait root /usr/sbin/tcpd ipop3d #imap stream tcp nowait root /usr/sbin/tcpd imapd

The Internet UUCP service.

#uucp stream tcp nowait uucp /usr/sbin/tcpd /usr/lib/uucp/uucico -l

Tftp service is provided primarily for booting. Most sites

run this only on machines acting as "boot servers." Do not uncomment

this unless you need it.

#tftp dgram udp wait root /usr/sbin/tcpd in.tftpd #bootps dgram udp wait root /usr/sbin/tcpd bootpd

Finger, systat and netstat give out user information which may be

valuable to potential "system crackers." Many sites choose to disable

some or all of these services to improve security.

finger stream tcp nowait nobody /usr/sbin/tcpd in.fingerd #cfinger stream tcp nowait root /usr/sbin/tcpd in.cfingerd

ITL WORKSHOP INSTALLING UNIX - PAGE 14 SPRING 2001

  • The configuration file /root/.rhosts is used for running remote commands on remote commands using rsh. It contains host names and user names. The file allows a user on a machine with the IP address or hostname listed, to run rsh to execute commands remotely. In the ITLab, root can run rsh on all remote IP addresses. So, the file /root/.rhosts looks like this:

10.0.12.1 root 10.0.12.2 root 10.0.14.1 root 10.0.14.2 root 10.0.23.1 root 10.0.23.2 root 10.0.45.1 root 10.0.45.2 root 10.0.56.1 root 10.0.56.2 root 10.0.36.1 root 10.0.36.2 root vintpc1 root vintpc2 root vintpc3 root vintpc4 root vintpc5 root vintpc6 root

Installing tcpdump

Tcpdump, a powerful network monitoring and analyzing tool, is widely used in the ITLab manual. The following steps install tcpdump in /usr/local/bin.

  • Download the software tcpdump_3.4a6.orig.tar.gz and libpcap.tar.gz from the following website:

http://www.cs.virginia.edu/~itlab/software

  • Install libpcap library and tcpdump.
    • Unzip them in some directory, for example, /usr/src/tcpdump-linux
    • First install libpcap: cd /usr/src/tcpdump-linux/libpcap-0. ./configure make make install;make install-incl;make install-man
    • Then install tcpdump: cd /usr/src/tcpdump-linux/tcpdump-3.4a6.orig (in Makefile.in, set BINDEST=/usr/local/bin, MANDEST=/usr/local/man) ./configure make make install;make install-man

ITL WORKSHOP INSTALLING UNIX - PAGE 15 SPRING 2001

Installing ethereal

  • Download the ethereal software package ethereal-0.8.14.tar.gz from the following website to the installation directory, for example, /root/ethereal-install: http://www.cs.virginia.edu/~itlab/software
  • Install ethereal as follows: cd /root/ethereal_install tar –zxvf ethereal-0.8.14.tar.gz cd /root/ethereal_install/ethereal-0.8. ./configure make make install
  • This creates two executable programs: /usr/local/bin/ethereal /usr/local/bin/tethereal

Installing ttcp

  • Download the ttcp software package, ttcp-1.4-1.src.rpm, from http://www.cs. virginia.edu/~itlab/software to the directory /root/ttcp-install.
  • Install ttcp as follows: cd /root/ttcp-install rpm –ivh ttcp-1.4-1.src.rpm // (This will create a file, ttcp.shar, in the // directory /usr/src/redhat/SOURCES) cd /usr/src/redhat/SOURCES mkdir ttcp mv ttcp.shar ttcp cd ttcp unshar ttcp.shar gcc –o ttcp ttcp.c cp ttcp /usr/local/bin cp ttcp.1m /usr/local/man/man

Installing Kermit

  • Download the kermit software package, C-Kermit-7.0_196-1_i386.rpm, from one of the following two websites to /root/Kermit-install. http://www.cs.virginia.edu/~itlab/software
  • Install kermit. cd /root/kermit-install rpm –ivh C-Kermit-7.0_196-1_i386.rpm