Lab Questions

 < Day Day Up > 



If you're pressed for time with these labs, I suggest that you run Lab 3 first. As you've read in the chapter, recompiling the kernel takes a long time. If you have a slower computer, some of the commands required to recompile the kernel take a while to complete. You can use this time to log into a different terminal and run the other labs in this chapter.

Lab 1

1. 

In this first lab, we'll look at setting up automatic connections to a shared network directory. While this lab uses files described in Chapter 4, it is focused on shell configuration files. For the purpose of this lab, assume your username is vaclav and you're mounting a shared NFS /mnt/inst directory from a remote computer with an IP address of 192.168.30.4. You're going to mount it in vaclav's home directory, in a blank directory named inst.

  1. Select the regular user of your choice. That user should have files such as .bashrc and .bash_logout.

  2. Find a shared directory on a remote computer.

  3. Set up a local directory for that user as a mount point.

  4. Configure commands for that user to mount and umount that remote directory. Make sure those commands run only when that user logs into his or her account.

this lab has two purposes: it is designed to help you understand mounted network directories and the login process. you can substitute the user, the shared network directory, and directories of your choice. but based on the premises in this lab, i would take the following steps: a. log in as user vaclav. create the specified directory. for this lab, you would use the mkdir /home/vaclav/inst command. b. test the network connection. mount the remote nfs directory on the directory that you just created. for this lab, use the following command: # mount -t nfs 192.168.30.4:/mnt/inst /home/vaclav/inst c. run the mount command by itself. if you ve successfully mounted to the shared directory, you should see it at the end of the list of mounted directories. d. unmount the network connection. for this lab, you would use the following command: # umount /home/vaclav/inst e. add the commands specified from steps 2 and 4 to the local .bashrc and .bash_logout configuration files. remember, since these files start with a dot, they are hidden. f. test the result. log out and log back in. check your mounted directories. if the command in .bash_logout does not work, you ll probably see the shared directory mounted multiple times.

Answers

1. 

This lab has two purposes: it is designed to help you understand mounted network directories and the login process. You can substitute the user, the shared network directory, and directories of your choice. But based on the premises in this lab, I would take the following steps:

  1. Log in as user vaclav. Create the specified directory. For this lab, you would use the mkdir /home/vaclav/inst command.

  2. Test the network connection. Mount the remote NFS directory on the directory that you just created. For this lab, use the following command:

    # mount -t nfs 192.168.30.4:/mnt/inst /home/vaclav/inst
  3. Run the mount command by itself. If you've successfully mounted to the shared directory, you should see it at the end of the list of mounted directories.

  4. Unmount the network connection. For this lab, you would use the following command:

    # umount /home/vaclav/inst
  5. Add the commands specified from steps 2 and 4 to the local .bashrc and .bash_logout configuration files. Remember, since these files start with a dot, they are hidden.

  6. Test the result. Log out and log back in. Check your mounted directories. If the command in .bash_logout does not work, you'll probably see the shared directory mounted multiple times.

Lab 2

2. 

In this lab, we will test the quotas created in this chapter. You'll use the basic quota settings described in this chapter, and then copy files to fill up the home directory of a user who has a quota applied. The steps required for this lab are straightforward.

  1. Set up quotas on the local computer. Use the criteria described earlier in this chapter. If you don't have a separate /home directory partition, you can set up quotas on the top-level root directory (/).

  2. Once you've set quotas in your /etc/fstab configuration file, remember to remount the partition where you've created a quota. Alternatively, you could reboot Linux, but that would take time that you may not be able to spare during either of the Red Hat exams.

  3. Set up a quota for the user of your choice. Remember, when you use the edquota command on a specific user, you can edit the quota file directly using vi editor commands. Configure a hard and a soft limit for that user.

  4. Log in as the user with the quota. Copy some large files to the home directory of that user.

  5. Continue the copying process until you see a warning message. When you do, run the quota command. What do you see? Is there anything in the output that gives you warning that you've exceeded the quota?

  6. Copy some additional files until you see a 'Disk quota exceeded' message. Run the quota command again. What do you see?

  7. Delete some files from that user's home directory-at least enough to get the files under the quota limits.

the purpose of this lab is to get you some more practice with creating quotas for users. it s quite possible that you ll have to configure quotas on the red hat exams. while you may not have to test quotas in the way described in this lab, it will help you become familiar with the error messages that you ll see when you exceed a hard and then a soft quota limit.

Answers

2. 

The purpose of this lab is to get you some more practice with creating quotas for users. It's quite possible that you'll have to configure quotas on the Red Hat exams. While you may not have to test quotas in the way described in this lab, it will help you become familiar with the error messages that you'll see when you exceed a hard and then a soft quota limit.

Lab 3

3. 

This lab is more of a detailed kernel-building exercise than a typical lab in this book. The exercise will include concise steps on how to configure, install, and test a new kernel. While the Red Hat Exam Prep guide no longer specifies that you have to know how to recompile the kernel, it is something you will need to do at some point in time as a Linux system administrator. See the Lab Answer section at the end of this chapter for the exercise.

before we can build a new kernel, we have to ensure we have all the correct rpm packages. you could do so by checking a list of rpms as described. alternatively, you can start the package management utility with the redhat-config-packages command. from this gui utility, make sure you have the kernel development package group installed. as with the rest of this chapter and the red hat exams, this assumes that you have a pc with a 32-bit intel type cpu. the procedures for other cpus vary and are not, as of this writing, covered on the red hat exams. the following list of rpms are associated with the source code: kernel-source-* glibc-kernelheaders-* glibc-devel-* cpp-* ncurses-* ncurses-devel-* binutils-* gcc-* a. when you install rhel 3, you ve probably already installed most of these packages. alternatively, it may be faster to install the kernel development package group using the package management utility. this utility automatically takes care of any dependencies. b. navigate to the /usr/src directory with the cd /usr/src command. run the ls -l command. you should see a link between the linux-2.4 directory and the location of your source code files. in rhel, that is by default the /usr/src/linux-2.4.21-4.el directory. c. navigate to the /usr/src/linux-2.4 directory. you ll be running the remaining kernel configuration commands from this directory. d. set up a unique name for the kernel that you re about to modify. open the makefile file in a text editor. look for the extraversion variable. red hat adds this variable as a suffix to the recompiled kernel. modify this variable as desired; save and exit from makefile. e. jot down the value of the extraversion variable here: ______________ f. determine the correct cpu on your hardware. use the command # cat /proc/cpuinfo g. jot down the cpu model name here: ________________ h. run the ls /usr/src/linux-2.4/configs command. you ll see a list of available default kernel configuration files. find the file associated with your cpu. if your computer has more than one cpu, use the smp version of the kernel, if available. if your computer has more than 4 gb of ram, use the hugemem version of the kernel, if available. save it in the /usr/src/linux-2.4/.config file. i. make sure you re in the /usr/src/linux-2.4 directory. clean up any stray source code from previous kernel reconfigurations with the following command: # make mrproper j. wait until the messages are complete. problems are rare at this stage. k. next, it is time to configure your kernel, using one of the three major tools: * make config a line-by-line tool that gives you a choice with all kernel options * make menuconfig a text-based menu that allows you to select just the changes you want * make xconfig a gui interface that works only in the x window system l. set the processor type to match your hardware (for example, pentium, pentium ii, pentium iii, pentium iv). m. return to the kernel configuration tool of your choice. turn off all unneeded devices. some possible unneeded devices are in the following categories: * isdn subsystem * i2o * old cd-roms * amateur radio * telephony support * symmetric multiprocessing support * mtr memory support n. be sure to turn on kernel loadable modules support. o. save your changes and exit. p. when you save the new configuration, the kernel configuration tool overwrites your /usr/src/linux-2.4/.config file. q. resolve all kernel dependencies (between sources) with the following command. this will produce a lot of output and may take several minutes. # make dep r. prepare the source code directories to create the new kernel with the following command: # make clean s. once your dependencies are resolved, it s time to build a new compressed kernel image, with the following command: # make bzimage t. this is the actual kernel build, which will take some time. you may take this opportunity to log into another terminal and run one of the other labs. u. the easiest way to see if the kernel build worked is to run the following command immediately after the messages from make bzimage command stop: # echo $? 0 v. if you got a 0, everything worked (success). any other result indicates a failure during the kernel build process. in that case, go back and reconfigure your kernel to make a configuration that works. w. check for the existence of two new files. run this command: # ls -l system.map arch/i386/boot/bzimage it should show you two files, a relatively small system.map and a much larger bzimage. x. make the loadable modules that will be used by this kernel: # make modules y. install the new custom kernel files into their correct locations and update your boot loader so that it knows about your new kernel. the make install command should perform all of these tasks. z. check to see that the make install command worked. based on the extraversion variable that you set earlier, check your /boot directory. you should see at least a new initrd, system.map, and vmlinuz file in this directory, with this variable as a suffix. otherwise, you ll need to copy these files yourself. also, check your boot loader configuration file (/etc/grub.conf for the default grub boot loader). aa. if the make install command didn t put an initial ram disk (initrd) into the /boot directory, you ll have to create one with the following command (if your version and extraversion variables are different, revise this command accordingly): # mkinitrd /boot/initrd-2.4.21-4.elcustom1 2.4.21-4.elcustom1 ab. congratulations, you have just installed a custom kernel on your new system. as long as you also have your original kernel in your boot loader menu, test it out! ac. run the reboot command. you should see both kernels in the boot loader menu. try your custom kernel!

Answers

3. 

Before we can build a new kernel, we have to ensure we have all the correct RPM packages. You could do so by checking a list of RPMs as described. Alternatively, you can start the Package Management utility with the redhat-config-packages command. From this GUI utility, make sure you have the Kernel Development package group installed. As with the rest of this chapter and the Red Hat exams, this assumes that you have a PC with a 32-bit Intel type CPU. The procedures for other CPUs vary and are not, as of this writing, covered on the Red Hat exams.

The following list of RPMs are associated with the source code:

kernel-source-* glibc-kernelheaders-* glibc-devel-* cpp-* ncurses-* ncurses-devel-* binutils-* gcc-*
  1. When you install RHEL 3, you've probably already installed most of these packages. Alternatively, it may be faster to install the Kernel Development package group using the Package Management utility. This utility automatically takes care of any dependencies.

  2. Navigate to the /usr/src directory with the cd /usr/src command. Run the ls -l command. You should see a link between the linux-2.4 directory and the location of your source code files. In RHEL, that is by default the /usr/src/linux-2.4.21-4.EL directory.

  3. Navigate to the /usr/src/linux-2.4 directory. You'll be running the remaining kernel configuration commands from this directory.

  4. Set up a unique name for the kernel that you're about to modify. Open the Makefile file in a text editor. Look for the EXTRAVERSION variable. Red Hat adds this variable as a suffix to the recompiled kernel. Modify this variable as desired; save and exit from Makefile.

  5. Jot down the value of the EXTRAVERSION variable here: ______________

  6. Determine the correct CPU on your hardware. Use the command

    # cat /proc/cpuinfo
  7. Jot down the CPU model name here: ________________

  8. Run the ls /usr/src/linux-2.4/configs command. You'll see a list of available default kernel configuration files. Find the file associated with your CPU. If your computer has more than one CPU, use the smp version of the kernel, if available. If your computer has more than 4 GB of RAM, use the hugemem version of the kernel, if available. Save it in the /usr/src/linux-2.4/.config file.

  9. Make sure you're in the /usr/src/linux-2.4 directory. Clean up any stray source code from previous kernel reconfigurations with the following command:

    # make mrproper 
  10. Wait until the messages are complete. Problems are rare at this stage.

  11. Next, it is time to configure your kernel, using one of the three major tools:

    • make config A line-by-line tool that gives you a choice with all kernel options

    • make menuconfig A text-based menu that allows you to select just the changes you want

    • make xconfig A GUI interface that works only in the X Window System

  12. Set the processor type to match your hardware (for example, Pentium, Pentium II, Pentium III, Pentium IV).

  13. Return to the kernel configuration tool of your choice. Turn off all unneeded devices. Some possible unneeded devices are in the following categories:

    • ISDN Subsystem

    • I2O

    • Old CD-ROMs

    • Amateur Radio

    • Telephony Support

    • Symmetric Multiprocessing Support

    • MTR Memory Support

  14. Be sure to turn on Kernel Loadable Modules support.

  15. Save your changes and exit.

  16. When you save the new configuration, the kernel configuration tool overwrites your /usr/src/linux-2.4/.config file.

  17. Resolve all kernel dependencies (between sources) with the following command. This will produce a lot of output and may take several minutes.

    # make dep
  18. Prepare the source code directories to create the new kernel with the following command:

    # make clean
  19. Once your dependencies are resolved, it's time to build a new compressed kernel image, with the following command:

     # make bzImage
  20. This is the actual kernel build, which will take some time. You may take this opportunity to log into another terminal and run one of the other labs.

  21. The easiest way to see if the kernel build worked is to run the following command immediately after the messages from make bzImage command stop:

    # echo $? 0 
  22. If you got a 0, everything worked (success). Any other result indicates a failure during the kernel build process. In that case, go back and reconfigure your kernel to make a configuration that works.

  23. Check for the existence of two new files. Run this command:

    # ls -l System.map arch/i386/boot/bzImage

    It should show you two files, a relatively small System.map and a much larger bzImage.

  24. Make the loadable modules that will be used by this kernel:

    # make modules
  25. Install the new custom kernel files into their correct locations and update your boot loader so that it knows about your new kernel. The make install command should perform all of these tasks.

  26. Check to see that the make install command worked. Based on the EXTRAVERSION variable that you set earlier, check your /boot directory. You should see at least a new initrd, System.map, and vmlinuz file in this directory, with this variable as a suffix. Otherwise, you'll need to copy these files yourself. Also, check your boot loader configuration file (/etc/grub.conf for the default GRUB boot loader).

  27. If the make install command didn't put an initial RAM disk (initrd) into the /boot directory, you'll have to create one with the following command (if your version and EXTRAVERSION variables are different, revise this command accordingly):

    # mkinitrd /boot/initrd-2.4.21-4.ELcustom1 2.4.21-4.ELcustom1

  28. Congratulations, you have just installed a custom kernel on your new system. As long as you also have your original kernel in your boot loader menu, test it out!

  29. Run the reboot command. You should see both kernels in the boot loader menu. Try your custom kernel!

Lab 4

4. 

In this fourth lab, you'll be updating your kernel from another source. One proviso-this lab will work only if there is a Red Hat RPM kernel file that is a later version from what is already installed on your computer. If you're running RHEL 3, you can still download and use one of the Fedora development kernel RPMs for the purpose of this exercise. (While there are no guarantees, the Fedora development kernel available as of this writing works fine on my RHEL 3 computer. However, there have been reported issues with various video cards and printer configurations.)

  1. Check download.fedora.redhat.com or one of the mirrors listed online at fedora.redhat.com/download/mirrors.html.

  2. Download the new kernel to the /tmp directory.

  3. Back up your current /etc/grub.conf configuration file, as well as the current files in your boot directory, in case something goes wrong.

  4. Use the rpm -ivh kernelfile command to install the new kernel.

  5. Observe the results. Check the files in /boot. Which files look like they're duplicated but with a different version number?

  6. Check your boot loader file. Assuming it's GRUB, open the /etc/grub.conf file in a text editor. Change the default variable in this file to point to the new kernel. If it's LILO, remember to run lilo to record the change in the MBR.

  7. Reboot your computer to test the new kernel.

assuming everything works with the updated red hat rpm kernel package, you should not have to update anything, especially if your boot loader is grub. the steps described in the lab should help you confirm this through the appropriate configuration files on your rhel 3 computer.

Answers

4. 

Assuming everything works with the updated Red Hat RPM kernel package, you should not have to update anything, especially if your boot loader is GRUB. The steps described in the lab should help you confirm this through the appropriate configuration files on your RHEL 3 computer.



 < Day Day Up > 



RCHE Red Hat Certified Engineer Linux Study Guide[c] Exam (Rh302)
RCHE Red Hat Certified Engineer Linux Study Guide[c] Exam (Rh302)
ISBN: 71765654
EAN: N/A
Year: 2003
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net