Mon 13 Nov 2006
Minimal Services on CentOS 4.4 Mini-HowTo
Posted by Andrew Mitry under Open Source, Web/Tech
[11] Comments
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


November 25th, 2006 at 1:30 am
Thanks Andrew and Anton. This was just the info I was looking for when I found it.
I added:
chkconfig cups-config-daemon off
And I wasted some more time by:
If you want to compare the list before and after, you can:
chkconfig -list |grep “3:on” |awk ‘{print $1}’ |sort > before
and
chkconfig -list |grep “3:on” |awk ‘{print $1}’ |sort > after
run the block of chkconfig commands, then
diff before after
Thanks again,
G
January 23rd, 2007 at 4:21 am
I found that using the server cd instead of the standard CDs reduces the install size.
Also, this site may be worth checking out.
http://www.owlriver.com/tips/tiny-centos/
They include a kickstart file with the bare minimum packages.
February 20th, 2007 at 5:06 pm
where can i get centos 4.4 documents such as tutorials it seems like there is no support for centos on the net.
February 20th, 2007 at 6:00 pm
Hello Carlos,
I would take a look at HowtoForge and the CentOS forums.
March 5th, 2007 at 9:38 am
just what i needed…
big thnx..
btw:
in article, there is:
chkconfig –list
i think it should be
chkconfig –-list
March 22nd, 2007 at 9:03 am
Thanks for this reference.
Would be good to have a note on what each of the services do so that people don’t just blindly turn them off.
March 22nd, 2007 at 9:50 am
Good idea, I’ll see if Anton can get us an update.
March 22nd, 2007 at 11:12 am
it’s not a thorough list, but this helped me some to explain the services:
Understanding your (Red Hat Enterprise Linux) daemons
hope it helps,
Greg
March 22nd, 2007 at 12:14 pm
looks great, thanks!
April 22nd, 2007 at 7:33 pm
Hello,
I think, it’s not a good idea to disable xinetd…
But the rest ist really not needed on Vmware host.
April 22nd, 2007 at 8:31 pm
Why would we need to keep xinetd?
Thanks!