Here you’ll learn to install RackTables on Ubuntu 20.04|18.04|16.04 Linux system. Racktables is a robust and nifty tool designed to help you manage your datacenter and server room assets. RackTables allows you to manage document hardware assets, network addresses, space in racks, networks configuration and much much more. Earlier on in the series we covered:
- How to Install NetBox on CentOS 7 with Apache and Supervisord
- Install and Configure phpIPAM on Ubuntu
- Install Netbox Ubuntu 18.04 LTS
RackTables Requirements
RackTables requires:
- A web-server – Apache or Nginx
- PHP 5.5.0 or newer) for front-end
- MySQL/MariaDB database server for the back-end data.
We will install these required packages before setting up RackTables on our Ubuntu server. For Database, we’ll use MariaDB, for Web server we’ll use Nginx.
Step 1: Install PHP and required extensions
Ubuntu 20.04 ships with PHP 7.4, 18.04 has PHP 7.2 in its repositories, and PHP 7.0 Ubuntu 16.04 LTS. Install Ubuntu and required extensions on any of the systems using the commands:
sudo apt-get update
sudo apt-get install php php-cli php-snmp php-gd php-mysql php-mbstring php-bcmath php-json php-fpm php-ldap
Step 2: Install MariaDB Database server
Start with the installation of MariaDB database server:
sudo apt-get update
sudo apt-get install mariadb-server mariadb-client
Ensure mariadb service is started and set to start at boot:
sudo systemctl enable mariadb
sudo systemctl start mariadb
Secure database server by setting root password:
sudo mysql_secure_installation
Once you have MariaDB database server installed, create a database and user for RackTables
$ sudo mysql -u root -p
CREATE DATABASE racktables CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES on racktables.* TO 'racktables'@'localhost' IDENTIFIED BY "StrongPassword";
FLUSH PRIVILEGES;
QUIT;
Step 3: Install Nginx and php-fpm
PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features. In this section, we’ll install nginx web server and php-fpm.
sudo apt-get install -y nginx php-fpm
Create Nginx configuration file for RackTables
sudo vim /etc/nginx/conf.d/racktables.conf
Paste and modify the data below:
server {
listen 80;
server_name racktables.example.com;
root /var/www/racktables/wwwroot;
location / {
index index.php;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
You’ll need to replace /var/www/racktables
with your Racktables root folder.
Check to confirm that the configuration file is okay
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Step 4: Download and install Racktables
We’ll download RackTables to the /var/www
directory:
cd /var/www
Clone racktables source code from Github
$ sudo git clone https://github.com/RackTables/racktables.git
Cloning into 'racktables'...
remote: Enumerating objects: 38, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 32365 (delta 17), reused 24 (delta 13), pack-reused 32327
Receiving objects: 100% (32365/32365), 25.60 MiB | 625.00 KiB/s, done.
Resolving deltas: 100% (20639/20639), done.
Set directory ownership
sudo chown -R www-data:www-data /var/www/racktables
Restart nginx service:
sudo systemctl restart nginx
sudo systemctl enable nginx
Start the installation by opening the link
http://racktables.example.com/?module=installer
then follow the installation instructions.
On step one, check proceed. It will do system checks, if all are Green, proceed to step 3
Create secret.php
and set permissions when prompted.
sudo touch '/var/www/racktables/wwwroot/inc/secret.php'
sudo chmod a=rw '/var/www/racktables/wwwroot/inc/secret.php'
Next, configure database
database: racktables
username: racktables
username: StrongPassword
Reset permission of /srv/racktables/wwwroot/inc/secret.php
sudo chown www-data:nogroup /var/www/racktables/wwwroot/inc/secret.php
sudo chmod 440 /var/www/racktables/wwwroot/inc/secret.php
Enable execution of stored functions.
$ sudo mysql -u root -p
SET GLOBAL log_bin_trust_function_creators=1;
\q
On step 6, create admin user password.
Congratulations! RackTables installation is complete. After pressing Proceed you will enter the system. Authenticate with admin username.
You have successfully installed RackTables on Ubuntu 20.04|18.04|16.04 Linux system.