How to Install RackTables on CentOS 7

racktables installRackTables is a data center asset management system. It is a nifty and robust solution for data center/server room asset management and helps document hardware assets, network addresses, space in racks, networks configuration and much much more. This article covers step by step installation of Racktables in CentOS 7.

1. Prepare the web server

RackTables uses a web-server with PHP (5.2.10 or newer) for front-end and MySQL/MariaDB server version 5 for back-end. Therefore, we will configure LAMP stack and then we will proceed with the installation of Racktables. Install Apache with the following commands.

# yum install httpd
# systemctl start httpd.service && systemctl enable httpd.service

2. Install MariaDB

Install MariaDB using YUM and enable the service. Optionally you can secure the database with mysql_secure_installation

# yum install mariadb-server mariadb
# systemctl start mariadb.service
# systemctl enable mariadb.service
# mysql_secure_installation

Create database/user.

# mysql -u root -p
mariadb> create database racktables;
mariadb> grant all privileges on racktables.* TO 'rackuser'@'localhost' identified by 'Passw0rd!';
mariadb> flush privileges;
mariadb> exit

Check the above MySQL user/password actually works using:

# mysql -u rackuser -pPassw0rd!

Change the character set of MySQL server to utf8 to enable Unicode in the MySQL server.

# vi /etc/my.cnf.d/server.cnf
character-set-server = utf8
collation-server = utf8_general_ci

# systemctl restart mariadb.service

3. Install PHP/extensions

Install PHP and all the required php extensions needed by racktables.

# rpm -Uvh
# yum update
# yum install php php-mysqlnd php-pdo php-gd php-snmp php-mbstring php-bcmath php-ldap
# service httpd restart
# echo '<?php echo phpinfo(); ?>' > /var/www/html/info.php

Check your LAMP stack by pointing your web browser to http://Server-IP/info.php

4. Create racktable user

Create an unprivileged racktable user who will own all php files inside apache DocumentRoot to make it secure.

# useradd -s /sbin/nologin -c "RackTables User" -m -d /home/racktables racktables
# id racktables

5. Download/extract Racktables

Unpack the tar.gz/zip archive to a directory of your choice and configure Apache httpd to use wwwroot subdirectory as a new DocumentRoot. Alternatively, You can symlinks to wwwroot or even to index.php from an existing DocumentRoot.

# cd /tmp
# wget
# tar -xvzf RackTables-0.20.14
# cp -rf RackTables-0.20.14/ /var/www/html/

Change ownership of RackTables-0.20.14 to racktables user that we have created in steps 4.

# chown -R racktables:racktables RackTables-0.20.14

Create racktables.conf file under the apache configuration directory with the following contents:

# cd /etc/httpd/conf.d
# vi racktables.conf

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

<Directory /var/www/html/RackTables-0.20.14/wwwroot/>
   DirectoryIndex index.php
   Require all granted

Alias /racktables /var/www/html/RackTables-0.20.14/wwwroot/

6. Install Racktables

RackTables stores the database information in the secret file inside inc folder. Set the permissions of this file to 644 so that Apache can write the information into this file during installation. We will change the permission of this file in the middle of the installation.

# systemctl restart httpd
# touch /var/www/html/RackTables-0.20.14/wwwroot/inc/secret.php
# chmod 644 /var/www/html/RackTables-0.20.14/wwwroot/inc/secret.php

Now run the installer by pointing your web browser to http://Server-IP/racktables/?module=installer

Racktables installation Step 1 of 7

Click 'Proceed'. If SELINUX is enabled then disable it temporarily using setenforce

# setenforce 0

Racktables installation Step 2 of 7

Click 'Proceed'

Racktables installation Step 3 of 7

Provide database name, database user and password that we have created in Step 2

Racktables installation Step 3 of 7

Click 'Proceed'

Racktables installation Step 4 of 7

Change the permission and click "retry"

# chmod 440 /var/www/html/RackTables-0.20.14/wwwroot/inc/secret.php


Racktables installation Step 4 of 7

Click 'Proceed'

Racktables installation Step 5 of 7

Click 'Proceed'

Racktables installation Step 6 of 7

Provide Administrator password and click 'retry'

Racktables installation Step 6 of 7

Click 'proceed'

Racktables installation Step 7 of 7

Click 'Proceed' , You will be asked to provide a username/password. Login with user as 'admin' and password that you have provided in installation step 6.

Login racktables

The racktables dashboard should be available to you.

Racktable main page

You can now customize dashboard according to your requirements.

Click RackTables Administrator (Top right)-> Quick links tab

Check the configuration and save it by clicking blue arrow at the bottom of the page. We have checked and saved 'User interface' in the image below that will show up in the dashboard.

Racktable settings

Once the installation is finished, you can enable the SELINUX using:

# setenforce 1

You can now start creating objects like servers, network devices etc. for your IT inventory. You can check racktables wiki for installing it in other linux distros.

About Dwijadas Dey

Dwijadas Dey is working with GNU/Linux, Open source systems since 2005. Having avid follower of GNU/Linux, He believes in sharing and spreading the open source ideas to the targeted audience. Apart from freelancing he also writes for community. His current interest includes information and network security.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.