Guides 11792 Published by

This guide walks through setting up RackTable on Ubuntu or Debian servers, starting with updating the system and installing required packages such as Apache, PHP, MariaDB, and essential PHP extensions. It then covers securing MariaDB, creating a dedicated database user, cloning the RackTable repository into the web root, and configuring Apache with a virtual host that uses mod_rewrite for clean URLs. After setting environment variables for database credentials, the tutorial shows how to run the web installer wizard, create an admin account, and optionally harden the installation by enabling HTTPS and tightening firewall rules. Finally it offers troubleshooting tips like ensuring php‑xml is installed on Debian 12 and encourages testing by logging in, adding racks, and verifying inventory updates.



Install RackTable on Ubuntu or Debian Servers – A Hands‑On Guide

If you’re running a data center, home lab, or even just want to keep track of your spare parts, RackTable gives you that neat web interface for asset management. Below is a straight‑forward path that skips the “I don’t know what I’m doing” vibe and gets you up and running on Ubuntu 20.04/22.04 or Debian 11/12 in under an hour.

Why go through these extra steps?

RackTable ships with a set of PHP extensions, a database server, and a few helper packages that aren’t part of the default Ubuntu/Debian install. Skipping those will leave you staring at “Class not found” errors or a blank login screen. Trust me: I once tried to install it on Debian 12 without adding php-xml, and the whole thing just hung waiting for an XML parser.

1. Update your system
sudo apt-get update && sudo apt-get upgrade -y

> Keeps the OS, libraries, and security patches current so you avoid weird dependency mismatches later on.

2. Install required packages
sudo apt-get install -y \
    apache2 \
    php libapache2-mod-php \
    php-mysql php-xml php-gd php-curl \
    mariadb-server \
    git unzip
  • apache2 – The web server RackTable expects.
  • PHP packages – Each extension powers a feature: MySQL for the database, XML for config parsing, GD for image handling, CURL for API calls.
  • mariadb-server – A drop‑in replacement for MySQL that ships pre‑compiled on Debian/Ubuntu.
  • git, unzip – Handy for fetching RackTable and unpacking it later.
3. Secure MariaDB (quick mode)
sudo mysql_secure_installation

During the prompt:

  • Set a root password you’ll remember.
  • Answer Y to remove anonymous users, disallow remote root login, delete the test database, and reload privilege tables.

> You’re opening a web app on your network; a default MariaDB install is like leaving your front door unlocked.

4. Create a RackTable database
sudo mysql -u root -p

Inside MySQL:

CREATE DATABASE racktable CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON racktable.* TO 'rackuser'@'localhost' IDENTIFIED BY 'StrongPassword123!';
FLUSH PRIVILEGES;
EXIT;

> The app needs its own database user with the correct charset. utf8mb4 covers emoji and other modern symbols.

5. Pull RackTable from Git
cd /var/www/html
sudo git clone https://github.com/racktables/racktables.git
sudo chown -R www-data:www-data racktables

> The official repo contains the latest stable release and a README with environment variables.

6. Configure Apache for RackTable

Create /etc/apache2/sites-available/racktable.conf:

<VirtualHost *:80>
    ServerName rack.example.com
    DocumentRoot /var/www/html/racktables/public

    <Directory /var/www/html/racktables/public>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/racktable_error.log
    CustomLog ${APACHE_LOG_DIR}/racktable_access.log combined
</VirtualHost>

Enable the site and mod_rewrite:

sudo a2ensite racktable.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

> RackTable relies on clean URLs; without RewriteEngine you’ll hit 404s after login.

7. Set up environment variables

Create /etc/apache2/envvars.d/racktable.env (or use envsubst later). Example:

export RACKTABLE_DB_HOST=localhost
export RACKTABLE_DB_USER=rackuser
export RACKTABLE_DB_PASS=StrongPassword123!
export RACKTABLE_DB_NAME=racktable

Then add to Apache’s environment:

echo 'SetEnvIf Host ^(.*)$ HTTP_HOST=$1' | sudo tee /etc/apache2/conf-available/racktable.env
sudo a2enconf racktable.env
sudo systemctl reload apache2

> RackTable reads these variables on boot. If you forget, the installer page will complain about missing DB credentials.

8. Run the web installer

Open your browser to http://rack.example.com (or the IP of your server). You’ll see the “RackTable Setup” wizard:

1. Check prerequisites – It verifies PHP extensions, database connectivity, and file permissions.

2. Database configuration – Confirm the values you set in step 4.

3. Create admin user – Pick a username/email and a strong password.

When everything passes, RackTable will create the schema and seed it with sample data. You can log in immediately.

9. Harden the installation (optional)
  • Move Apache’s document root to /srv/racktable if you prefer.
  • Install certbot and set up HTTPS:

  sudo apt-get install -y certbot python3-certbot-apache
  sudo certbot --apache
  • Add a firewall rule (UFW) to expose only ports 80/443:
  sudo ufw allow 'Apache Full'

> Real deployments don’t run unencrypted traffic. A quick SSL setup keeps the data safe in transit.

10. Test it out

Log into RackTable, add a rack, populate some devices, and check that the inventory page updates without lag. If you hit any hiccups—like a “Could not connect to database” message—double‑check your RACKTABLE_DB_* values in /etc/apache2/envvars.d/racktable.env.

Common pitfall I’ve seen

When people install RackTable on Debian 12, the default PHP version is 8.1. If they forget to enable php-xml, the installer will stall with “XML parsing error.” Just run sudo apt-get install php-xml and restart Apache.

That’s it. You’ve got a fully functional RackTable instance running on your server. Now you can start cataloguing cables, servers, or even your collection of vintage gaming consoles.