RHCE (Exam Preparation Guide) - Hello World 2001

(RedHat Linux 7.0)


 

  • Preface:

  • Please note that the following guide should be followed in order because some of the testing require previously installed components.
  • The components including base, networking, etc. are listed in Red Hat Linux 7.0 Installation CD 1 "/mnt/cdrom/RedHat/base/comps".

 

  • Environment:

The following system environment is assumed:

  • Linux = RedHat Linux 7.0 (Standalone)
  • Motherboard = ATX
  • BIOS = Award Modular BIOS 4.51 PG
  • CPU = Intel Celeron 466 MHz
  • RAM = 64 MB
  • Primary Master Hard Disk (IDE) = 6.4 GB [Windows 98 Installed]
  • Primary Slave Hard Disk (IDE) = 1.2 GB [Linux Installation]
  • Secondary Master CD Drive (IDE) = RICOH RW7063A
  • Video Card = Savage 3D
  • Mouse + Keyboard + Floppy Drive
  • Serial Modem = 33.6 kbps
  • CD-ROM Drive [Windows 98] = D:\
Download the Demo sample, extract it and test it.

 

  • Preparation:

  • Turn on the computer and wait until it prompts you to "Press DEL to enter SETUP". Then press DEL.
  • CMOS SETUP UTILITY:
    IDE HDD AUTO DETECTION:
    Select Primary Master Option: Y
    Select Primary Slave Option: Y
    
    STANDARD CMOS UTILITY:
    Primary Master: 6.4 GB
    Primary Slave: 1.2 GB
    
    CMOS SETUP UTILITY:
    SAVE & EXIT
    
    Install Windows 98 on the Primary Master drive (hda).

 

  • "7. understand different approaches to multiple-boot installations and be familiar with installation-related tools (rawrite, fips)sometimes used during multiple- boot installations":

  • On the Primary Master drive (hda), MS-DOS prompt from the already installed Windows 98.
    Start -> Programs -> MS-DOS Prompt
    
  • Place the RedHat Linux 7.0 Installation CD 1 into the CD-ROM drive. Place a blank floppy disk into the floppy drive then type:
    d:\dosutils\rawrite.exe
    
    Enter disk image source file name: d:\images\boot.img
    Enter target diskette drive: a:\
    Please insert a formatted diskette into drive A: and press -ENTER- :
    
    This Linux formatted image file has been written on the floppy disk. This disk will be used to boot for the Linux Installation CD.

 

  • "2. be thoroughly familiar with, and capable of, Red Hat installation, particularly network installations":

  • Reboot the computer with the boot.img floppy and at the "boot: " prompt, type:
    text
    
  • Note: For network installations, the image "bootnet.img" from the CD's /images directory is used to write on the floppy instead of the image "boot.img". Insert CD 1 and a blank floppy for Linux and type:
    /bin/mount /dev/fd0 /mnt/floppy
    /bin/mount /dev/cdrom /mnt/cdrom
    /bin/dd if=/mnt/cdrom/images/bootnet.img of=/dev/fd0
    
    This standalone system will use the "boot.img" installation from the CD media.

 

  • "1. understand disk partitioning and know how to use Red Hat's install-time partitioning tools":

Configure the Installation with the following settings, otherwise choose the default option provided.

Note: Be careful not to modify the disks with data in them, e.g. Primary Master (hda) with Windows 98 installed, particularly its partition and the Master Boot Record (MBR). This is because the Windows 98 can only be booted from the MBR.

  • Installation Type: Custom System
  • Disk Setup: fdisk
    /dev/hdb (1.2GB) [That is, the blank Primary Slave harddrive.]
    Print Partition Table
    Command: p
    
    Delete every partition numbers on that disk if exist.
    Command: d
    
    Add new partitions (Primary Partition "/boot". Only 4 Primary Partitions.)
    Command: n (add new partition)
    Command Action: p (primary partition)
    Partition Number: 1 (In a 16M separate partition to overcome the PC BIOS limitation.)
    First Cylinder: (default 1) [Enter]
    Last Cylinder: +16M
    
    Add new partitions (Extended Partition with logical partitions: swap, "/home", "/")
    Command: n (add new partition)
    Command Action: e (extended partition)
    Partition Number: 2
    First Cylinder: (default 4) [Enter]
    Last Cylinder: (default 155) [Enter]
    
    Add new partitions (Logical Parition swap [Swap size >= (RAM * 2)])
    Command: n (add new partition)
    Command Action: l (logical partition)
    Partition Number: 5 (The first 4 partitions are Primary/Extended Partitions)
    First Cylinder: (default 4) [Enter]
    Last Cylinder: +128M
    
    Change partition type (Logical Partition swap)
    Command: t (change partition id type)
    Partition Number: 5
    Hex code: 82
    
    Add new partitions (Logical Partition "/home" for testing user disk usage quota)
    Command: n (add new partition)
    Command Action: l (logical partition)
    Partition Number: 6
    First Cylinder: (default 21) [Enter]
    Last Cylinder: +1M
    
    Add new partitions (Logical Partition "/" will fill up the remaining disk space)
    Command: n (add new partition)
    Command Action: l (logical partition)
    Partition Number: 7
    First Cylinder: (default 21) [Enter]
    Last Cylinder: (default 155) [Enter]
    
    Set boot partition
    Command: a
    Partition Number: 1
    
    Save and Exit
    Command: w
    
    Disk Setup: Done [It will then load Disk Druid.]
  • Current Disk Partition
    hdb1 [Enter] -> Mount Point: /boot
    hdb6 [Enter] -> Mount Point: /home
    hdb7 [Enter] -> Mount Point: /
    
    Press [OK]
  • Choose Partition to Format
    [*] /dev/hdb7 /
    [*] /dev/hdb1 /boot
    [*] /dev/hdb6 /home
    
    Press [OK]
    The Primary Slave disk (hdb) should now look like this:
    /dev/hdb
    
    Primary/Extended:  /dev/hdb1               /dev/hdb2
            Logical:               /dev/hdb5  /dev/hdb6    /dev/hdb7
                     [   /boot   |   swap    |   /home   |      /    ]
    
    Note: Logical partitions are needed if there
    are more than 4 partitions needed for the disk.
    

 

  • "3. understand install-time configuration of install-time options":

  • LILO Configuration:
    /dev/hdb1 First sector of boot partition [Enter]
    
  • Root Password: Enter your root password twice.
  • Package Group Selection: Do not install any of the listed packages. The status should show:
    Total install size: 195M
    
    Choose [OK]
  • Bootdisk: Choose [Yes] and place a blank floppy disk into the floppy drive then hit [OK]. This disk will be used to boot the Linux hard disk.

 

  • "4. understand and be able to implement post-installation configuration of install-time options":

  • After installation, boot the Linux disk from the Bootup floppy disk.
  • This part involves with setting the time, mouse, etc. after the installation using existing Linux packages such as /usr/sbin/timeconfig, /usr/sbin/mouseconfig, etc. It is possible to see other configuration tools by using the following command:
    /usr/bin/slocate config | /bin/grep "/usr/sbin"
    
  • If you want to boot the Linux kernel from the root partition of the Linux hard disk (hdb) rather than booting it from the floppy.
    /sbin/mkbootdisk --device /dev/fd0 2.2.16-22
    /bin/mount /dev/fd0 /mnt/floppy
    /bin/cp /boot/map /mnt/floppy/boot/map
    
    That is the Linux kernel version is 2.2.16-22.

 

  • "5. be familiar with RedHat Linux filesystem layout":

  • Observe the mounted filesystem table and see how a mount point can have a separate partition. e.g. /boot and /dev/hdb1; /home and /dev/hdb6
    /usr/bin/man fstab
    
    /bin/cat /etc/fstab | /usr/bin/less
    
    LABEL=/                 /                       ext2    defaults        1 1
    LABEL=/boot             /boot                   ext2    defaults        1 2
    LABEL=/home             /home                   ext2    defaults        1 2
    /dev/cdrom              /mnt/cdrom              iso9660 noauto,owner,ro 0 0
    /dev/fd0                /mnt/floppy             auto    noauto,owner    0 0
    none                    /proc                   proc    defaults        0 0
    none                    /dev/pts                devpts  gid=5,mode=620  0 0
    /dev/hdb5               swap                    swap    defaults        0 0
    
    
    /bin/mount | /bin/sort | /usr/bin/column -t
    
    /dev/fd0   on  /mnt/floppy    type  vfat      (rw)
    /dev/hdb1  on  /boot          type  ext2      (rw)
    /dev/hdb6  on  /home          type  ext2      (rw)
    /dev/hdb7  on  /              type  ext2      (rw)
    none       on  /dev/pts       type  devpts    (rw,gid=5,mode=620)
    none       on  /proc          type  proc      (rw)
    usbdevfs   on  /proc/bus/usb  type  usbdevfs  (rw)
    
    
    /bin/mount /dev/fd0 /mnt/floppy
    /bin/ls -alrt /mnt/floppy
    /bin/umount /dev/fd0
    /bin/ls -alrt /mnt/floppy
    
  • File System Hierarchy Standards
    • /bin, binary files
    • /dev, device files
    • /etc, host-specific configuration data
    • /lib, system libraries
    • /sbin, binary files for system administrator
    • /boot, boot loader
    • /home, users' home directories
    • /lost+found, recovered files during file system rebuilds
    • /mnt, mount points for temporarily mounted file systems
    • /proc, system information
    • /root, home directory for the root user
    • /tmp, temporary files
    • /usr, shareable files not essential to basic system operation
    • /var, non-shareable files not essential to basic system operation

 

  • "6. understand the role of the scripts and configuration files under /etc/sysconfig/network-scripts":

Configure and activate for an extra loopback device i.e. the standalone system uses localhost.localdomain (127.0.0.1). Setting an IP alias (192.168.1.10) for the loopback device can act as a server while (127.0.0.1) can act as the client:

  • /bin/ls -alrt /etc/sysconfig/network-scripts
    /bin/cp -r !$ !$.1
    /bin/vi /etc/sysconfig/network-scripts/ifcfg-lo:0
    ############################################################
    IPADDR="192.168.1.10"
    NETMASK=""
    ############################################################
    /sbin/ifconfig
    cd /etc/sysconfig/network-scripts
    /etc/sysconfig/network-scripts/ifup-aliases lo
    history
    !/sbin
    cd -
    

 

  • "8. understand kickstart installation basics (kickstart files, floppy- vs. network-based, installation media, boot disk preparation, etc.)":

  • Insert RedHat Linux Installation Disk 2 into the CD drive, insert the Linux Rescue floppy (boot.img) into the floppy drive and type.
    /bin/mount /dev/cdrom /mnt/cdrom
    /bin/rpm -ivh /mnt/cdrom/RedHat/RPMS/mkkickstart-2.3-1.noarch.rpm
    /bin/umount /dev/cdrom
    
    /bin/mount /dev/fd0 /mnt/floppy
    /bin/mv /mnt/floppy/syslinux.cfg /mnt/floppy/syslinux.cfg.1
    /bin/vi /mnt/floppy/syslinux.cfg
    ############################################################
    default ks
    label ks
      kernel vmlinuz
      append ks=floppy initrd=initrd.img
    ############################################################
    /bin/chmod 755 /mnt/floppy/syslinux.cfg
    
    /usr/sbin/mkkickstart > /mnt/floppy/ks.cfg
    /bin/umount /dev/fd0
    /sbin/shutdown -r now
    
    Note: If ks.cfg is not present on the floppy then it will complain, which indicates that syslinux.cfg is implemented correctly to search for ks.cfg.

 

  • "9. possess a thorough knowledge of the rpm command and its switches, particularly those related to the installation and querying of packages":

  • To list all of the installed packages:
    /bin/rpm -qa
    
  • To show the information about a package, insert Installation CD 2:
    /bin/mount /dev/cdrom /mnt/cdrom
    /bin/rpm -qip /mnt/cdrom/RedHat/RPMS/mkkickstart-2.3-1.noarch.rpm
    /bin/umount /dev/cdrom
    
  • To list the files within a package, insert Installation CD 2:
    /bin/mount /dev/cdrom /mnt/cdrom
    /bin/rpm -qlp /mnt/cdrom/RedHat/RPMS/mkkickstart-2.3-1.noarch.rpm
    /bin/umount /dev/cdrom
    
  • To install (packages that are not on system) a package, insert Installation CD 2:
    /bin/mount /dev/cdrom /mnt/cdrom
    /bin/rpm -ivh /mnt/cdrom/RedHat/RPMS/mkkickstart-2.3-1.noarch.rpm
    /bin/umount /dev/cdrom
    
  • To upgrade (packages on or not on the system) a package, insert Installation CD 2:
    /bin/mount /dev/cdrom /mnt/cdrom
    /bin/rpm -Uvh /mnt/cdrom/RedHat/RPMS/mkkickstart-2.3-1.noarch.rpm
    /bin/umount /dev/cdrom
    
  • To freshen (just those packages already on the system) a package, insert Installation CD 2:
    /bin/mount /dev/cdrom /mnt/cdrom
    /bin/rpm -Fvh /mnt/cdrom/RedHat/RPMS/mkkickstart-2.3-1.noarch.rpm
    /bin/umount /dev/cdrom
    
  • To find which package that a file belongs to and its information:
    /bin/rpm -qif /bin/pwd
    
  • Use a file to list the files that belongs to the same package:
    /bin/rpm -qlf /bin/tar
    
  • For more information, type:
    /bin/rpm
    /usr/bin/man rpm
    

 

  • "10. be familiar with the basic elements of source (*.src.rpm) rpm packages":

  • Insert CD 2 into the CD drive:
    /bin/mount /dev/cdrom /mnt/cdrom
    /bin/rpm -qlp /mnt/cdrom/SRPMS/zip-2.3-8.src.rpm
    /bin/rpm -ivh !$
    /bin/ls /usr/src/redhat/SOURCES
    ^SOURCES^SPECS
    /bin/umount /dev/cdrom
    

 

  • "11. know how to boot into and use the rescue environment for system recovery":

  • Insert the Linux Rescue floppy (boot.img) into the floppy drive. Insert CD 1 into the CD drive.
  • Reboot the computer and at the "boot: " prompt, type
    linux rescue
    
  • Select default options and at the "sh-2.04# " prompt, type:
    mknod /dev/hdb
    fdisk -l /dev/hdb
    
    mknod /dev/hdb7
    e2fsck /dev/hdb7
    
    mkdir /mnt/hd
    mount /dev/hdb7 /mnt/hd
    chroot /mnt/hd
    cd
    /bin/mount /dev/hdb1 /boot
    
    /bin/vi /etc/lilo.conf
    ################################################################
    boot=/dev/hdb1
    map=/boot/map
    install=/boot/boot.b
    prompt
    timeout=50
    message=/boot/message
    linear
    default=linux
    
    image=/boot/vmlinuz-2.2.16-22
            label=linux
            read-only
            root=/dev/hdb7
    
    other=/dev/hda1
            label=dos
    ################################################################
    /sbin/lilo -v -v
    /bin/sync;/bin/sync;/bin/sync
    cd /;/bin/umount /boot
    /sbin/reboot
    
    For more information on lilo.conf, type:
    /usr/bin/man lilo.conf
    

 

  • "13. know how to configure the user environment":

  • export TMP_PATH=/tmp
    /usr/bin/env | /bin/grep -i "tmp"
    

 

  • "14. be familiar with system and user bash configuration files":

  • Backup:
    /bin/cp -r /etc/skel /etc/skel.1
    
  • Append the following to /etc/skel/.bash_logout:
    /bin/echo "Goodbye."; /bin/sleep 1
    
  • In /etc/skel/.bashrc, under "# User specific aliases and functions", type:
    alias ls='/bin/ls -alrt'
    
  • In /etc/skel/.bash_profile, under "# User specific environment and startup programs", type:
    TMP_PATH=/tmp
    
    export TMP_PATH
    

 

  • "12. know how to create different kinds of user accounts":

Ordinary Users

  • Backup:
    /bin/cp -r /etc/passwd /etc/passwd.1
    /bin/cp -r /etc/group /etc/group.1
    /bin/cp -r /etc/shadow /etc/shadow.1
    /bin/cp -r /etc/gshadow /etc/gshadow.1
    
  • Add ordinary users "red" and "hat". Type in their password twice:
    /usr/sbin/useradd red
    /usr/bin/passwd red
    
    /usr/sbin/useradd hat
    /usr/bin/passwd hat
    
    /usr/bin/diff /etc/passwd.1 /etc/passwd
    /usr/bin/diff /etc/group.1 /etc/group
    
  • Test by typing "exit" then login with user "red" and or user "hat".

Mail User (POP)
  • Backup:
    /bin/cp -r /etc/aliases /etc/aliases.1
    
  • Add POP user "mailuser and type in the password twice":
    /usr/sbin/useradd mailuser
    /usr/bin/passwd mailuser
    /usr/bin/diff /etc/shadow- /etc/shadow
    
  • Change mailuser's group type to "popusers":
    /bin/cat /etc/group | /bin/grep "popusers"
    /bin/vi /etc/passwd
    ##################################################
    # From this...
    # mailuser:x:502:502::/home/mailuser:/bin/bash
    #
    # To this...
    mailuser:x:502:45::/home/mailuser:/bin/false
    ##################################################
    
  • Append the following to the "/etc/aliases" file:
    ##################################################
    root: red
    red: hat
    hat: mailuser
    ##################################################
    
    Activate the changes by typing:
    /usr/bin/newaliases
    
  • Testing:
    /bin/mail [email protected]
    ##################################################
    Subject: test1
    hello world(Press Enter)
    (Press Ctrl-d)
    Cc:(Press Enter)
    ##################################################
    /bin/cat /var/spool/mail/mailuser
    /bin/cat /var/mail/mailuser
    

    User management can be done through a tool called "/sbin/linuxconf".

 

  • "15. understand quotas, quota concepts, and be able to implement user and group quotas":

  • User Quota:
    /bin/cp /etc/fstab /etc/fstab.1
    /bin/vi /etc/fstab
    ##################################################
    # Change this line...
    #
    # LABEL=/home /home ext2 defaults 1 2
    #
    # to...
    LABEL=/home /home ext2 defaults,usrquota 1 2
    ##################################################
    /bin/mount -o remount /home
    
    /usr/sbin/repquota -a
    /sbin/quotacheck /home
    /usr/sbin/repquota -a
    /sbin/quotaon /home
    
    /usr/sbin/edquota -u red
    ############################################################
    # Change this line...
    #
    # inodes in use: 4, limits (soft = 0; hard = 0)
    #
    # to...
    inodes in use: 4, limits (soft = 5; hard = 10)
    # 1 block is approximately 1 kilobytes
    ############################################################
    /usr/sbin/repquota -a
    

    Test the quota by logging in as "red". Copy the files to red's home until a (soft) warning is prompted and keep using up the space until a (hard) error message is prompted:
    /bin/cp /usr/share/magic /home/red/magic1
    /bin/cp /usr/share/magic /home/red/magic2
    
    /home: warning, user file quota exceeded
    
    /bin/cp /usr/share/magic /home/red/magic3
    /bin/cp /usr/share/magic /home/red/magic4
    /bin/cp /usr/share/magic /home/red/magic5
    /bin/cp /usr/share/magic /home/red/magic6
    /bin/cp /usr/share/magic /home/red/magic7
    
    /home: write failed, user file limit reached
    /bin/cp: cannot create regular file `./7': Disk quota exceeded
    
    /bin/df -m
    /usr/bin/du -am
    /bin/rm -rf /home/red/magic[1-6]
    
  • Group Quota:
    setgid:
    #
    # Press [Ctrl-Alt-F1] (Virtual Console 1) and login as root
    #
    /usr/sbin/groupadd usergroup
    /bin/mkdir /home/usergroup
    /bin/ls -alrt /home
    /bin/chown root.usergroup /home/usergroup
    /bin/chmod 2775 /home/usergroup
    /bin/ls -alrt /home
    
    #
    # Press [Ctrl-Alt-F2] (Virtual Console 2) and login as red
    #
    /bin/vi /home/usergroup/share.txt
    ################################################
    hello
    # Press [Esc] then type :wq to save and exit
    ################################################
    
    #
    # Press [Ctrl-Alt-F3] (Virtual Console 3) and login as hat
    #
    /bin/vi /home/usergroup/share.txt
    ################################################
    world
    # Press [Esc] then type :wq to save and exit
    ################################################
    
    #
    # Press [Ctrl-Alt-F2] (Virtual Console 2) with red logged
    # in to that terminal.
    #
    /bin/cat /bin/cat /home/usergroup/share.txt
    /bin/ls -alrt
    

    Test Group Quota:
    /bin/vi /etc/fstab
    ##########################################################
    # LABEL=/home /home ext2 defaults,usrquota 1 2
    #
    # to...
    LABEL=/home /home ext2 defaults,usrquota,grpquota 1 2
    ##########################################################
    /bin/mount -o remount /home
    /sbin/quotacheck -g /home
    /sbin/quotaon -g /home
    /usr/sbin/edquota -g usergroup
    ##########################################################
    # Change this line...
    #
    # inodes in use: 2, limits (soft = 0; hard = 0)
    #
    # to...
    inodes in use: 2, limits (soft = 5; hard = 10)
    # 1 block is approximately 1 kilobytes
    ##########################################################
    
    #
    # Login as red and fill up the quota until error message
    # is prompted.
    #
    /bin/cp /usr/share/magic /home/usergroup/magic1
    /bin/cp /usr/share/magic /home/usergroup/magic2
    /bin/cp /usr/share/magic /home/usergroup/magic3
    /bin/cp /usr/share/magic /home/usergroup/magic4
    /bin/cp /usr/share/magic /home/usergroup/magic5
    /home: write failed, user file limit reached
    /bin/cp: cannot create regular file `5': Disk quota exceeded
    

 

  • "16. understand the cron system and be capable of setting up the scheduled jobs under cron":

  • Observe the /etc/crontab file for scheduled system cron jobs.
    /bin/cat /etc/crontab
    
    Then look at the scripts that are executed daily.
    /bin/cat /etc/cron.daily/slocate.cron
    
    Users can also schedule their own cron jobs:
    /usr/bin/man crontab
    
    Installed packages will create its cron jobs under the /etc/cron.d directory.
    /bin/ls -alrt /etc/cron.d
    
  • Schedule a cron job for truncating a file to at most 10 lines every minute of every hour of every day of every month.
    /bin/vi /etc/crontab
    #########################################################
    # Append the following to the /etc/crontab file
    0-59/1 * * * * root /bin/cat /var/log/messages | /usr/bin/tail -n 10 > /var/log/messages
    #########################################################
    /bin/cat /var/log/messages
    
    # Try logging in and out of another virtual console which will invoke
    # the system logger to log PAM security activities. After 2 minutes, type
    # the following and see if the file has been truncated successfully.
    
    /bin/cat /var/log/messages
    

 

  • "17. understand essential kernel concepts, such as monolithic vs. modular kernels, initial ramdisks, etc.":

  • Monolithic kernels has support built-in
    /sbin/sysctl -a
    
  • Modular kernels support are only loaded when needed
    /sbin/lsmod
    
  • Initial Ramdisks: a file containing a RAM disk that contains drivers (modules) available to the kernel at boot time. This file is often needed to boot from a SCSI hard drive; otherwise it is not generally needed for normal system operation.
    /bin/ls -alrt /boot/initrd*.img
    

 

  • "18. be able to install kernel sources and development tools needed in order to rebuild the Linux kernel":

  • Installing Kernel Sources
    binutils >= 2.9.1.0.21 is needed by kgcc-1.1.2-40
    kernel-headers is needed by glibc-devel-2.1.92-14
    kernel-source
    cd /mnt/cdrom/RedHat/RPMS
    
    /bin/rpm -ivh binutils-2.10.0.18-1.i386.rpm kernel-headers-2.4.0-0.26.i386.rpm kernel-source-2.2.16-22.i386.rpm
    
  • Installing Development Tools

    kgcc-1.1.2-40.i386.rpm
    GNU C Compiler for kernel compilation

    gcc-2.96-54.i386.rpm
    GNU Compilers needed for making menuconfig

    cpp-2.96-54.i386.rpm
    GNU C preprocessor

    dev86-0.15.0-5.i386.rpm
    80x86 assembler and linker

    glibc-devel-2.1.92-14.i386.rpm
    header files and libraries for the standard C library

    make-3.79.1-5.i386.rpm
    GNU make utility

    ncurses-5.1-2.i386.rpm
    ncurses library, which provides a terminal-independent application programming interface for character-mode video displays

    ncurses-devel-5.1-2.i386.rpm
    headers files and libraries for development using ncurses (needed only when building the kernel by using the menuconfig utility)
    /bin/rpm -Uvh kgcc-1.1.2-40.i386.rpm \
    cpp-2.96-54.i386.rpm dev86-0.15.0-5.i386.rpm \
    glibc-devel-2.1.92-14.i386.rpm \
    make-3.79.1-5.i386.rpm \
    ncurses-*.rpm
    

    If you get an error prompt
    "package ncurses-5.1-2 is already installed",
    then type in the following instead.
    /bin/rpm -Uvh kgcc-1.1.2-40.i386.rpm \
    cpp-2.96-54.i386.rpm dev86-0.15.0-5.i386.rpm \
    glibc-devel-2.1.92-14.i386.rpm \
    make-3.79.1-5.i386.rpm \
    ncurses-devel-5.1-2.i386.rpm
    
    /bin/umount /dev/cdrom
    

 

  • "19. be able to configure, build, and install the Linux kernel and modules from source and understand LILO configuration and the elements -- first stage, second stage, and installer -- that makes up LILO":

  • Prepare for the kernel configuration file and new kernel Makefile
    /bin/cp /usr/src/linux/arch/i386/defconfig \
    /usr/src/linux/arch/i386/defconfig.1
    /bin/cp /usr/src/linux/configs/kernel-2.2.16-i686.config \
    /usr/src/linux/arch/i386/defconfig
    /bin/cp /usr/src/linux/Makefile /usr/src/linux/Makefile.1
    /bin/vi /usr/src/linux/Makefile
    ########################################################
    # Change the line from...
    # EXTRAVERSION = -22
    # to...
    EXTRAVERSION = -22custom
    ########################################################
    /usr/bin/make mrproper
    /usr/bin/make oldconfig
    /bin/ls -alrt /usr/src/linux/.config
    /bin/date
    
  • Configuring and building the kernel and its modules
    /usr/bin/make menuconfig
    #
    # Switch off the following Kernel support
    #
    # - Telephony Support: Linux telephony
    # - SCSI support: SCSI support
    # - I2O device support: I2O support
    # - Network device support:
    #   Ethernet (10 or 100Mbit)
    #   Ethernet (1000 Mbit) [Disable all]
    # - Appletalk devices
    # - Token Ring driver support
    # - IrDA (infrared) support: IrDA subsystem support
    # - ISDN subsystem: ISDN support
    # - Old CD-ROM drivers (not SCSI, not IDE)
    # - Character devices:
    #   Joystick support
    #   I2C support
    #   Video For Linux
    #   Ftape, the floppy tape device driver
    # - USB support
    # - Sound
    #
    # Save and exit
    #
    
    /usr/bin/make dep;/usr/bin/make clean
    /bin/ps -ef
    /usr/bin/make bzImage 2>errors.txt
    /bin/cat errors.txt | /bin/grep -i "error"
    /usr/bin/make modules 2>errors.txt
    /bin/cat errors.txt | /bin/grep -i "error"
    
  • Installation and Activation
    /bin/cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.2.16-22custom
    /bin/cp ./System.map /boot/System.map-2.2.16-22custom
    /usr/bin/make modules_install
    /sbin/mkinitrd /boot/initrd-2.2.16-22custom.img 2.2.16-22custom
    /bin/cp /etc/lilo.conf /etc/lilo.conf.1
    /bin/vi /etc/lilo.conf
    ####################################################
    boot=/dev/hdb1
    map=/boot/map
    install=/boot/boot.b
    prompt
    timeout=50
    message=/boot/message
    linear
    default=linux_custom
    
    image=/boot/vmlinuz-2.2.16-22
            label=linux
            read-only
            root=/dev/hdb7
    
    image=/boot/vmlinuz-2.2.16-22custom
            label=linux_custom
            read-only
            root=/dev/hdb7
    
    other=/dev/hda1
            label=dos
    ####################################################
    /sbin/lilo -v -v
    
  • Post-Installation Procedures and Issues:

    Procedure
    /sbin/mkbootdisk --device /dev/fd0 2.2.16-22custom
    /bin/mount /dev/fd0 /mnt/floppy
    /bin/cp /boot/map /mnt/floppy/boot/map
    /bin/umount /dev/fd0
    /sbin/reboot
    

    Issue:
    There are some files that maybe needed to be modified after reconfiguration of the kernel. e.g. If the USB support is turned off, the system might give the following error at the bootup sequence:
    Initializing USB controller (usb-uhci): 
    modprobe: Can't locate module usb-uhci
    

    The RedHat Linux 7.0 bootup sequence for Intel PC BIOS: Processor -> BIOS -> ROM -> Device Interface -> Drive -> MBR -> LILO -> Kernel -> Init -> /etc/rc.d/rc.sysinit -> /etc/inittab -> /etc/rc.d/rc -> /etc/rc.d/rc#.d -> forks /sbin/mingetty processes for terminal logins

    The log messages are logged in:
    /var/log/dmesg
    /var/log/boot.log
    /var/log/messages
    /bin/cat /var/log/boot.log
    ######################################
    # Search the error string by typing
    # /Can't locate module usb-uhci
    #
    localhost rc.sysinit: Setting hostname localhost.localdomain:  succeeded
    localhost modprobe: modprobe:
    localhost modprobe: Can't locate module usb-uhci
    localhost rc.sysinit: Initializing USB controller (usb-uhci):  failed
    localhost fsck: /: clean, 42810/134784 files, 97429/269080 blocks
    localhost rc.sysinit: Checking root filesystem succeeded
    #
    # It happened during the rc.sysinit execution.
    ######################################
    
    /bin/cat /etc/rc.d/rc.sysinit
    #######################################
    # Find the string usb by entering /usb
    
    # Initialize USB controller and HID devices
    usb=0
    if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && ! grep -q "usb" /proc/devices 2>/dev/null ; then
        alias=`egrep -s "^alias[[:space:]]+usb-controller[[:space:]]+" /etc/modules.conf | awk '{ print $3 }'`
        if [ -n "$alias" -a "$alias" != "off" ] ; then
          action "Initializing USB controller ($alias): " modprobe $alias
          [ $? -eq 0 ] && usb=1
        fi
    fi
    
    # Notice how the usb-controller is determined by a regular expression
    # search on the /etc/modules.conf file.
    ######################################
    
    /bin/vi /etc/modules.conf
    #######################################
    # Comment it out.
    alias parport_lowlevel parport_pc
    #alias usb-controller usb-uhci
    #######################################
    /sbin/init 6
    
  • Procedures during Kernel Compilation:

    While compiling the kernel, go to other Virtual Consoles by pressing [Ctrl-Alt-F2] [Ctrl-Alt-F3] etc. and work on other things. e.g. Installing other services such as Apache, DNS, etc.

    Dialup Setting: Insert CD 1 into the CD drive and type:
    /bin/mount /dev/cdrom /mnt/cdrom
    # Install the ping utility for testing a PPP connection from
    # the iputils package
    /bin/rpm -ivh /mnt/cdrom/RedHat/RPMS/iputils-20000418-6.i386.rpm
    /bin/rpm -ivh /mnt/cdrom/RedHat/RPMS/ppp-2.3.11-7.i386.rpm
    /bin/umount /dev/cdrom
    /usr/bin/man pppd
    /bin/vi /etc/ppp/ispchat.script
    ################################################
    ABORT "NO DIALTONE"
    "" "ATDT12345678"
    "ogin:" "username"
    "assword:" "password"
    ################################################
    /bin/ln -s /dev/ttyS1 /dev/modem
    /bin/mkdir /etc/ppp/peers
    /bin/vi /etc/ppp/peers/ispconnect.script
    ################################################
    noauth
    defaultroute
    connect '/usr/sbin/chat -v -f /etc/ppp/ispchat.script'
    /dev/modem
    38400
    ################################################
    /usr/sbin/pppd call ${1:-ispconnect.script}
    #
    # After the connection has been made, test the connection
    # by pinging an IP address of a nameserver
    #
    /bin/ping 206.53.103.1
    /usr/bin/killall pppd
    
    ################################################
    # Note: IP Addresses for Primary DNS and Secondary DNS
    # maybe needed for resolving domain name.
    /bin/cp /etc/resolv.conf /etc/resolv.conf.1
    /bin/vi /etc/resolv.conf
    ################################################
    # The following DNS servers help converting domain names
    # to IP addresses.
    nameserver 206.53.103.1
    nameserver 206.53.103.3
    ################################################
    # Test it by connecting to the internet and type:
    /bin/ping hotmail.com
    

    Script for finding which rpm package containing a given file:
    /bin/vi /root/findpack.bash
    ##########################################
    #!/bin/sh
    RPMS_PATH="/mnt/cdrom/RedHat/RPMS"
    until [ ${#} -le 0 ]
    do
      PACKAGES=`/bin/ls -alrt ${RPMS_PATH} | /usr/bin/awk '{print $9}'`
      for PACKAGE in ${PACKAGES}
      do
        /bin/rpm -qlp ${RPMS_PATH}/${PACKAGE} | /bin/grep -q ${1}
        if [ ${?} -eq 0 ]
          then
            /bin/echo ${PACKAGE}
        fi
      done;
      shift;
    done;
    ##########################################
    /bin/chmod 700 /root/findpack.bash
    /root/findpack.bash libutil.so.1 /bin/ping
    

 

  • "24. understand X in general and the XFree86 X server in particular, including its configuration file and the primary tools used for editing that file":

  • Installing a video driver (X server)
    # Search for a Linux driver for the video card from the web.
    # http://www.google.com
    # "savage 3d" linux driver
    # Download it to /tmp/SavageX-0.2.0.tar.gz
    /bin/gunzip /tmp/SavageX-0.2.0.tar.gz
    /bin/tar -xvf /tmp/SavageX-0.2.0.tar
    # dist/
    # dist/XF86_SVGA
    # dist/COPYRIGHT
    # dist/INSTALL
    # dist/README
    
  • Installing X configurating tool
    # (CD 1)
    # Xconfigurator-4.4.3-1.i386.rpm X configurating tool
    # XFree86-4.0.1-1.i386.rpm       Common code for X
    # XFree86-libs-4.0.1-1.i386.rpm  Main XFree86 libraries 
    # XFree86-xfs-4.0.1-1.i386.rpm   X font server
    # gtk+-1.2.8-7.i386.rpm          Required library files
    # Mesa-3.3-5.i386.rpm            Required library files
    #
    /bin/cp /tmp/dist/XF86_SVGA /usr/X11R6/bin/XF86_SVGA
    
    /usr/X11R6/bin/Xconfigurator
    # PCI Probe
    # PCI probing found a:
    # PCI Entry    : S3 Inc.|86c795 [Savage 3D/MV]
    # X Server     : XF86_SVGA
    # XFree4 driver: No match
    
    # Monitor Setup
    # Custom
    
    # Customised Monitor Setup
    # Custom
    
    # Custom Monitor Information (Wrong inputs can damage the monitor)
    # Horizontal Sync: (Refer to the monitor's specification on the web)
    # Vertical Sync:   (Refer to the monitor's specification on the web)
    
    # Select Video Modes
    # Test with the basic video mode first.
    # e.g. 8 bit: "640x480"
    
    # Starting X
    # Click Ok
    
    # Can you see this message?
    # Click Yes.
    
    # Then it will prompt:
    # Xconfigurator can set up your computer to
    # automatically start X upon booting. Would
    # you like X to start when you reboot?
    # Click No.
    
    # Then Click Ok.
    
    /usr/bin/man XF86Config
    /bin/cat /etc/X11/XF86Config
    /usr/X11R6/bin/startx
    #
    # Press [Ctrl-Alt-F1] to text Virtual Console 1.
    # Press [Ctrl-Alt-F7] to go back to X terminal 1.
    # Then press [Ctrl-Alt-Backspace] to terminate X terminal 1.
    #
    

 

  • "25. be familiar with the window manager and desktop environment choices available under Red Hat Linux, and know how to select these choices":

Installing Sawfish (Window Manager) and GNOME (Desktop Environment)

  • Installing Default Windows Manager and base tools
    # (CD 1)
    # Windows Manager
    # xinitrc-2.9.10-1.noarch.rpm  Script to start Windows Manager
    # switchdesk-3.6-1.i386.rpm    Required tool to switch desktop environment
    # XFree86-twm-4.0.1-1.i386.rpm (Default Windows Manager)
    
    /usr/X11R6/bin/startx
    /bin/cat /etc/X11/xinit/xinitrc
    
  • Installing Sawfish Windows Manager
    # (CD 1)
    # Sawfish Windows Manager
    # sawfish-0.30.3-10.i386.rpm
    # librep-0.12.1-3.i386.rpm
    # rep-gtk-0.13-3.i386.rpm
    # rep-gtk-gnome-0.13-3.i386.rpm
    # gnome-libs-1.2.4-11.i386.rpm
    # ORBit-0.5.3-2.i386.rpm
    # imlib-1.9.8.1-2.i386.rpm
    # esound-0.2.19-3.i386.rpm
    # libglade-0.13-4.i386.rpm
    # libpng-1.0.8-1.i386.rpm
    # libjpeg-6b-13.i386.rpm
    # libtiff-3.5.5-7.i386.rpm
    # libungif-4.1.0-7.i386.rpm
    # netpbm-progs-9.5-5.i386.rpm
    # netpbm-9.5-5.i386.rpm
    # libxml-1.8.9-5.i386.rpm         Required library files
    # audiofile-0.1.9-7.i386.rpm      Required library files
    # control-center-1.2.1-5.i386.rpm Required library files
    # gdk-pixbuf-0.8.0-5.i386.rpm     Required library files
    # xscreensaver-3.25-4.i386.rpm
    # xloadimage-4.1-16.i386.rpm
    # fortune-mod-1.0-13.i386.rpm
    
  • Installing GNOME Desktop Environment
    # (CD 1)
    # GNOME Installation
    # gnome-core-1.2.1-33.i386.rpm
    # pygnome-libglade-0.6.6-4.i386.rpm
    # pygtk-libglade-0.6.6-4.i386.rpm
    
  • Selecting Desktop Environment choices
    /usr/X11R6/bin/startx
    /bin/cat /root/.gnome/default.wm
    
    /usr/bin/switchdesk twm
    /bin/cat /root/.Xclients-default
    /bin/cat /root/.Xclients
    /usr/X11R6/bin/startx
    
    /usr/bin/switchdesk GNOME
    /bin/cat /root/.Xclients-default
    /bin/cat /root/.Xclients
    /usr/X11R6/bin/startx
    
  • Installing Font
    # (CD 1)
    # XFree86-75dpi-fonts-4.0.1-1.i386.rpm (Standard Western European fonts for X)
    # chkfontpath-1.7.2-5.i386.rpm
    #
    # chkfontpath   is needed by XFree86-75dpi-fonts-4.0.1-1)
    
    /usr/X11R6/bin/startx
    
  • Installing X Application (Netscape Communicator)
    # (CD 1)
    # netscape-common-4.75-2.i386.rpm
    # netscape-communicator-4.75-2.i386.rpm
    # compat-libstdc++-6.2-2.9.0.9.i386.rpm   Required library files
    
    /usr/X11R6/bin/startx
    # Programs -> Internet -> Netscape Communicator
    

 

  • "26. understand and be capable of implementing and using the remote capabilities of X, including remote logins and remote clients.":

X remote

  • Multiple X clients
    /usr/X11R6/bin/startx -- :1
    /usr/X11R6/bin/startx -- :2
    # Press [Ctrl-Alt-F7] or [Ctrl-Alt-F8] to switch between the 2 X terminals
    # Press [Ctrl-Alt-Backspace] to terminate X terminal
    
  • Installing Display Manager
    # (CD 1)
    # gdm-2.0beta2-37.i386.rpm
    
    /bin/cat /etc/sysconfig/desktop
    /sbin/runlevel
    /sbin/init 5
    #
    # Login as root
    #
    # Programs -> System -> GNOME terminal
    #
    /usr/X11R6/bin/X -query 192.168.1.10 :2 &
    #
    # Press [Ctrl-Alt-Backspace] to terminate X terminal.
    # Press [Ctrl-Alt-F1] to go to text Virtual Console 1.
    /sbin/init 3
    /usr/bin/killall gdm
    #
    
    /bin/cp /etc/X11/gdm/gdm.conf /etc/X11/gdm/gdm.conf.1
    /bin/vi /etc/X11/gdm/gdm.conf
    ##########################################
    # Search for "[xdmcp]" then modify the following from...
    
    [xdmcp]
    Enable=0
    
    # to...
    
    [xdmcp]
    #Enable=0
    Enable=1
    
    #
    ##########################################
    
    #
    # Login as root
    #
    # Programs -> System -> GNOME terminal
    #
    /usr/X11R6/bin/X -query 192.168.1.10 :2 &
    #
    # Press [Ctrl-Alt-F7] then [Ctrl-Alt-F8]
    #
    export DISPLAY=192.168.1.10:0.0
    /usr/X11R6/bin/xhost +
    /usr/X11R6/bin/xterm -display 192.168.1.10:0.0 &
    #
    
  • Customize User X Startup
    /bin/vi /root/.xsession
    ######################################
    # X startup local to root
    
    #!/bin/sh
    exec /usr/X11R6/bin/xterm 
    
    #
    ######################################
    /bin/chmod 755 /root/.xsession
    
    /sbin/init 5
    #
    # Login as root
    #
    
  • Customize System X Startup
    #
    # (CD 1)
    # XFree86-Xnest-4.0.1-1.i386.rpm
    #
    
    # X startups globally
    /bin/vi /etc/X11/xinit/xinitrc.d/xterm
    ########################################
    #
    
    #!/bin/sh
    /usr/X11R6/bin/xterm &
    
    #
    ########################################
    /bin/chmod 755 /etc/X11/xinit/xinitrc.d/xterm
    
    /bin/cat /etc/inittab
    /sbin/init 5
    #
    # Login as red
    #
    # Programs -> System -> GNOME terminal
    /usr/X11R6/bin/Xnest -query 192.168.1.10 :2 &
    #
    

 

  • "20. understand. and be capable of. implementing the following network services: Apache, Samba, NFS, basic sendmail, POP3/IMAP4 email, DNS, and ftp":

  • BIND - DNS server: Insert CD 1
    /bin/mount /dev/cdrom /mnt/cdrom
    
    /bin/rpm -qlp /mnt/cdrom/RedHat/RPMS/bind-8.2.2_P5-25.i386.rpm
    ###########################
    /etc/logrotate.d/named
    /etc/rc.d/init.d/named
    /usr/sbin/dnskeygen
    /usr/sbin/irpd
    /usr/sbin/named
    /usr/sbin/named-bootconf
    /usr/sbin/named-xfer
    /usr/sbin/ndc
    /var/named
    ###########################
    /bin/rpm -qlp /mnt/cdrom/RedHat/RPMS/bind-utils-8.2.2_P5-25.i386.rpm
    ###########################
    /usr/bin/addr
    /usr/bin/dig
    /usr/bin/dnsquery
    /usr/bin/host
    /usr/bin/mkservdb
    /usr/bin/nslookup
    /usr/bin/nsupdate
    ###########################
    /bin/rpm -ivh /mnt/cdrom/RedHat/RPMS/bind-8.2.2_P5-25.i386.rpm /mnt/cdrom/RedHat/RPMS/bind-utils-8.2.2_P5-25.i386.rpm
    
    /bin/umount /dev/cdrom
    
    /usr/bin/man named.conf
    ###################################
    # Enter: /EXAMPLE
    # Press G
    # Press N
    # Examine the format
    ###################################
    
    /bin/vi /etc/named.conf
    #################################################
    options
    {
      directory "/var/named";
    };
    
    zone "example.com" in
    {
      type master;
      file "example.forward";
    };
    
    zone "1.168.198.in-addr.arpa" in
    {
      type master;
      file "example.reverse";
    };
    #################################################
    
    /usr/bin/man named
    /bin/vi /var/named/example.forward
    #################################################
    @ IN SOA example.com. root.example.com.
    (
    1;
    10800;
    3600;
    3600000;
    86400;
    )
    @ IN NS example.com.
    example.com. IN A     192.168.1.10
    station      IN CNAME example.com.
    www          IN CNAME example.com.
    #################################################
    
    /bin/vi /var/named/example.reverse
    #################################################
    @ IN SOA example.com. root.example.com.
    (
    1;
    10800;
    3600;
    3600000;
    86400;
    )
    @  IN NS  example.com.
    10 IN PTR example.com.
    10 IN PTR station.example.com.
    10 IN PTR www.example.com.
    #################################################
    
    /sbin/service named restart
    /sbin/service named reload
    /bin/ping example.com
    /bin/ping station.example.com
    /bin/ping www.example.com
    /bin/ping 192.168.1.10
    /bin/cat /var/log/messages
    /bin/date
    
    /sbin/chkconfig --list named
    /sbin/chkconfig --level 345 named on
    
    /sbin/init 6
    
  • FTP
    Insert CD 1
    # wu-ftpd: FTP server
    # ftp:     FTP client
    # xinetd is needed by wu-ftpd-2.6.1-6
    # /usr/bin/python is needed by xinetd-2.1.8.9pre9-6
    
    /bin/mount /dev/cdrom /mnt/cdrom
    cd /mnt/cdrom/RedHat/RPMS
    /bin/rpm -ivh python-1.5.2-27.i386.rpm xinetd-2.1.8.9pre9-6.i386.rpm
    /bin/rpm -ivh wu-ftpd-2.6.1-6.i386.rpm ftp-0.17-6.i386.rpm
    cd
    /bin/umount /dev/cdrom
    
    /bin/cp /etc/ftpusers /etc/ftpusers
    /bin/cp /etc/ftpaccess /etc/ftpaccess
    
    /bin/vi /etc/ftpusers
    ########################################
    # Comment out the root user so root can access the ftp server
    #
    
    #root
    
    #
    ########################################
    
    /sbin/service xinetd restart
    /sbin/service xinetd reload
    
    /usr/bin/ftp example.com
    # Login as root
    # Type bye to exit
    
    /usr/bin/man ftpaccess
    /bin/vi /etc/ftpaccess
    ##############################################
    # Append the following to the /etc/ftpaccess file.
    upload /var/ftp /incoming yes root daemon 0400 nodirs
    ##############################################
    /bin/mkdir -p /var/ftp/incoming
    /bin/chmod 773 /var/ftp/incoming
    /bin/chown root.daemon /var/ftp/incoming
    /sbin/service xinetd restart
    
    cd /home/usergroup
    /usr/bin/ftp -i example.com
    # Login as anonymous
    # Press Enter on password
    ####################################################
    binary
    dir
    mput share.txt
    cd incoming
    dir
    mput share.txt
    dir
    mget share.txt
    bye
    ####################################################
    /bin/cat /var/ftp/incoming/share.txt
    
  • APACHE
    Insert CD 1
    # apache    HTTP server
    # lynx      HTTP client
    # indexhtml is needed by lynx-2.8.4-3
    
    /bin/mount /dev/cdrom /mnt/cdrom
    /bin/rpm -ivh /mnt/cdrom/RedHat/RPMS/apache-1.3.12-25.i386.rpm
    /bin/rpm -ivh /mnt/cdrom/RedHat/RPMS/indexhtml-7.0-2.noarch.rpm \
    /mnt/cdrom/RedHat/RPMS/lynx-2.8.4-3.i386.rpm
    /bin/umount /dev/cdrom
    
    /bin/cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.1
    /bin/vi /etc/httpd/conf/httpd.conf
    ###################################################
    # Go to the NameVirtualHost line by entering
    # /NameVirtualHost
    # Underneath its comment add the following:
    NameVirtualHost 192.168.1.10
    # Add the VirtualHosts underneath its comments
    # To go to that line (1021) press Esc and type:
    # 1021g
    
      ServerName www.example.com
      DocumentRoot /var/www/html
    
    
      ServerName station.example.com
      DocumentRoot /var/www/html/station
    
    ###################################################
    /bin/mkdir -p /var/www/html/station
    /bin/vi /var/www/html/station/index.html
    ###################################################
    Hello World
    # To save and exit press Esc then type enter:
    # :wq
    ###################################################
    /etc/rc.d/init.d/httpd restart
    /etc/rc.d/init.d/httpd reload
    /usr/bin/lynx http://www.example.com/index.html
    /usr/bin/lynx http://station.example.com/index.html
    /usr/bin/lynx http://example.com/index.html
    
  • NFS
    Insert CD 1
    # nfs
    # portmap >= 4.0 is needed by nfs-utils-0.1.9.1-7
    /bin/mount /dev/cdrom /mnt/cdrom
    /bin/rpm -ivh /mnt/cdrom/RedHat/RPMS/nfs-utils-0.1.9.1-7.i386.rpm /mnt/cdrom/RedHat/RPMS/portmap-4.0-29.i386.rpm
    /bin/umount /dev/cdrom
    
    /usr/bin/man exports
    /bin/cp /etc/exports /etc/exports.1
    /bin/vi /etc/exports
    ############################################
    /var/ftp/incoming example.com(ro,no_root_squash)
    ############################################
    /usr/sbin/exportfs -v -a -r
    /sbin/service portmap start
    /sbin/service nfslock start
    /sbin/service nfs start
    /sbin/chkconfig --list nfs
    /sbin/chkconfig --level 345 nfs on
    
    /bin/mount -t nfs example.com:/var/ftp/incoming /mnt/cdrom
    /bin/ls -alrt /mnt/cdrom
    /bin/umount /mnt/cdrom
    
  • SAMBA
    #
    # Insert CD 1
    #
    # samba
    # samba-client
    # samba-common
    #
    # /bin/csh is needed by samba-2.0.7-21ssl
    #
    # Use the "findpack.bash" script to find which package
    # on the CD contains /bin/csh
    #
    # tcsh-6.09-6.i386.rpm
    #
    
    /bin/mount /dev/cdrom /mnt/cdrom
    findpack.bash /bin/csh
    cd /mnt/cdrom/RedHat/RPMS
    /bin/rpm -ivh tcsh-6.09-6.i386.rpm samba-*.rpm
    cd
    /bin/umount /dev/cdrom
    
    /bin/cp /etc/samba/smb.conf /etc/samba/smb.conf.1
    /bin/vi /etc/samba/smb.conf
    ##################################################
    #
    # Add the following to:
    #;   hosts allow = 192.168.1. 192.168.2. 127.
    hosts allow = 192.168.1. 192.168.2. 127.
    #
    # Add the following to:
    #;  encrypt passwords = yes
    #;  smb passwd file = /etc/samba/smbpasswd
    encrypt passwords = yes
    smb passwd file = /etc/samba/smbpasswd
    #
    # Add the following to:
    #;[myshare]
    #;   comment = Mary's and Fred's stuff
    #;   path = /usr/somewhere/shared
    #;   valid users = mary fred
    #;   public = no
    #;   writable = yes
    #;   printable = no
    #;   create mask = 0765
    [usergroup]
       comment = Red's and Hat's stuff
       path = /home/usergroup
       valid users = red hat
       public = no
       writable = no
    #
    ##################################################
    
    /usr/bin/testparm
    /sbin/chkconfig --list smb
    /sbin/chkconfig --level 345 smb on
    /sbin/service smb start
    
    /usr/bin/smbclient -L example.com -N
    /bin/touch /etc/samba/smbpasswd
    /bin/cp /etc/samba/smbpasswd /etc/samba/smbpasswd.1
    /bin/cp /etc/samba/smbusers /etc/samba/smbusers.1
    /usr/bin/smbpasswd -a red
    /usr/bin/smbpasswd -a hat
    
    /usr/bin/smbclient //example.com/usergroup -U red
    # or
    /usr/bin/smbmount //example.com/usergroup /mnt/cdrom -o username=red
    /usr/bin/smbumount /mnt/cdrom
    
  • SENDMAIL and POP3/IMAP4
    # (SMTP for sending mail)
    # sendmail-8.11.0-8             (CD 1 - Base)
    # sendmail-cf-8.11.0-8.i386.rpm (CD 2 - Configuration)
    #
    # m4-1.4.1-3.i386.rpm           (CD 1 - For sendmail.mc script file)
    #
    # (POP3/IMAP4 for fetching mail)
    # imap-4.7c2-12.i386.rpm        (CD 2 - POP and IMAP mail client)
    #
    # stunnel is needed by imap-4.7c2-12 (CD 1)
    
    /bin/cp /etc/xinetd.d/imap /etc/xinetd.d/imap.1
    /bin/vi /etc/xinetd.d/imap
    ###################################################
    # Replace with the following
            #disable                        = yes
    disable = no
    
    ###################################################
    
    /bin/cp /etc/xinetd.d/ipop3 /etc/xinetd.d/ipop3.1
    ###################################################
    # Replace with the following
            #disable                        = yes
    disable = no
    
    ###################################################
    
    /sbin/service xinetd restart
    
    /bin/cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.1
    /bin/cp /etc/sendmail.cf /etc/sendmail.cf.1
    /bin/vi /etc/mail/sendmail.mc
    ###################################################
    # Add the following line
    DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0,Name=MTA')
    dnl 0.0.0.0 means for all ip
    #
    ###################################################
    /usr/bin/m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
    
    /bin/cp /etc/mail/local-host-names /etc/mail/local-host-names.1
    /bin/vi /etc/mail/local-host-names
    ############################################
    # Add the following entry...
    example.com
    #
    ############################################
    
    /sbin/service sendmail restart
    
    ###################################################
    # Test with mail client
    /usr/X11R6/bin/startx
    
    # Test Mail Transfer Agent (SMTP)
    #
    # Programs -> Internet -> Netscape Communicator:
    #
    # Edit -> Preferences -> Mail & Newgroups ->
    # Mail Servers -> Outgoing Mail Server ->
    # Outgoing mail (SMTP) server: example.com
    # Outgoing mail server user name: mailuser
    #
    # Edit -> Preferences -> Identity ->
    # Your name: mailuser
    # Email address: [email protected]
    #
    # Communicator -> Messenger -> File -> New -> New Message ->
    # To: [email protected]
    # Subject: Test
    # Hello World
    
    # Test Mail User Agent (POP)
    #
    # Edit -> Preferences -> Mail & Newgroups ->
    # Mail Servers -> Incoming Mail Servers -> (Select pop) ->
    # Edit -> General ->
    # Server Name: example.com
    # Server Type: POP
    # User Name: mailuser
    #
    # Communicator -> Messenger -> File -> Get New Messages ->
    # Password for mail user [email protected]:
    # (mailuser password)
    #
    
    # /etc/sendmail.cw
    # which specifies the hosts on behalf of which the
    # server will accept mail
    #
    # Needs the following entry in /etc/mail/sendmail.mc
    # FEATURE(`use_cw_file')dnl
    #
    

 

  • "21. be sufficiently familiar with the function, configuration, and logging of those services as to be capable of basic troubleshooting":

  • Log kernel messages for debugs:
    /usr/bin/man syslog.conf
    /sbin/service syslog status
    /bin/cp /etc/syslog.conf /etc/syslog.conf.1
    /bin/vi /etc/syslog.conf
    ####################################################
    #
    # Append to the following:
    #
    
    # Log all kernel messages to the console.
    # Logging much else clutters up the screen.
    #kern.*                                                 /dev/console
    kern.debug /var/log/messages
    
    #
    # For the above entry:
    #
    # facility = kern (Messages from kernel)
    # priority = debug (Log debug messges and messages of higher priority)
    # action   = /var/log/messages (Log messages to the specified file)
    #
    # The klogd generally passes received messages to syslogd,
    # which logs them in the usual manner.
    #
    ####################################################
    /sbin/service syslog restart
    /bin/cat /var/log/messages
    
  • Troubleshooting:
    ################################################
    # Troubleshooting Procedures:
    #
    # - Modified configurations
    #
    # 1. Backup old configuration files
    # e.g. /bin/cp /etc/exports /etc/exports.1
    #
    # 2. Look up the man page for the format of the configuration file.
    # e.g. /usr/bin/man exports
    #
    # 3. Edit the configuration file
    # e.g. /bin/vi /etc/exports
    #
    # 4. Activate the modified configuration file
    # e.g. /usr/sbin/exportfs -v -a -r
    #
    # 5. Turn on services that relates to the modified configuration
    # e.g. /sbin/chkconfig --level 345 nfs on
    #
    # 6. A service may require other services to run.
    # e.g. NFS needs portmap
    #
    # 7. Check log for bugs
    # e.g /bin/cat /var/log/messages | /usr/bin/less
    #
    # - CD-ROM cannot be ejected
    #
    # Error Message: "umount: /mnt/cdrom: device is busy"
    #
    # Common causes:
    # 1. Several Virtual Console logged in,
    #    there maybe terminal processes still accessing the CD.
    #    e.g. Virtual Console 2 is under the current path
    #    of /mnt/cdrom/RedHat/RPMS where the CDROM device is
    #    mounted at /mnt/cdrom
    #
    # Possible Solution:
    # [Ctrl-Alt-F2]
    # cd /
    # /bin/umount /dev/cdrom
    #
    # Error Message: "Device or resource busy"
    #
    # Common causes:
    # 1. At least a process is still using the
    #    /dev/cdrom device file.
    #
    # Possible Solution:
    # /sbin/fuser -m /dev/cdrom
    # /bin/ps -ef
    # /bin/kill -9 # (process id from the /sbin/fuser command)
    #
    # Tips:
    # After installing new packages, it is best to update the filelist by:
    # /usr/bin/updatedb &
    #
    

 

  • "22. be familiar with, and capable of, implementing access restrictions for the above services":

  • Disabling a standalone service:
    /sbin/chkconfig --level 345 nfs off
    
  • Disabling an xinetd service:
    /bin/cp /etc/xinetd.d/ipop3 /etc/xinetd.d/ipop3.1
    /bin/vi /etc/xinetd.d/ipop3
    ###################################################
    #
            disable                        = yes
    #
    ###################################################
    
    /sbin/service xinetd restart
    

 

  • "23. be familiar with other network services supported under Red Hat Linux: squid, innd NNTP server, xntpd, etc.":

  • squid
    # (CD 2)
    # squid-2.3.STABLE4-1.i386.rpm
    
    ##################################################
    # Configure Proxy Server
    /bin/cp /etc/squid/squid.conf /etc/squid/squid.conf.1
    /bin/vi /etc/squid/squid.conf
    ##################################################
    # Add the following...
    #http_access allow manager localhost
    http_access allow all
    #
    ##################################################
    /sbin/service squid start
    
    ##################################################
    # Testing Proxy Server
    #
    # Get the squid service port number:
    /bin/cat /etc/services | /bin/grep "squid" | /usr/bin/awk '{print $2}' | \
    /usr/bin/awk 'gsub("/tcp", "")'
    
    # Netscape -> Edit -> Preferences -> Advanced -> Proxies ->
    # Manual Proxy Configuration -> View ->
    # Http Proxy: example.com
    # Port: 3128
    
    /sbin/service httpd restart
    
    # Netscape -> Location -> http://www.example.com
    
  • ntpd
    # (CD 2)
    # ntp - Synchronizes system time using the
    #       Network Time Protocol (NTP).
    
    /usr/sbin/ntpdate -v -d ntpa2.kph.uni-mainz.de
    #
    # ntpa2.kph.uni-mainz.de is a remote host running a time accurate ntpd
    #
    /bin/cat /etc/ntp.conf | /bin/grep "stratum"
    /sbin/service ntpd start
    
  • innd
    # cleanfeed is needed by inn-2.2.3-3
    #
    # cleanfeed - A spam filter for Usenet news servers.                (CD 1)
    # inn       - The InterNetNews (INN) system, an Usenet news server. (CD 1)
    #
    /sbin/service innd start
    
    /bin/mv /etc/news/nnrp.access /etc/news/nnrp.access.1
    /bin/chmod 740 /etc/news/nnrp.access
    /bin/vi /etc/news/nnrp.access
    ################################################
    # Add the following...
    example.com:Read Post:foo:foo:*
    #
    ################################################
    
    /usr/X11R6/bin/startx
    
    # Netscape -> Edit -> Preferences -> Mail & Newsgroups
    # -> Newsgroup Servers -> Add ->
    # Server: example.com
    # Port: 119
    
    # Netscape -> Communicator -> Messenger -> example.com
    # Netscape Mail & Newsgroups -> File -> Subscribe ->
    # Please enter a username for news server access: foo
    # Please enter a password for news server access: foo
    
  • dhcpd
    # (CD 2)
    # dhcp-2.0-12.i386.rpm
    #
    /sbin/ifconfig -a
    
    # Create dhcp IP lease database
    /bin/touch /var/lib/dhcp/dhcpd.leases
    # Prepare dhcp daemon configuration file
    /bin/touch /etc/dhcpd.conf
    
    /usr/bin/man dhcpd.conf
    /sbin/pump --usage
    /bin/cat /sbin/ifup | /bin/grep "pump"
    

 

  • "27. understand the role of xinetd and be capable of implementing tcp_wrappers security measures":

  • Installation
    # (CD 1)
    # tcp_wrappers-7.6-15.i386.rpm
    #
    # The order of the entries of restrictions/privileges
    # are important. By default, all hosts are allowed to
    # access all services.
    #
    # i.e.
    # /etc/hosts.allow: -> yes -> grant access
    # || not mentioned
    # \/
    # /etc/hosts.deny: -> yes -> reject request
    # || not mentioned
    # \/
    # grant access
    #
    # Hostname and domain names are allowed.
    # Note that portmap requires IP addresses only.
    
    /bin/cp /etc/hosts.allow /etc/hosts.allow.1
    /bin/cp /etc/hosts.deny /etc/hosts.deny.1
    /usr/bin/man 5 hosts_access
    
  • Testing tcp_wrappers
    ##########################################################
    # Task 1: Allow FTP services only for host 192.168.1.10
    # and localhost.
    #
    /bin/vi /etc/hosts.allow
    ############################################
    # Add the following...
    in.ftpd: localhost.localdomain, 192.168.1.10
    #
    ############################################
    /bin/vi /etc/hosts.deny
    ############################################
    # Add the following, otherwise it will accept
    # any other host request for this service by
    # default. So it needs to be caught here.
    in.ftpd: ALL
    #
    ############################################
    /sbin/service xinetd reload
    
    ############################################
    # Test
    /usr/bin/ftp -i example.com
    # Login as anonymous and leave the password blank
    
    ###################################################
    # Task 2: Allow all services to any hosts except
    # the ones from example.com
    /bin/cat /dev/null
    !! > /etc/hosts.allow
    ^allow^deny
    /bin/vi !$
    #############################################
    # /etc/hosts.deny
    ALL: 192.168.1.0/255.255.255.0
    #
    #############################################
    /sbin/service xinetd reload
    
    #############################################
    # Test
    /usr/bin/ftp -i example.com
    # Login as anonymous and leave the password blank
    
  • Testing xinetd
    #############################################
    # xinetd security implementation
    #
    /usr/bin/man xinetd.conf
    
    /bin/vi /etc/xinetd.d/wu-ftpd
    #############################################
    # For Task 1:
    only_from: 192.168.1.10 127.0.0.1
    # or for Task 2:
    no_access: 192.168.1.0
    #
    #############################################
    

 

  • "28. understand basic NIS concepts and the components associated with NIS":

  • # (CD 1)
    # ypserv-1.3.11-9.i386.rpm       NIS server
    # ypbind-1.6-11.i386.rpm         NIS client
    # yp-tools-2.4-4.i386.rpm        NIS tools and utilities
    #
    # yp-tools is needed by ypbind-1.6-11
    
    /bin/cp /etc/sysconfig/network /etc/sysconfig/network.1
    /bin/cp /etc/yp.conf /etc/yp.conf.1
    
    /sbin/chkconfig --level 2345 ypserv on
    /sbin/chkconfig --level 2345 yppasswdd on
    /sbin/chkconfig --level 2345 ypbind on
    
    /sbin/linuxconf
    # Config -> Networking -> Client tasks ->
    # Network Information System (NIS) ->
    # NIS domain: example.com
    # NIS server: 127.0.0.1
    # -> Accept -> Act/Changes
    # Quit -> Activate the changes
    /bin/cat /etc/sysconfig/network
    #################################
    # NETWORKING=yes
    # HOSTNAME=localhost.localdomain
    # NISDOMAIN="example.com"
    #################################
    /bin/cat /etc/yp.conf
    ####################################################
    #
    ypserver 127.0.0.1
    #
    ####################################################
    
    cd /var/yp
    /usr/bin/make
    /sbin/service ypserv restart
    /sbin/service yppasswdd restart
    /sbin/service ypbind restart
    
    /usr/bin/file /var/yp/example.com/passwd.byname
    /usr/bin/yppasswd -p red
    #
    # Changing NIS account information for red on localhost.localdomain.
    # Please enter root password: red
    # Changing NIS password for red on localhost.localdomain.
    # Please enter new password: nisuser
    # Please retype new password: nisuser
    #
    # The NIS password has been changed on localhost.localdomain.
    #
    # The following files may have been changed:
    # /etc/shadow
    # /var/yp/example.com/passwd.byuid
    # /var/yp/example.com/passwd.byname
    
    /usr/sbin/authconfig
    #
    # User Information Configuration
    # [*] Use NIS
    # Domain: example.com
    # Server: 127.0.0.1
    #
    # Next -> OK
    #
    # The following files may have been changed:
    # /etc/yp.conf
    # /etc/nsswitch.conf
    # /etc/ldap.conf
    # /etc/krb5.conf
    # /etc/gshadow
    # /etc/group
    #
    
    /sbin/init 6
    #
    # Login as root on Virtual Console 1
    # Login as red on Virtual Console 2
    # Virtual Console 1:
    # /bin/cat /var/log/messages
    #
    
    # /etc/nsswitch.conf  (NIS configuration)
    # /var/yp/example.com (Domain information stored by the NIS server)
    # /var/yp/binding     (Cached information stored by the NIS clients)
    

 

  • "29. understand the purpose of the PAM subsystem, and be capable of implementing basic PAM configuration changes":

  • PAM implementation
    /bin/rpm -qif /etc/pam.d
    /usr/bin/man 8 pam_console
    /usr/bin/slocate pam_console
    /bin/ls -alrt /lib/security
    
    /bin/ls -alrt /etc/pam.d
    #
    # Use a file to restrict a list of users
    # For wu-ftpd, the file /etc/ftpusers is used.
    #
    /bin/cat /etc/pam.d/ftp
    ##############################################
    #
    auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
    #
    # module_type  = auth
    # control_flag = required
    # module_path  = /lib/security/pam_listfile.so
    # arguments: item=user sense=deny file=/etc/ftpusers onerr=succeed
    #
    ##############################################
    
    # Implement for /etc/pam.d/login
    /bin/cp /etc/pam.d/login /etc/pam.d/login.1
    /bin/vi /etc/pam.d/login
    ##############################################
    # Add the following line...
    auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
    #
    ##############################################
    
    ##############################################
    #
    # Go to Virtual Console 2 while still logged in as root in Virtual
    # Console 1. Test by logging in with one of the listed users
    # in /etc/ftpusers
    #
    # After the testing, go back to Virtual Console 1 and type:
    /bin/cp /etc/pam.d/login.1 /etc/pam.d/login
    
  • PAM modules and its purposes
    # /lib/security/pam_access.so
    # Restricts hosts from services like TCP_WRAPPERS
    #
    # /lib/security/pam_console.so
    # Grants special privileges for console users, e.g. accessing
    # devices like floppy drive and controlling shutdown/reboot.
    #
    # /lib/security/pam_listfile.so
    # Restricts access by consulting a specified file
    #
    # /lib/security/pam_nologin.so
    # Prevents users other than root from logging in while the /etc/nologin
    # file exists.
    #
    # /lib/security/pam_securetty.so
    # Prohibits logging in as root from a tty device other than
    # those listed in /etc/securetty
    # Note: Serial Console installation may require a laptop for
    # output, a serial cable for the connection between the Linux System
    # and the laptop and an entry to the /etc/securetty where
    # the port is connected.
    #
    # /lib/security/pam_time.so
    # Restricts the times at which a user can access a service by
    # day or by time of day.
    #
    # /lib/security/pam_stack.so
    # Calls another service pam restriction file. Referencing
    # another service pam restriction file can be convenient
    # if a service restriction is used often e.g. /etc/pam.d/system-auth
    # For more information, type:
    # /usr/bin/man 8 pam_stack
    #
    

 

  • "30. possess basic familiarity with configuration issues -- routing options, IP forwarding, kernel configuration -- associated with using Red Hat Linux as a router":

  • Routing Options
    /sbin/linuxconf
    #
    # Disabling Dynamic Routing
    #
    # Config -> Networking -> Client tasks -> Routing and gateways
    # -> Configure the routed daemon
    #
    # [X] Does not export any routes (Silent)
    #
    # Accept
    #
    #----------------------------------------------------------
    #
    # Configuring Static Routing
    # 
    # Config -> Networking -> Client tasks -> Routing and gateways
    # -> Set other routes to networks
    #
    # Add ->
    # Gateway: 127.0.0.1
    # Destination: 192.168.1.0
    # Netmask (opt): 255.255.255.0
    #
    # Quit -> Activate the changes
    #
    /bin/cat /etc/sysconfig/static-routes
    # any net 192.168.1.0 netmask 255.255.255.0 gw 127.0.0.1
    /sbin/route
    /sbin/route add -net 192.10.1.0 netmask 255.255.255.0 dev lo:0
    
  • IP Forwarding
    /bin/vi /etc/sysconfig/sysctl.conf
    ##############################################
    # Add the following...
    
    #net.ipv4.ip_forward = 0
    net.ipv4.ip_forward = 1
    
    #
    ##############################################
    /sbin/sysctl -w net.ipv4.ip_forward=1
    /bin/cat /proc/sys/net/ipv4/ip_forward
    
  • Kernel Configuration for Router
    ##############################################
    # Choose the following for Kernel Reconfiguration
    # specifically for router
    Networking options
    [*] IP: advanced router
    [*] IP: optimize as router not host
    #
    ##############################################
    

 

  • "31. be capable of using ipchains to implement basic firewalling policies and be familiar with the User Private Group scheme in Red Hat Linux":

Security

  • Firewall
    # (CD 1)
    # ipchains-1.3.9-17.i386.rpm
    
    #
    # Implementing basic firewall policies
    #
    # Note: "/sbin/ipchains -A input -j DENY"
    # will deny all incoming packets disregarding
    # any other rules
    #
    # Task:
    # 1. Accept packets from localhost
    # 2. Reject packets to 192.168.1.0 network addresses
    #    requesting for a port 80 (HTTP) service of protocol TCP.
    #
    
    /sbin/ipchains -L
    /sbin/ipchains -A input -s 127.0.0.1 -j ACCEPT
    /sbin/ipchains -A output -d 192.168.1.0/24 80 -p TCP -j REJECT
    /sbin/ipchains -L
    #
    # Test by accessing the web server from example.com
    # Remember to disable the proxy from /etc/lynx.cfg
    /usr/bin/lynx http://www.example.com
    
    # Now delete rule number 2 of chain input that rejects
    # outgoing packets requesting http service from example.com
    # and test again.
    #
    /sbin/ipchains -D input 2
    /usr/bin/lynx http://www.example.com
    
    #
    # It is generally good practice to set the default policy to
    # DENY when a packet does not match a rule:
    # /sbin/ipchains -P input DENY
    #
    
    # To implement IP masquerading with /sbin/ipchains:
    /sbin/ipchains -A forward -i lo:0 -s 127.0.0.1 -j MASQ
    # So if the originating packet comes from 127.0.0.1
    # the firewall will translate it to its own address
    # 192.168.1.10 through the interface lo:0
    
    /sbin/ipchains-save > /etc/sysconfig/ipchains
    # /sbin/ipchains-restore will check /etc/sysconfig/ipchains
    # at startup
    /bin/grep -r "ipchains-restore" /etc/*
    /bin/cat /etc/rc.d/init.d/ipchains
    
    #
    # Note: The order of implementing rules using "/sbin/iptables"
    # matters. e.g. If "/sbin/iptables -A INPUT -j DROP" is the
    # first rule, then it will drop all incoming packets disregarding
    # what rules that come after.
    #
    
  • User Private Group (setgid)
    #
    # Press [Ctrl-Alt-F1] (Virtual Console 1) and login as root
    #
    /usr/sbin/groupadd usergroup
    /bin/mkdir /home/usergroup
    /bin/ls -alrt /home
    /bin/chown root.usergroup /home/usergroup
    /bin/chmod 2775 /home/usergroup
    /bin/ls -alrt /home
    
    #
    # Press [Ctrl-Alt-F2] (Virtual Console 2) and login as red
    #
    /bin/vi /home/usergroup/share.txt
    ################################################
    hello
    # Press [Esc] then type :wq to save and exit
    ################################################
    
    #
    # Press [Ctrl-Alt-F3] (Virtual Console 3) and login as hat
    #
    /bin/vi /home/usergroup/share.txt
    ################################################
    world
    # Press [Esc] then type :wq to save and exit
    ################################################
    
    #
    # Press [Ctrl-Alt-F2] (Virtual Console 2) with red logged
    # in to that terminal.
    #
    /bin/cat /bin/cat /home/usergroup/share.txt
    /bin/ls -alrt
    


 

Primac Systems Limited

Copyright 2001

 

Hosted by www.Geocities.ws

1