Install Rundeck Server on CentOS 8 - CentLinux

Latest

Monday, 25 May 2020

Install Rundeck Server on CentOS 8

Install Rundeck Server on CentOS 8

In this article, you will learn how to install Rundeck server on CentOS 8 with MySQL as backend database. We will also create our first project by using the same Rundeck server.

 

This Article Provides:

 

What is Rundeck ?:

Rundeck is a free and open-source software used for the automation of administration of servers (Linux, Windows and MacOS) by means of scheduled jobs.

Rundeck is build around the idea to manage all the servers in a computer network from a single administration server. Rundeck provides a web interface for performing these administration tasks.

Rundeck is written in Java programming language and it is released under the Apache Software 2.0 license.

Rundeck is available in Enterprise (Commercial) and Community (Free) editions. Rundeck Enterprise offers more features than Rundeck Community edition but with the license cost.

 

Rundeck Features:

The core features of Rundeck are:

  • Web API
  • Pluggable execution system (SSH by default)
  • Distributed command execution
  • Multi-step workflows
  • Graphical web console for command and job execution
  • Role-based access control policy
  • Job execution with on demand or scheduled runs
  • Command line interface tools
  • History and auditing logs

 

Environment Specification:

We are using a CentOS 8 KVM virtual machine with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - CentOS 8.1
  • Hostname – rundeck-01.centlinux.com
  • IP Address - 192.168.116.206 /24

 

Install Software Upgrades on CentOS 8:

Connect with rundeck-01.centlinux.com as root user by using a SSH tool.

Upgrade all the installed packages in CentOS 8 by using dnf command.

[root@rundeck-01 ~]# dnf update -y
Last metadata expiration check: 0:00:41 ago on Fri 22 May 2020 01:47:06 AM PKT.
Dependencies resolved.
Nothing to do.
Complete!

Our CentOS 8 server is already up-to-date, therefore there is nothing to do for the Linux package manager.

 

Install Java on CentOS 8:

Rundeck is written in Java programming language, therefore it requires JRE (Java Runtime Environment) for execution.

Therefore, we are installing OpenJDK on CentOS 8 from standard yum repositories as follows.

[root@rundeck-01 ~]# dnf install -y java-1.8.0-openjdk
...
Installed:
  java-1.8.0-openjdk-1:1.8.0.252.b09-2.el8_1.x86_64
  gtk2-2.24.32-4.el8.x86_64
  alsa-lib-1.1.9-4.el8.x86_64
  atk-2.28.1-1.el8.x86_64
  cairo-1.15.12-3.el8.x86_64
  copy-jdk-configs-3.7-1.el8.noarch
  fribidi-1.0.4-7.el8_1.x86_64
  gdk-pixbuf2-modules-2.36.12-5.el8.x86_64
  giflib-5.1.4-3.el8.x86_64
  graphite2-1.3.10-10.el8.x86_64
  gtk-update-icon-cache-3.22.30-4.el8.x86_64
  harfbuzz-1.7.5-3.el8.x86_64
  hicolor-icon-theme-0.17-2.el8.noarch
  jasper-libs-2.0.14-4.el8.x86_64
  java-1.8.0-openjdk-headless-1:1.8.0.252.b09-2.el8_1.x86_64
  javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch
  jbigkit-libs-2.1-14.el8.x86_64
  libX11-1.6.7-1.el8.x86_64
  libX11-common-1.6.7-1.el8.noarch
  libXau-1.0.8-13.el8.x86_64
  libXcomposite-0.4.4-14.el8.x86_64
  libXcursor-1.1.15-3.el8.x86_64
  libXdamage-1.1.4-14.el8.x86_64
  libXext-1.3.3-9.el8.x86_64
  libXfixes-5.0.3-7.el8.x86_64
  libXft-2.3.2-10.el8.x86_64
  libXi-1.7.9-7.el8.x86_64
  libXinerama-1.1.4-1.el8.x86_64
  libXrandr-1.5.1-7.el8.x86_64
  libXrender-0.9.10-7.el8.x86_64
  libXtst-1.2.3-7.el8.x86_64
  libdatrie-0.2.9-7.el8.x86_64
  libfontenc-1.1.3-8.el8.x86_64
  libjpeg-turbo-1.5.3-10.el8.x86_64
  libthai-0.1.27-2.el8.x86_64
  libtiff-4.0.9-15.el8.x86_64
  libxcb-1.13-5.el8.x86_64
  lua-5.3.4-11.el8.x86_64
  pango-1.42.4-6.el8.x86_64
  pixman-0.36.0-1.el8.x86_64
  ttmkfdir-3.0.9-54.el8.x86_64
  tzdata-java-2019c-1.el8.noarch
  xorg-x11-font-utils-1:7.5-40.el8.x86_64
  xorg-x11-fonts-Type1-7.5-19.el8.noarch
  avahi-libs-0.7-19.el8.x86_64
  cups-libs-1:2.2.6-28.el8.x86_64
  dejavu-fonts-common-2.35-6.el8.noarch
  dejavu-sans-fonts-2.35-6.el8.noarch
  fontconfig-2.13.1-3.el8.x86_64
  fontpackages-filesystem-1.44-22.el8.noarch
  gdk-pixbuf2-2.36.12-5.el8.x86_64
  lksctp-tools-1.0.18-3.el8.x86_64

Complete!

To verify the installation of Java Runtime Environment, check the version of java command.

[root@rundeck-01 ~]# java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

 

Install Rundeck Yum Repository on CentOS 8:

Rundeck software is distributed via its official yum repository. So, we need to the add the Rundeck yum repository in our CentOS 8 server.

Rundeck provides a RPM package to install yum repository on CentOS 8. Therefore, we are installing it by using the dnf command.

[root@rundeck-01 ~]# dnf install -y http://repo.rundeck.org/latest.rpm
Last metadata expiration check: 0:02:35 ago on Fri 22 May 2020 01:47:06 AM PKT.
latest.rpm                                      3.5 kB/s | 3.0 kB     00:00
Dependencies resolved.
================================================================================
 Package               Architecture    Version      Repository             Size
================================================================================
Installing:
 rundeck-repo          noarch          4-0          @commandline          3.0 k

Transaction Summary
================================================================================
Install  1 Package

Total size: 3.0 k
Installed size: 181
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : rundeck-repo-4-0.noarch                                1/1
  Verifying        : rundeck-repo-4-0.noarch                                1/1

Installed:
  rundeck-repo-4-0.noarch

Complete!

Build cache for Rundeck repo.

[root@rundeck-01 ~]# dnf makecache
CentOS-8 - AppStream                            5.1 kB/s | 4.3 kB     00:00
CentOS-8 - Base                                  10 kB/s | 3.9 kB     00:00
CentOS-8 - Extras                               2.6 kB/s | 1.5 kB     00:00
Rundeck - Release                               485 kB/s | 2.8 MB     00:05
Metadata cache created.

Rundeck yum repository has been installed.

 

Install RunDeck on CentOS 8:

Now, we can install Rundeck software using dnf command.

[root@rundeck-01 ~]# dnf install -y rundeck
Last metadata expiration check: 0:00:28 ago on Fri 22 May 2020 01:53:22 AM PKT.
Dependencies resolved.
================================================================================
 Package     Arch       Version               Repository                   Size
================================================================================
Installing:
 rundeck     noarch     3.2.7.20200515-1      rundeck-release-bintray     195 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 195 M
Installed size: 208 M
Downloading Packages:
rundeck-3.2.7.20200515-1.noarch.rpm             1.1 MB/s | 195 MB     02:58
--------------------------------------------------------------------------------
Total                                           1.1 MB/s | 195 MB     02:58
warning: /var/cache/dnf/rundeck-release-bintray-330204ab97cd1651/packages/rundeck-3.2.7.20200515-1.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID e2d1065b: NOKEY
Rundeck - Release                               3.0 kB/s | 3.0 kB     00:01
Importing GPG key 0xE2D1065B:
 Userid     : "Rundeck Build (automated builds) <build@rundeck.org>"
 Fingerprint: 85E9 DBC7 4FCB 329E DEDA DD2E 9077 0E1B E2D1 065B
 From       : http://rundeck.org/keys/BUILD-GPG-KEY-Rundeck.org.key
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: rundeck-3.2.7.20200515-1.noarch                        1/1
  Preparing        :                                                        1/1
  Running scriptlet: rundeck-3.2.7.20200515-1.noarch                        1/1
  Installing       : rundeck-3.2.7.20200515-1.noarch                        1/1
  Running scriptlet: rundeck-3.2.7.20200515-1.noarch                        1/1
  Verifying        : rundeck-3.2.7.20200515-1.noarch                        1/1

Installed:
  rundeck-3.2.7.20200515-1.noarch

Complete!

Enable and start rundeckd service.

[root@rundeck-01 ~]# systemctl enable --now rundeckd.service
rundeckd.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable rundeckd

Verify the status of rundeckd service.

[root@rundeck-01 ~]# systemctl status rundeckd.service
â rundeckd.service - SYSV: rundeckd, providing rundeckd
   Loaded: loaded (/etc/rc.d/init.d/rundeckd; generated)
   Active: active (running) since Fri 2020-05-22 02:09:40 PKT; 3s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2279 ExecStart=/etc/rc.d/init.d/rundeckd start (code=exited, status=>
 Main PID: 2291 (runuser)
    Tasks: 0 (limit: 5916)
   Memory: 1.9M
   CGroup: /system.slice/rundeckd.service
           ⣠2291 runuser -s /bin/bash -l rundeck -c java -Drundeck.jaaslogin=t>

May 22 02:09:40 rundeck-01.centlinux.com systemd[1]: Starting SYSV: rundeckd, p>
May 22 02:09:40 rundeck-01.centlinux.com rundeckd[2279]: Starting rundeckd: [  >
May 22 02:09:40 rundeck-01.centlinux.com systemd[1]: Started SYSV: rundeckd, pr>

Allow the Rundeck service port: 4440 in CentOS firewall.

[root@rundeck-01 ~]# firewall-cmd --permanent --add-port=4440/tcp
success
[root@rundeck-01 ~]# firewall-cmd --reload
success

If you access the Rundeck web interface from another computer, you may observe some errors. To workaround it, we need to edit Rundeck configuration file.

[root@rundeck-01 ~]# vi /etc/rundeck/rundeck-config.properties

Find and updating the grails.serverURL parameter as follows. Please ensure that the hostname is resolvable across the network, you can use a DNSSEC name server for this purpose.

grails.serverURL=http://rundeck-01.centlinux.com:4440

Restart rundeckd service to reload the process with new configurations.

[root@rundeck-01 ~]# systemctl restart rundeckd.service

 

Configure MySQL Database Backend for Rundeck:

By default, Rundeck uses an H2 database as its repository. But use of H2 database is not recommended for production environments. Therefore, we are configuring MySQL as the database backend for Rundeck.

Connect to the MySQL database server. If you do not have a running MySQL database server, then you need to install MySQL Server on CentOS 8.

[root@rundeck-01 ~]# mysql -u root -p123
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.17-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]>

Create a database for Rundeck server.

MariaDB [(none)]> create database rundeck;
Query OK, 1 row affected (0.002 sec)

Create a database user and grant necessary privileges on the rundeck database.

MariaDB [(none)]> grant ALL on rundeck.* to 'rundeckuser'@'localhost' identified by 'ahmer123';
Query OK, 0 rows affected (0.003 sec)

Reload privilege tables.

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.002 sec)

Exit from MySQL shell.

MariaDB [(none)]> exit
Bye

Now edit Rundeck configuration file.

[root@rundeck-01 ~]# vi /etc/rundeck/rundeck-config.properties

Locate and update following parameters in this file. (If you do not find any parameter,  then add it there)

dataSource.url = jdbc:mysql://mariadb-01.centlinux.com/rundeck?autoReconnect=true
dataSource.username=rundeckuser
dataSource.password=ahmer123
dataSource.driverClassName=com.mysql.jdbc.Driver

Restart the rundeckd service to apply changes.

[root@rundeck-01 ~]# systemctl restart rundeckd.service

If you have difficulty starting the rundeckd service, then you should look for the errors in the Rundeck log files located within /var/log/rundeck/ directory.

 

Create your First Rundeck Project:

Browse URL http://rundeck-01.centlinux.com:4440 in a browser such as Google Chrome.

01-install-rundeck-centos-8-login

Login to Rundeck web interface by using default username: admin and password: admin.

02-install-rundeck-centos-8-welcome

Click on the New Project + button to create a new project.

03-install-rundeck-centos-8-create-new-project

Provide the necessary details about the Project and click on Create.

04-install-rundeck-centos-8-edit-nodes

Our project has been created and now we are at the Edit Nodes page.

You may observe that a node "Local" has already been added in Rundeck inventory. It is our Rundeck server machine, which is automatically added when we created this project.

We can also add more nodes from this page. However, our "Local" node is quite enough to demonstrate the execution of commands.

Click on the Commands at the left side menu.

05-install-rundeck-centos-8-execute-commands

We have executed a command on the "Local" node. We can execute the same command on others nodes that are under management of the Rundeck server.

Similarly, we can also create some jobs that will execute a set of commands on a group of nodes at a scheduled time.

Our Rundeck server has been installed and configured successfully. For information on usage of Rundeck web interface, you can refer to Rundeck Documentation.

No comments:

Post a Comment