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.
Lets start by updating everything by using the below
apt update -y && apt upgrade -y
Up next we will add the packages and the gpg key for rundeck. These details are retrieved 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
Once the above has been executed, we can now go ahead and apt update and install rundeck and other requirements
apt update
apt install rundeck postgresql openjdk-11-jre
Lets prepare postgres for rundeck. First we switch to the postgres user, get to the postgres terminal frontend to create the database, user and assign its privileges. Replace the password below with a secure password.
su postgres
psql
create database rundeck;
create user rundeckuser with password 'passwordForRundeck';
grant ALL privileges on database rundeck to rundeckuser;
The rundeck config found in /etc/rundeck/rundeck-config.properties needs to be updated to make use of the newly set up postgres database so we need to comment out the dataSource.dbCreate and dataSource.url, and add the following
nano /etc/rundeck/rundeck-config.properties
Comment out:
dataSource.dbCreate
dataSource.url
Add the below lines:
dataSource.driverClassName = org.postgresql.Driver
dataSource.url = jdbc:postgresql://localhost/rundeck
dataSource.username = rundeckuser
dataSource.password = passwordForRundeck
Replace localhost with the correct server address:
grails.serverURL=http://localhost:4440
The systemd configuration might require a reload in order to recognize the newly installed rundek. this can be done by executing the first line, then start and enable rundeck to load on reboot.
systemctl daemon-reload
systemctl start rundeckd
systemctl status rundeckd
systemctl enable rundeckd
Once these are started and set up, you will be able to access the rundeck web GUI by browsing to http://IPADDRESS:4440 on the browser. Replace IPADDRESS with the servers ip address.