Rundeck with Postgres

I have prepared the below to outline the process to install Rundeck with Postgres as a backend. You can also find a YouTube video at the bottom which takes you through the whole process. For this demo, I will be using an Ubuntu 22 server instance.

1. Update the system

Start by making sure everything is up to date:

apt update -y && apt upgrade -y

2. Add the Rundeck repository

Add the packages and the GPG key for Rundeck. These details are from the official Rundeck page: https://docs.rundeck.com/docs/administration/install/installing-rundeck.html

echo "deb https://packages.rundeck.com/pagerduty/rundeck/any/ any main
deb-src https://packages.rundeck.com/pagerduty/rundeck/any/ any main" > /etc/apt/sources.list.d/rundeck.list

wget -qO- https://packages.rundeck.com/pagerduty/rundeck/gpgkey | gpg --dearmor > /etc/apt/trusted.gpg.d/rundeck.gpg

3. Install Rundeck and dependencies

apt update
apt install rundeck postgresql openjdk-11-jre

4. Prepare the Postgres database

Switch to the postgres user and open the Postgres terminal to create the database, user, and assign privileges. Replace the password with something secure.

su postgres
psql
create database rundeck;
create user rundeckuser with password 'passwordForRundeck';
grant ALL privileges on database rundeck to rundeckuser;

5. Update the Rundeck config

The config file at /etc/rundeck/rundeck-config.properties needs to be updated to point at the new Postgres database. Comment out dataSource.dbCreate and dataSource.url, then add the lines below.

nano /etc/rundeck/rundeck-config.properties

Comment out these two lines:

#dataSource.dbCreate = update
#dataSource.url = jdbc:h2:file:/var/lib/rundeck/data/rundeckdb;MVCC=true

Add the following, replacing passwordForRundeck with your actual password:

dataSource.driverClassName = org.postgresql.Driver
dataSource.url = jdbc:postgresql://localhost/rundeck
dataSource.username = rundeckuser
dataSource.password = passwordForRundeck

Also update the server URL — replace localhost with your server's IP or hostname:

grails.serverURL=http://localhost:4440

6. Start and enable Rundeck

The systemd configuration may need a reload to recognise the newly installed service. Then start and enable it to run on reboot:

systemctl daemon-reload
systemctl start rundeckd
systemctl status rundeckd
systemctl enable rundeckd

7. Access the web interface

Once running, open a browser and go to http://IPADDRESS:4440, replacing IPADDRESS with your server's IP address.


Full video walkthrough: https://youtu.be/QrEbduacbjE