Deploying Nagios
Setup Details |
App Server: Redmine Network : 172.16.141.0/24 IP Address : 172.16.141.101 Subnet Mask: 255.255.255.0 Gateway: 172.16.141.1 DNS: 8.8.8.8 sudo user: kedar Container: db1 Network: 172.16.141.0/24 IP Address : 172.16.141.97 Subnet Mask: 255.255.255.0 Gateway: 172.16.141.1 DNS: 8.8.8.8 sudo user: kedar |
Before you proceed
The domain used here is networked.com. This is used only for demonstration and required dns entries for this domain have already been done to the host file to make the domain and any subdomains reachable on the network. This domain may be owned by someone else and we do not know who it is and we are not linked to them. Redmine configured for this domain in this 'howto' is not reachable on public IP. If you try networked.com and find any material that may be suitable / unsuitable to you, we are not the owners of the same and we are not responsible for the content.
Introduction
- Installation of Redmine with FQDN as: https://redmine.networked.com
- Apache2 web server will be used and the root folder will be: /opt/redmine/
- Postgre SQL server will be used as a database server
- The site will be hosted on port number: 443
- Self signed SSL certificates will be used.
- Host entry to ensure this website is reachable is done in the user PC, in absence of a DNS
Pre-requisites installation
- Log into the appserver / webserver (ssh kedar@172.16.141.101) and run the below commands
sudo apt-get update && sudo apt-get upgrade -y sudo apt install -y apache2 ruby ruby-dev build-essential libapache2-mod-passenger nano openssl postgresql-client git
- If you are using MySQL (not recommended as some plugins for Redmine need PostgreSQL), replace postgresql-client with libmysqlclient-dev and mysql-client
DB Server Installation & DB Creation
PostgreSQL Installation
- Login to postgresql server - ssh kedar@172.16.141.97 and run the following commands
$ sudo apt install -y postgresql Check if the service is running $ sudo systemctl status postgresql Set a password for the default postgresql user $ sudo -u postgres psql postgres=# ALTER USER postgres WITH ENCRYPTED PASSWORD '123456'; postgres=# \q
- This will exit to $ prompt
Enable Remote access of the DB
- At the end of the file /etc/postgresql/16/main/pg_hba.conf add
$ sudo nano /etc/postgresql/16/main/pg_hba.conf host all all 0.0.0.0/0 md5
- Edit the following file and make relevant change
$ sudo nano /etc/postgresql/16/main/postgresql.conf # - Connection Settings - ... listen_addresses = '*' (you can either add * to allow any remote server to connect or you can specify an IP address) ...
Redmine Database Creation
$ sudo -u postgres psql postgres=# CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD '123456' NOINHERIT VALID UNTIL 'infinity'; postgres=# CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine; postgres=# \q
Create self signed certificates
- Log into the appserver / webserver and run the below commands
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/redmine.key -out /etc/ssl/certs/redmine.crt
- You can use a commercial self signed certificate if you have one or can also use free Lets Encrypt certificate
- Using Lets Encrypt certificates is out of scope of this howto
Redmine Installation
- This has three steps
- Download Redmine
- Make changes to the configuration file
- Install Redmine
Download Redmine
- Login to the Redmine app server: ssh kedar@172.16.141.101
$ cd /opt /opt$ sudo wget https://www.redmine.org/releases/redmine-5.1.3.tar.gz /opt$ sudo tar -xvzf redmine-5.1.3.tar.gz /opt$ sudo ln -s redmine-5.1.3 redmine /opt$ ls -l It will look like this lrwxrwxrwx 1 root root 13 Oct 25 07:05 redmine -> redmine-5.1.3 drwxr-xr-x 17 root root 4096 Oct 25 07:18 redmine-5.1.3 -rw-r--r-- 1 root root 3251273 Jun 12 00:45 redmine-5.1.3.tar.gz
- After all the configurations are done and installation is done, ownership of Redmine folder will be with the apache web server user www-data
Make Configuration Changes
- Make changes to the database yml file
$ cd /opt/redmine /opt/redmine$ sudo cp config/database.yml.example config/database.yml
- The file should look like this
production: adapter: postgresql database: redmine host: 172.16.141.97 username: redmine password: "123456" encoding: utf8 #variables: # Recommended `transaction_isolation` for MySQL to avoid concurrency issues is # `READ-COMMITTED`. # In case of MySQL lower than 8, the variable name is `tx_isolation`. # See https://www.redmine.org/projects/redmine/wiki/MySQL_configuration #transaction_isolation: "read committed"
- The variables section as shown above needs to be completely commented out to avoid any errors while installing. Common errors like 'Undefined method `stringify_keys' will come up if the variables section is not completely commented out.
- Don't make any change to 'Development' and 'Test' section of the file right now. Configuring these sections is out of scope of this howto
Install Redmine
- Before you begin, check if the postgresql server is reachable from the Redmine server
$ psql -U redmine -p 5432 -h 172.16.141.97 On entering password, one will get the redmine prompt confirming that the user id & password is correct and Redmine server is able to connect to the PostgreSQL server. redmine=>
- From the Redmine directory run the following commands one after the other. Since Ubuntu 22.04, all these commands will have to be run using sudo. While running the commands using sudo, there will be warnings saying, do not run these commands using root or privileged user -ignore all of the warnings
$ cd /opt/redmine /opt/redmine$ sudo gem install bundler /opt/redmine$ sudo bundle install /opt/redmine$ sudo bundle exec rake generate_secret_token /opt/redmine$ sudo RAILS_ENV=production bundle exec rake db:migrate /opt/redmine$ sudo RAILS_ENV=production bundle exec rake redmine:load_default_data
- If there are no errors, redmine installation is complete and now Webserver needs to be configured to serve Redmine to users
Configure Apache webserver
- The root folder needs to have the owner as the local user (not root) which in this case is kedar. Hence set the permissions on the snipe folder first before installing the dependencies
sudo chown -R www-data:www-data /opt/redmine/
- Create virtual host for the website in /etc/apache2/sites-available/
cd /etc/apache2/sites-available sudo a2dissite 000-default.conf sudo a2dissite default-ssl.conf sudo nano redmine.conf
- Add the below configuration in the snipe.conf file
<VirtualHost *:443> ServerName redmine.networked.com ServerAlias redmine ServerAdmin fakeid@gmail.com DocumentRoot /opt/Redmine/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/ssl/certs/redmine.crt SSLCertificateKeyFile /etc/ssl/private/redmine.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> </VirtualHost>
- Enable the site and Restart apache service
sudo a2ensite redmine.conf sudo a2enmod rewrite ssl sudo sysemctl restart apache2
Finalize the installation
- Using a browser navigate to https://redmine.networked.com
- Accept the self-signed certificate error
- Enter the default user id & password as : admin (uid & password are admin)
- It will ask you to change the password for the default admin user
- Finally Login using the user created
- Explore various plugins
Conclusion
- We have a working Redmine instance hosted with an apache web server and postgresql server.
- Explore various plugins. Some common plugins include but not limited to are
- Issue Charts Plugin
- Redmine Agile Plugin
- Redmine Checklist Plugin
- Redmine Email fetcher plugin
- Redmine Helpdesk Plugin
- Redmine issue history plugin
- Redmine Mentions
- Redmine OAuth plugin (Supports Google, Azure AD, Okta and many more)
- Simple Author Change plugin
- Sidebar hide plugin
- There are commercial versions of Redmine developed by third party solution providers with a lot of features. One such example is RedmineUP - https://www.redmineup.com/pages/plugins/helpdesk
References
- Redmine Website - https://redmine.org
- Download Redmine - https://www.redmine.org/projects/redmine/wiki/Download
- Install Redmine - https://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_50x_on_Ubuntu_2004_with_Apache2
- How Tos - https://www.redmine.org/projects/redmine/wiki/HowTos
- Configure PostgreSQL for Redmine - https://www.redmine.org/projects/redmine/wiki/RedmineInstall
- Explore Plugins - https://www.redmine.org/plugins
- Redmine Themes - https://www.redmine.org/projects/redmine/wiki/Theme_List
- User Guide - https://www.redmine.org/projects/redmine/wiki/Guide