Wednesday, May 11, 2011

Racktables on CentOS 5.6

I find Racktables to be a very useful tool. Because it requires newer versions of PHP, it's a bit of a hassle to get it running on CentOS 5.x. Here are the steps:


1. Get the CentOS testing repo (for new versions of PHP.)

 cd /etc/yum.repos.d
 # now we enable the new repo - at least for long enough to satisfy the dependencies
 sed -i CentOS-Testing.repo -e 's/enabled=0/enabled=1/g'

2. update PHP to 5.3.x
 yum -y install php53 (you may need to remove php-common, if it's installed)

2b. optional: lock down MySQL:

 sudo /usr/bin/mysql_secure_installation

You'll want to assign a root password as well as delete anonymous users and disallow remote root logins.

3. Create the database and database user:
 mysql -u root -p

  create database racktables;
grant all on racktables.* to racktablesuser;
grant all on racktables.* to racktablesuser@localhost;
set password for racktablesuser@localhost=password('your_super_password');
flush privileges;

4. untar the racktables source and do a make && make install.

5. create entries for this host in DNS - A records and/or CNAMEs. For example, create an A record called racktables.yourdomain.local. 

5b. Create a configuration entry in apache. Edit /etc/httpd/conf.d/racktables.conf:


 ServerName racktables.your_domain.local
 DocumentRoot /usr/local/share/RackTables/wwwroot/


Obviously, this is not running over SSL. It's not a bad idea to run Racktables over HTTPS.

5c. Restart apache (sudo /sbin/service httpd restart)

6. Connect to your host. You'll probably get this error message:

 Database connection parameters are read from /usr/local/share/RackTables/wwwroot/inc/secret.php file,  which cannot be found. You probably need to complete the installation procedure by following this link.

7. Step through the links till you get to the dependency page (step 2 of 6.)

8. You'll see that you are missing numerous dependencies. Go ahead and fix the dependencies:

sudo yum -y install php-mbstring
sudo yum -y install php-gd
sudo yum -y install php-snmp
sudo yum -y install php-pdo
sudo yum -y install php-mysql

9. In order to get the unicode support in php pcre

sudo yum update pcre

10. We'll leave pcntl as is for now. In the next step, you'll see a warning about the secret.php file. To fix it:

sudo touch '/usr/local/share/RackTables/wwwroot/inc/secret.php'; sudo chmod 666 '/usr/local/share/RackTables/wwwroot/inc/secret.php'
(you'll need to either configure SELinux to allow access to that file or disable SELinux altogether. 
11. Enter the db name and db username and password from earlier. 
12. Set an administrator password in the next step.
You should be all set.



No comments: