(Last Updated On: June 6, 2019)

Ralph is an Open Source, full-featured Asset Management, DCIM and CMDB system for data centers and back offices. It is released under Apache v2.0 License. Ralph allows you to keep track of assets purchases and manage the whole assets life cyle, both in the office and Data Center.

We had earlier discussed similar open source tools that can help with Asset Management. The installation guides are below.

Install i-doit Asset Management Tool on Ubuntu 18.04

How to Install GLPI on Ubuntu 18.04 LTS

How to Install OCS Inventory Server on Ubuntu 18.04

This guide will walk you through the installation and configuration of Ralph CMDB / Asset Management system on Ubuntu 18.04. We will start with the addition of package repositories, then installation and finally how you can tune, tweak and optimize the installation.

Step 1: Update System

We always work on an up-to-date system. This is recommended if you’re working on a fresh installation of Ubuntu 18.04 system.

sudo apt update
sudo apt -y upgrade

Step 2: Add Ralph repositories

Now that our system is updated, let’s proceed to add repositories which contains the packages that need to be installed. Run the commands below as user with sudo privileges.

sudo apt-key adv --keyserver  hkp://keyserver.ubuntu.com:80 --recv-keys E2D0F3764B54797F
sudo sh -c "echo 'deb https://dl.bintray.com/allegro/debng bionic main' >  /etc/apt/sources.list.d/ralph.list"

Step 3: Install Ralph on Ubuntu 18.04

After adding the repository, update your system and install Ralph with mysql database packages.

sudo apt update
sudo apt install mysql-server nginx ralph-core

When prompted, input Ralph database settings or select use default settings which should work just fine.

Database settings will be written to /etc/ralph/conf.d/database.conf. You can review them later. If you decide to update Database access information such as password, update them on the file.

Step 4: Database & Ralph configuration

Access database server console.

$ sudo mysql -u root -p

If no password, just hit <Enter> when prompted for password. Then create database and user for Ralph.

CREATE DATABASE ralph_ng;
CREATE USER 'ralph_ng'@'localhost' IDENTIFIED BY 'ralph_ng';
GRANT ALL PRIVILEGES ON ralph_ng.* TO 'ralph_ng'@'localhost';
FLUSH PRIVILEGES;
QUIT;

If you use separate password, update it on the /etc/ralph/conf.d/database.conf file.

Test database access.

$ mysql -u ralph_ng -pralph_ng
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.7.26-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

Create the database schema

sudo ralphctl migrate

Create Ralph superuser

$ sudo ralphctl createsuperuser
Username: admin
Email address: [email protected]
Password: <InputStrongPassword>
Password (again): <ConfirmPassword>
Superuser created successfully.

Optionally populate the database with some data:

$ sudo ralphctl demodata
Generating Users and Groups
Generating Back Office assets
Generating Data Center assets
Generating Supports
Generating Licences
Generating Transitions
done

When done, starting Ralph service.

sudo ralphctl sitetree_resync_apps
sudo systemctl enable ralph.service
sudo systemctl start ralph.service

Confirm service status – should say “running“.

$ systemctl status ralph.service
 ● ralph.service - Ralph service
    Loaded: loaded (/lib/systemd/system/ralph.service; enabled; vendor preset: enabled)
    Active: active (running) since Thu 2019-06-06 10:38:16 CEST; 1min 9s ago
  Main PID: 17424 (gunicorn)
     Tasks: 3 (limit: 2299)
    CGroup: /system.slice/ralph.service
            ├─17424 /opt/ralph/ralph-core/bin/python /opt/ralph/ralph-core/bin/gunicorn -c /var/local/ralph/gunicorn.ini ralph.wsgi
            ├─17442 /opt/ralph/ralph-core/bin/python /opt/ralph/ralph-core/bin/gunicorn -c /var/local/ralph/gunicorn.ini ralph.wsgi
            └─17444 /opt/ralph/ralph-core/bin/python /opt/ralph/ralph-core/bin/gunicorn -c /var/local/ralph/gunicorn.ini ralph.wsgi
Jun 06 10:38:16 ralph systemd[1]: Started Ralph service.

The service should be listening on port 8000.

$ ss -tunelp | grep 8000
tcp    LISTEN   0        128               0.0.0.0:8000          0.0.0.0:*       users:(("gunicorn",pid=17444,fd=7),("gunicorn",pid=17442,fd=7),("gunicorn",pid=17424,fd=7)) uid:112 ino:44358 sk:a <->

Step 5: Configure Nginx proxy

It is recommended to access Ralph dashboard through an Nginx proxy where SSL can be terminated.

Create a new Nginx configuration file.

sudo nano /etc/nginx/conf.d/ralph.conf

Paste below data to the file.

server {

    listen 80;
    client_max_body_size 512M;
    server_name ralph.example.com;
    proxy_set_header Connection "";
    proxy_http_version 1.1;
    proxy_connect_timeout  300;
    proxy_read_timeout 300;

    access_log /var/log/nginx/ralph-access.log;
    error_log /var/log/nginx/ralph-error.log;

    location /static {
        alias /usr/share/ralph/static;
        access_log        off;
        log_not_found     off;
        expires 1M;
    }

    #location /media {
    #    alias /var/local/ralph/media;
    #    add_header Content-disposition "attachment";
    #}

    location / {
        proxy_pass http://127.0.0.1:8000;
        include /etc/nginx/uwsgi_params;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Replace ralph.example.com with your domain name for Ralph or server’s hostname.

After that, restart nginx:

sudo systemctl restart nginx.service

Access Ralph dashboard on http://hostname

Login with created admin user account.

You should see the dashboard with sample data imported earlier.

Log files – For Troubleshooting

The locations for all log files related to Ralph are:

  • /var/log/ralph/ralph.log
  • /var/log/ralph/gunicorn.error.log
  • /var/log/ralph/gunicorn.access.log
  • /var/log/nginx/ralph-error.log
  • /var/log/nginx/ralph-access.log

If something goes wrong, you can take a peek at the log files.

Visit Ralph Documentation page for more reading.