星期三, 一月 21, 2009

Hardware and Installation-0122

Configuring a Network Installation
1: copy the installation files from each CD to a common directory
2: configure sharing on the directory
3: activate the NFS, FTP, or HTTP network

Creating an NFS Installation Server
NFS is the most efficient way to share files between Linux and Unix computers.
1. Create a directory for your installation files.
# mkdir /inst

2. Insert the first Red Hat Enterprise Linux installation CD/DVD into its drive.
# mount /dev/cdrom /media
# mount -ro loop /tmp/firstcd.iso /media( if all you have are the ISO files in the /tmp directory)

3. Copy the required files from the first Red Hat Enterprise Linux installation CD. Use the cp -ar /source/. /inst command, where source is the mount directory (such as /media/RHEL 5 i386 Disc 1).Don't forget the dot (.); it copies hidden files, including the .discinfo file from the first Red Hat Enterprise Linux installation CD.

4. Unmount the first Red Hat Enterprise Linux installation CD. If it's an installation DVD, skip to step 6. Use the umount /source command.

5. Repeat steps 2, 3, and 4 with the remaining Red Hat Enterprise Linux installation CDs.

6. Set up an NFS share. Add the following line to /etc/exports. You can do it with a text editor such as vi or the system-config-nfs utility.
/inst *(ro,sync)

7. Export the shared directory
# exportfs -a

8. Make sure there's nothing blocking access to NFS. The default Red Hat Enterprise Linux firewall blocks access to an NFS server. While inelegant, the following command "flushes," or turns off, the standard Linux firewall from the local computer. If you've enabled SELinux, you'll also have to use the SELinux Management Tool to change the associated NFS boolean variable to "Allow the reading on any NFS file system". Don't forget to restart NFS to activate all of your changes.
# iptables -F

9. Now you can activate the NFS service. The following commands assume that it's already running (which you can check using the service nfs status command)
# service nfs stop
# service nfs start

10. Finally, you can check the status of your share. If it's working, you should see the contents of the /etc/exports directory when you run the following command.
# showmount -e


RHCE Prerequisites-0121

cron

crontab -e
crontab -u username -e

Five schedule fields appear on the left side of each crontab entry:
minute, hour, day of month, month, and day of week.
0 17 * * *
0 17 * * 1
0,10 17 * * 0,2,3
0-10 17 1 * *
2 8-20/3 * * *

Backup and Restore

Tape Backups
Using magnetic tape in Linux depends on the ftape system using tarballs to group directories into single compressed backup files.

DVD/CD Backups
mkisofs -J -r -T -o /tmp/backhome.iso /home
cdrecord -v /tmp/backhome.iso

Hard Drive(RAID) Backups

gzip and bzip2
gzip big.jpg
bzip2 big.jpg

gzip -d big.jpg.gz
bzip2 -d big.jpg.bz2

tar
The tar command was originally developed for archiving data to tape drives. However, it's commonly used today for collecting a series of files, especially from a directory.
tar czvf home.tar.gz /home
tar xzvf home.tar.gz /home

System Log File Management
Log files are controlled by the syslogd daemon and organized in the /etc/syslog.conf file.

Basic TCP/IP Networking

ping
The ping command allows you to test connectivity-locally, within your network, and on the Internet.
assume your IP address is 192.168.122.43 and
the gateway address on your network is 192.168.122.99.

1:First test the integrity of TCP/IP on your computer.
# ping 127.0.0.1
2:see if you're properly connected to your LAN
# ping 192.168.122.43
3:ping the address of another computer on your network
# ping 192.168.122.78
4:ping the address for your gateway
# ping 192.168.122.99
5:If possible, ping the address of your network's connection to the Internet
6:finally, ping the address of a computer that you know is active on the Internet.

ipconfig
The ipconfig command can help you check and configure network adapters.

netstat
The netstat command is versatile; it can help you see the channels available for network connections, interface statistics, and more. One important version of this command, netstat -r, displays routing tables that can tell you if your computer knows where to send a message.

Configuring Name Resolution
Using four configuration files, Linux can help you translate computer host names to IP addresses.

/etc/sysconfig/network
to specify information about the desired network configuration.

/etc/hosts
to contains IP addresses and their corresponding hostnames.

When your system tries to resolve a hostname to an IP address or tries to determine the hostname for an IP address, it refers to the /etc/hosts file before using the name servers (if you are using the default Red Hat Enterprise Linux configuration). If the IP address is listed in the /etc/hosts file, the name servers are not used. If your network contains computers whose IP addresses are not listed in DNS, it is recommended that you add them to the /etc/hosts file.

/etc/resolv.conf
the IP address of each DNS server is listed with a simple line similar to this:
nameserver 192.168.0.1

/etc/host.conf
When your computer looks for an IP address, this file determines whether it searches through /etc/hosts or DNS first. This is usually a one-line file: order hosts,bind

But in most cases, this file has been superseded by /etc/nsswitch.conf

/etc/nsswitch.conf
The key directive in this file, with respect to name resolution, is
hosts: files dns

This is a more straightforward expression of where Linux looks for an IP address when it sees a host name. First, it looks at the file, /etc/hosts, and then it looks at the available DNS server, as defined in /etc/resolv.conf

星期五, 一月 09, 2009

RHCE Prerequisites-0109

Shells

Their default environment variables' values are shown in the output to the env command.

echo $PATH

add the /sbin directory to your PATH
PATH=$PATH:/sbin
export PATH

Every time you create a new file, the default permissions are based on the value of umask.
In the past, if the value of umask is 022, the default permissions for any file created by that user is 777-022, but Now 666-022, as new files can no longer get executeable permissions

When you type the umask command, you get a four-number output such as 0245. As of this writing, the first number in the umask output is always 0 and is not used. In the future, this first number may be usable to allow for new files that automatically include the SUID or SGID bits.

SUID and SGID

Shadow Password Suite
Historically, all that was needed to manage Linux users and groups was the information included in the /etc/passwd and /etc/group files. These files included passwords and are by default readable by all users.

The Shadow Password Suite was created to provide an additional layer of protection. It is used to encrypt user and group passwords in shadow files (/etc/ shadow and /etc/gshadow) that are readable only by users with root privileges.

THE Superuser


su The superuser command, su, prompts you for the root password before logging you in with root privileges.

sudo The sudo command allows users listed in /etc/sudoers to run administrative commands. You can configure /etc/sudoers to set limits on the root privileges granted to a specific user.

Red Hat Enterprise Linux provides some features that make working as root somewhat safer. For example, logins using the ftp and telnet commands to remote computers are disabled by default.

/etc/skel for Home Directories
Basic configuration files(hidden) for individual users are available in the /etc/skel directory.
If you want all future users to get specific files in their home directories, include them here.

Red Hat Enterprise Linux provides an easy way to control network service daemons through the scripts in /etc/rc.d/init.d. The actual daemon itself is usually located in the /sbin or /usr/sbin directory.

/etc/init.d/httpd restart

星期四, 一月 08, 2009

RHCE Prerequisites-0108

Architectures
RHCE EXAMS based on the basic Intel 32-bit or i386 architecture


Intel Communications Channels

Three basic channels are used to communicate in a basic PC:
1: interrupt request (IRQ) ports --------/proc/interrupts
An IRQ is a signal that is sent by a peripheral device to the CPU to request processing time.
Normally, each device needs a dedicated IRQ (except for USB and some PCI devices).

2: input/output (I/O) addresses --------/proc/ioports
It's a place where data can wait in line for service from your CPU.

3: direct memory address (DMA) channels --------/proc/dma
A direct memory address (DMA) is normally used to transfer information directly between devices like sound cards which include their own processor, bypassing the CPU.


File Filters
sort, grep, egrep,wc, sed, awk

The wc command, short for word count, can return the number of lines, words, and characters in a file.

The sed command, short for stream editor, allows you to search for and change specified words or even text streams in a file.
sed 's/Windows/Linux/g' opsys > newopsys

The awk command, is more of a database manipulation utility. It can identify lines with a keyword and read out the text from a specified column in that line.
awk '/Mike/ {print $1}' /etc/passwd