Friday, September 22, 2006

RedHat Enterprise 4 Administration

The first linux distribution I used was RedHat and after that I have used several distribution up to Kubuntu now. It's been more than 5 years since I left RedHat and today I got the task to install RedHat Enterprise V4 for a mail server. Now more than ever I realise the importance of recording all I have learned... I cannot even setup the default gateway on this RedHat thing. Of course I now the route command to set it up, but this need to be set when the server is rebooted etc. and to keep things clean I want to configure it as RedHat does it.

After several minutes googling I got all the required information for setting up the network and for managing packages in redhat.

Network Setup

All network configuration files are in the directory /etc/sysconfig/network-scripts/. In this directory exist a file for each physical interface in the computer with names like ifcfg-ehX.

The file format for the first Ethernet device is:



We can have multiple configurations in the same device (i.e. Multiple IPs) by means of aliases







For the new configuration to take effect we can reload the network service.

# service network restart

The Gateway setup as I can see can be configured in the network card like in the previous example or in the /etc/sysconfig/network file. The only difference (maybe) is that this gateway is for the whole system (i.e. all cards) while the gateway configured in the ifcfg-etX files are device specific. Again this is a guess as I have not tried this yet.

DNS Setup

This configuration is stored in the file /etc/resolv.conf. This example resolv.conf is using and as the nameservers.



Managing Services

When managing a server it is necessary to know how to configure services to start/stop and boot time and how to add/delete new services. We can do this manually by creating scripts in the corresponding rc.d directories but RedHat provides an utility for this: "chkconfig".

We must remember that linux has several run-levels and that each one can start different services. RedHats default run level is 3 so lets see what services get started when the machine is turned on.

# chkconfig –list |grep “3:on”

To see the list of all service simply delete the grep part like :

# chkconfig –list

To add a new service to the startup list, execute:

# chkconfig –add service_name

To stop a service from starting on bootup, execute:

# chkconfig –del service_name

To manually start or stop a service, execute the following as root:

# service service_name [start|stop]

For more info use the man page:

# man chkconfig

Managing Packages (RPM)

The RPM command is used in RedHat to install/query/remove software packages. Unfortunatelly this utility does not provide automatic updates or package search capabilities like the debian apt-get or aptitude utilities. Anyway if you want to keep your system as clean as possible we should consider using rpm istead of istalling stuff from source code. The most important operations are:

To get all of the information for a package (newpackage-1-50.rpm), execute

# rpm -qip newpackage-1-50.rpm

To check to see if a package is installed,

# rpm -q newpackage
Package newpackage is not installed.

To find out what files this package will install

# rpm -qpl newpackage-1-50.rpm

To install,

# rpm -ihv newpackage-1-50.rpm

To remove a package,

# rpm -e newpackage

To upgrade,

# rpm -Uvh newpackage-1-51.rpm

To rebuild the RPM database,

# rpm -rebuild

To return a list of all installed packages in the RPM database,

# rpm -qa

No comments:

Post a Comment