|
楼主 |
发表于 2004-7-3 17:59:51
|
显示全部楼层
RHCE 认证考试内容第四版-Basic Configration and Administration
The Red Hat exams are unique based on their reliance on labs and hands-on demonstrations. With these questions, you're practicing the skills you need on both Red Hat exams.
Lab 1
1.
In this exercise, you are going to experiment with two ways to manage services at different runlevels: the chkconfig command and the redhat-config-services utility, also known as the Service Configuration utility. The commands in this lab don't start or stop scripts immediately; just the next time you move your Linux system into runlevel 3.
Open the GUI. From a text command line interface, run the redhat-config-services & command. This allows you to use the same terminal window for other commands. Alternatively, click Main Menu | System Settings | Server Settings | Services.
The Service Configuration utility is a graphical tool for controlling the services that Linux starts and stops at each runlevel.
These next steps assume that the nfs service is already running and installed. If not, pick another service to add and remove (it does not matter which as long as you restore the original condition when you're done).
At the command line, run the ls /etc/rc3.d/*nfs command to find the priority number.
Remove the nfs service from runlevel 3 using the Service Configuration utility.
Switch back to the command line window and run the chkconfig --list nfs command to see if it has been deactivated in runlevel 3.
Restore the nfs start script with the following command:
# chkconfig --level 3 nfs on
Switch back to the console window and run the chkconfig --list nfs command to verify that it is back.
Return to the Service Configuration utility, and click View | Refresh Service List to confirm that nfs is back on in runlevel 3.
Although the Red Hat Service Configuration utility provides a nice graphical interface, the chkconfig command is faster and more reliable, especially since X is not always available in an emergency or through remote login.
Answers
1.
Lab 1
To open a command line interface in the Red Hat GUI, right-click on the desktop. In the pop-up menu that appears, click New Terminal.
In the new terminal, open the Service Configuration utility. Run the applicable graphical tool in the background so you can still use this terminal window with the following command:
# redhat-config-services &
Run the ls /etc/rc3.d command. Look for the nfs start script and record the current order number. If you see only a kill script for nfs, it is not active in runlevel 3. If you don't see it at all, you need to install the nfs-utils RPM.
Deactivate the nfs service from level 3. It's easy to do so in the Service Configuration utility. But you have to remember to save your changes with the File | Save Changes command.
Switch back to the console window and run chkconfig to see if it has been deactivated in runlevel 3. If it has, you should see the following result:
# chkconfig --list nfs
autofs 0ff 1ff 2ff 3ff 4n 5n 6ff
Now run the chkconfig command to reactivate the nfs service. Return to the Service Configuration utility. Add the nfs service back in with the following command:
# chkconfig --level 3 nfs on
Now run the following chkconfig command to verify that nfs is active again in runlevel 3:
# chkconfig --list nfs
autofs 0ff 1ff 2ff 3:on 4:on 5:on 6:off
This should show that the nfs is started in runlevel 3. You practice using the chkconfig command. One way is to redo this lab. Use the service of your choice. Make sure what you see in the GUI Service Configuration utility matches what you see. After each change with the chkconfig command, run the View | Refresh Service List command to make sure the GUI tool reflects your change.
Lab 2
2.
While the Red Hat User Manager provides a convenient interface to add new users, it's important for the exam to know the basic command line tools. Specifically, you can use the useradd, usermod, and userdel commands to add, modify, and delete user accounts.
Use the man pages for useradd (or just type useradd with no arguments for a simple help summary) to find the switches you need to add the following account with each of these attributes:
login: brianr
name: brian rite
UID: 5010
GID: nobody
shell: /bin/bash
Change the passwd for brianr to RvRg49().
Open a different virtual terminal. Log in as brianr. What files are present in this new account? Exit from this login.
Remove the brianr account using the userdel command. Is the brianr home directory gone? What option would have done this for you?
Answers
2.
Lab 2
To add the account, enter:
# useradd brianr -u 5010 -g nobody -c 'brian rite' -s /bin/bash
Change the password:
# passwd brianr
Open a new virtual console. For example, to open the second virtual console, press ALT-F1. If you're in the GUI, also press the CTRL key.
Log into the new account.
What files are there? Include all the hidden files to see the skeleton files copied over from the /etc/skel directory.
$ ls -a
Remove the brianr account using the userdel command. Is the brianr home directory gone? What option would have done this for you?
# userdel brianr # leaves the home directory
# userdel -r brianr # also removes home directory
Rerun these tasks in the Red Hat User Manager.
Lab 3
3.
In this lab, you'll configure the Automounter on your computer on an NFS connection. You'll need a second computer with Linux or Unix installed, and a shared NFS directory. You can use the shared NFS installation source created in Chapter 2 or any other shared NFS directory described in Chapter 9. A virtual machine such as a VMWare computer qualifies as a second computer.
Back up your current /etc/auto.master and /etc/auto.misc configuration files.
Open the /etc/auto.master configuration file in the text editor of your choice. Add or activate the command which applies the Automounter to the /misc directory.
Open the /etc/auto.misc configuration file. Use the example shown in this file to create an NFS entry, which points to the shared NFS directory on the second computer. For the purpose of this lab, set the name of the directory to test.
Restart the autofs server.
Try your connection. Run the following command:
# ls /misc/test
You should see the contents of the shared NFS directory. Run the following command. What do you see?
# ls /misc
Wait a while, at least the timeout specified in the /etc/auto.master configuration file.
Run the ls /misc command again. What happens?
Once you're satisfied with the result, restore the files you backed up in step 1.
Answers
3.
Lab 3
Configuring the Automounter on a shared NFS directory is easier than it looks. Before you begin, make sure that you can mount the shared NFS directory from the remote computer. If there's a problem, resolve those first before beginning this lab. Refer to Chapter 2 on creating an NFS Installation Server or Chapter 9 on NFS for more information. If there's no problem with a source on an NFS server with an IP address of 192.168.30.4, you should be able to mount it locally. For example, you can mount a shared remote NFS /mnt/inst directory on an existing empty local /mnt/test directory as follows:
# mount -t nfs 192.168.30.4:/mnt/inst /mnt/test
Configuring the Automounter is easier than it looks. But first, as with any of these experiments, it's important to back up any files that you're about to edit. In this case, those are the configuration files which govern the autofs daemon, /etc/auto.master and /etc/auto.misc.
One of the fortunate things about the RHEL 3 version of these files is that they contain tips and example commands that you can use and learn from as you work with the Automounter. Use them to your advantage. You can activate the standard commented command in the /etc/auto.master file to activate the Automounter on the /misc directory:
/misc /etc/auto.misc --timeout=60
This command sets a timeout of 60 seconds, depending on details specified in /etc/auto.misc. Activate this command (remove the #) and save your changes to /etc/auto.master.
Open /etc/auto.misc in your text editor. The example shown is easy to follow:
#linux -ro,soft,intr ftp.example.org:/pub/linux
Let's assume you're using your NFS installation server from Chapter 2, and that server is at IP address 192.168.30.4. In that case, you'd add the following command to this file:
test -ro,soft,intr 192.168.30.4:/mnt/inst
Now you can restart the autofs server; the quickest way is with the following command:
# service autofs restart
Now when you test the result, you should be able to see the contents of your shared NFS directory.
# ls /misc/test
You can test the result in a different way. Before the timeout in /etc/auto.master expires, the following command should reveal the test subdirectory:
# ls /misc
test
After the timeout is complete, rerun the ls /misc command again. The test subdirectory should no longer be there, which tells you that the timeout specified in /etc/auto.master has expired. Please, retry this lab with other shared NFS directories. Remember to restore the original /etc/auto.master and /etc/auto.misc files when you're done.
Lab 4
4.
In this lab, you'll observe what happens when you avoid mounting the /boot filesystem. This of course assumes that you have a computer configured with /boot mounted on a separate partition.
Back up your /etc/fstab configuration file to something you can easily remember, such as /etc/bak.fstab.
Run the df command and make a note of the mounted filesystems, especially the partition associated with /boot.
Open /etc/fstab in the text editor of your choice. You should have a line associated with the /boot directory. If you do not, stop, as you cannot continue with this lab. Trying to continue with this lab under these circumstances will probably render your system unbootable.
Comment out the line with the /boot directory. Add a # in front of that line. For example, your /etc/fstab /boot directory line might read something like:
# LABEL=/boot /boot ext3 defaults 1 2
Save /etc/fstab and reboot Linux.
Observe the results. Does Linux start normally?
Look at your boot directory. Are there any files missing? How did Linux boot without benefit of a vmlinuz kernel or a mkinird RAM disk file?
Run the df command and make a note of the mounted filesystems.
Open /etc/fstab again. Remove the comment field, the #, in front of the /boot directory line. Save /etc/fstab. This should restore your /etc/fstab to the original configuration.
Mount the /boot directory with the mount /boot command.
Open your GRUB configuration file, /boot/grub/grub.conf in your text editor.
Observe the line associated with the root variable. This should correspond to the default partition for the /boot directory. Note that GRUB does not require that a partition is mounted to access a file.
Reboot your system. Run the df command and compare the list of mounted filesystems to step 2. If they are the same, stop here. Otherwise, restore your /etc/fstab from the backup file, /etc/bak.fstab.
Answers
4.
Lab 4
Remember, you should not try this exercise if you don't have a separate line for the /boot filesystem in /etc/fstab. And this assumes that GRUB is your default bootloader.
This should be a self-explanatory exercise. Essentially, you're just making a minor modification to the /etc/fstab file. If you do it correctly, Linux should boot normally, even if it does not mount the /boot filesystem. The key is within the GRUB configuration file, as the root variable in /boot/grub/grub.conf doesn't require a mounted filesystem to read your vmlinuz kernel or your mkinird initial RAM disk files.
Lab 5
5.
In this lab, you'll install a new package group with the redhat-config-packages command, also known as the Package Management utility. You'll need a remote network source with the Red Hat installation files. It can be the same network source that you used in Chapter 2 to install RHEL 3.
In the Red Hat GUI, open a command line interface.
Click Main Menu | System Settings | Add/Remove Applications to open the Package Management utility.
Try adding the software of your choice. When you're prompted for a CD, click Cancel and exit from the utility.
Mount the network installation source that you created in Chapter 2. For the purpose of this lab, create a /mnt/test directory, and then use that as the mount point.
Run the following command. If it doesn't start the Package Management utility, there may be a problem with the mount or the network source. See Chapter 2 for more information.
# redhat-config-packages --tree=/mnt/test
Try adding the software of your choice. Now see if you're prompted for a CD.
Answers
5.
Lab 5
The point of this lab is to see how you can use the Package Management utility with a network installation source. You'll be able to install any additional package groups that you need. That can be much more efficient than using the rpm command to install the dozens of RPMs associated with some package groups.
The steps I've described work only if your connection to the NFS server works, as described in Chapter 2 as well as Lab 3. |
|