Minimal Services on CentOS 4.4 Mini-HowTo

Posted by Andrew Mitry under Web/Tech, Open Source

When I started running Linux servers on VMware Server resource management became much more important. The limiting factor on the boxes I am running is RAM. The less RAM I could get a server to use, the more servers I could run. I put in a call to an old buddy of mine, Anton Thaker. Anton is a RedHat Certified Engineer (RHCE) and knows Linux better than anyone else I know. Anton wrote a mini-howto on freeing up resources by disabling unneeded services. Here it is:

Here’s a mini-howto to free up resources on a server system by disabling
unneeded services. This is for a Minimal install of CentOS 4.4.

First, a note on “Minimal” installations. I’ve gotten into a habit of
doing minimal installs and installing additional software as needed
after installation. Using “yum” to install needed RPMs and their
dependencies is very easy. The minimal installation reduces the number
of packages requiring updates, makes it easier to keep a server clean in
the long run and eliminates any kind of graphical environment. It also
requires only the first installation CD, where any other type of
installation will usually ask for 3 or all 4 CDs.

The proper RedHat way to disable a service from being started at bootup
is to use the “chkconfig” utility.

After installation the machine reboots. When you login disable as many
service as possible with the following commands:

chkconfig acpid off
chkconfig atd off
chkconfig autofs off
chkconfig cpuspeed off
chkconfig cups off
chkconfig gpm off
chkconfig haldaemon off
chkconfig isdn off
chkconfig mdmonitor off
chkconfig messagebus off
chkconfig netfs off
chkconfig nfslock off
chkconfig openibd off
chkconfig pcmcia off
chkconfig portmap off
chkconfig rawdevices off
chkconfig rpcgssd off
chkconfig rpcidmapd off
chkconfig smartd off
chkconfig xinetd off

You can turn off “microcode_ctl” if this is an AMD machine, and
“irqbalance” if there is only one CPU. If you plan on using plug and
play devices you should leave “haldaemon” and “messagebus” running. If
you did not do a minimal install you’ll have more services enabled.

Run the following to see what else is enabled:
chkconfig –list |grep “3:on” |awk ‘{print $1}’ |sort

On my machine the above command lists:
anacron
crond
iptables
kudzu
network
sendmail
sshd
syslog

I left “anacron” and “kudzu” enabled, because it’s something that will
run at startup and will not stay loaded when finished. Sendmail is
there for email notifications, and can probably be taken out.
Everything else in the list is pretty much the minimum.

If you are not sure what something does, you can look in the particular
service’s startup script to see the comments at the beginning. The
scripts are in the /etc/init.d directory.

Also instead of running 6 virtual terminals, I have only two. To
disable them, edit the /etc/inittab file and comment out the ones that
you don’t want running like this:

# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
#3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6

Since this is a new install, make sure to run “yum update” and then
reboot the machine to apply the kernel update and stop the services that
we just disabled. If you don’t want to reboot, you can run “/etc/rc” to
stop the services not enabled in the current run level. It’s a good
idea to reboot to make sure that the system comes up properly.

The minimal installation takes about 721 MB of disk space. On a system
with 64 MB of RAM this setup utilizes about 17 MB of RAM.

Thanks for reading.

Anton Thaker.
RHCE

Read more at anhorite.org

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s