Rackspace CentOS 5.5

Thu, 2 Sep 2010

This is a clean installation of Webmin on Rackspace CentOS 5.5. this tutorial is based off of Rackspace's Knowledge Base, but since I had some problems I am writing this. I'm not a server admin and I always enjoy learning.

First, Create your Cloud, then login via SSH.

Password & Update

The very first thing you want to do is change your password. After you login simply do the following 3 commands, all 3 should take about 5 minutes.

$ passwd
$ yum list updates
$ yum update

Bash Security

Next my friend Shayne let me in on this tidbit for SSH security. We are going to change the default Port 22 to something else, so it's impossible for someone to login without knowing the port. You can use any number from 1 - 10000.

$ sudo nano /etc/ssh/sshd_config

Remove the comment from #Port 22, and change your port to any number 1-10000 For my example I have:

Port 2022

Now restart your SSHD service

/sbin/service sshd restart

Before we get too crazy, we need to poke a hole in the firewall so we are allowed to login from a different port

$ sudo nano /etc/sysconfig/iptables

Look for this line (notice the 22):

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

Change it to what you set your port above, ie:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2202 -j ACCEPT

Restart your iptables service

sudo service iptables restart
(If you get an error, re-open the iptables file and make sure you didn't get an item on another line)

Next open another instance of Shell, (Leave the previous one open). Then connect to your server with the new Port you set. If you are locked out then it's a good thing you have your previous one open!

Installing Webmin

Create a repository for webmin

sudo nano /etc/yum.repos.d/webmin.repo

Paste this inside it, (On windows you right click to paste)

[Webmin]
name=Webmin Distribution Neutral
baseurl=http://download.webmin.com/download/yum
enabled=1

Install the Key

$ sudo rpm --import http://www.webmin.com/jcameron-key.asc

Install required package

$ sudo yum -y install perl-Net-SSLeay

Get Webmin

sudo yum install webmin

See where the webmin loading begins:

chkconfig --list

Adjust to this, so slot 4 is on also:

chkconfig --level 2345 webmin on

Allow port 10000 for webmin, type this:

iptables -I INPUT  -p tcp --dport 10000 -j ACCEPT ;
/etc/init.d/iptables save

In your web browser, Go to your site, in https with :10000 at the end

https://123.456.789.012:10000

Accept the certificate, login with your root info.

Apache and PHP

Install and run Apache

sudo yum install httpd mod_ssl
sudo /etc/init.d/httpd start

Make sure Apache auto starts

sudo /sbin/chkconfig httpd on

Go to the bottom of this file

sudo nano /etc/httpd/conf/httpd.conf
# And add your server name in your control panel, mine would be like:
ServerName main

PHP install

sudo yum install php php-common php-gd php-mcrypt php-pear php-pecl-memcache php-mhash php-mysql php-xml
sudo /etc/init.d/httpd reload

MySQL Install

Update all software on the server

sudo yum -y update

Install it

sudo yum -y install mysql-server

Turn it on

sudo /etc/init.d/mysqld start

Configure Real Quick, Make a password and hit Y for every option

sudo /usr/bin/mysql_secure_installation

You are good to go for now :) Make sure to type exit when you are done with shell! Have fun running CentOS 5.5!