At work, I found it helpful to have test machines that are quick to blow up and get back to a base install. In my opinion, the best way to do this is to virtualize a box.
This is my quick software build for installing VMware (Free Server) on a CentOS 5 box.
Here are my install steps:
First Install CentOS 5 with a minimal installation (uncheck everything). After the first boot, I log in as root and go:
1 useradd somebody
2 passwd somebody
3 vi /etc/ssh/sshd_config
Here I am just verifying that ssh doesn’t allow root log in.
4 service sshd restart
5 cd /home/somebody
6 vi securemachine
Here I am pasting a script I received from a dear friend in Baltimore that uninstalls unneeded stuff. I prefer to install anything I need as I need it. This machine will only be a VMware box so I don’t need anything else. Remember to set a static IP address. This script will kill the DHCP client.
7 chmod 755 securemachine
8 ./securemachine
9 ./securemachine
10 ./securemachine
11 ./securemachine
12 ./securemachine
13 ./securemachine
14 ./securemachine
15 ./securemachine
The trick here is to keep running the script until it no longer removes packages. The number that displays at the end will stop decreasing.
16 shutdown -r now
Sometimes, you’ll need to turn off iptables here instead of at the end. See steps 27 and 28.
17 yum update
18 yum install glibc libxpm perl gcc kernel-devel libX11 libXtst libXext libXt libICE libSM libXrender libz libc inetd
19 shutdown -r now
20 cd /home/somebody
21 wget http://download3.vmware.com/software/vmserver/VMware-server-1.0.3-44356.tar.gz
22 cp VMware-server-1.0.3-44356.tar.gz /tmp
23 cd /tmp
24 tar zxf VMware-server-1.0.3-44356.tar.gz
25 cd vmware-server-distrib
26 ./vmware-install.pl
Answer the questions and follow the instructions.
27 service iptables stop
28 chkconfig iptables off
My machine will be on my private network and I am not worried about it. However, you may want to set up iptables to protect your machine if you have different requirements.
30 shutdown -r now
When the machine comes back up, it will be working like a charm. You’ll need to install the VMware Server Console to access the VM.
Good Luck!