A tutorial on installing and configuring Redmine on CentOS 8

Redmine is a free and open source project management and issue tracking application. Redmine is a cross-platform and shared database app that’s built on the Ruby on Rails framework.

Redmine includes support for multiple projects, wiki, issue tracking system, forums, calendars, email notifications, and more.

In this tutorial, we will discuss how to install and configure the latest version of Redmine on CentOS 8. Using MariaDB as the backend database and Passenger + Apache as the Ruby application server.

precondition

Make sure you meet the following prerequisites before starting this tutorial:

  • Get a domain name that points to the server’s public IP address. we will use example.com.
  • Log in as a user with sudo privileges.

Create a MysSQL database

Redmine supports MySQL / MariaDB, Microsoft SQL Server, SQLite 3, and PostgreSQL. For this tutorial, we will be using MariaDB as the backend database.

If MariaDB or MySQL is not already installed on your CentOS server, you can install it using these instructions.

Start by logging into the MySQL console by typing:

sudo mysql

Run the following SQL statement to create a new database, new user, and grant access to the user we just created.

CREATE DATABASE redmine CHARACTER SET utf8;
GRANT ALL ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'GantiDenganPassword';

Do not forget to replace GantiDenganPassword With a password of your choice. When done, exit the MySQL shell:

EXIT;

Install Passenger, Apache, and Ruby

Passenger is a fast and lightweight web application server for Ruby, Node.js and Python that can be integrated with Apache and Nginx. In this tutorial, we will be installing Passenger as the Apache module.

Activate the EPEL repository and required packages:

sudo dnf install epel-release
sudo dnf config-manager --enable epel

Once the repository is enabled, update the package list and install Ruby, Apache, and Passenger:

sudo dnf install httpd mod_passenger passenger passenger-devel ruby

Start the Apache service and enable it to start at boot:

sudo systemctl enable httpd --now

Create a new user system

Create new users and groups, using Home directories /opt/redmine Which will run the Redmine instance:

sudo useradd -m -U -r -d /opt/redmine redmine

Add a user apache For the group redmine And change directory permissions /opt/redmine For Apache to access it:

sudo usermod -a -G redmine apache
sudo chmod 750 /opt/redmine

Install Redmine

At the time of writing, the most recent stable version of Redmine is the most recent 4.1.0. Before proceeding to the next section, feel free to check the latest version of redmine to see if a new version is available.

Install the GCC compiler and the necessary libraries to build Redmine:

sudo dnf group install "Development Tools"
sudo dnf install zlib-devel curl-devel openssl-devel mariadb-devel ruby-devel

Make sure you are logged in as the user redmine Before proceeding with this section, you can verify the device using the commands whoami

sudo su - redmine

1. Download Redmine

Download the Redmine archive with the following curl command:

curl -L http://www.redmine.org/releases/redmine-4.1.0.tar.gz -o redmine.tar.gz

After the download completes, extract the archive:

tar -xvf redmine.tar.gz

2. Create a Redmine database

Copy the sample configuration file (.exampleRedmine by typing the command:

cp /opt/redmine/redmine-4.1.0/config/database.yml.example /opt/redmine/redmine-4.1.0/config/database.yml

Open the sample Redmine configuration file with a text editor in the Linux terminal by typing:

nano /opt/redmine/redmine-4.1.0/config/database.yml

Search for sections production And enter the MySQL database and user information we created earlier:

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "GantiDenganPassword"
  encoding: utf8mb4

When done, save the file and exit the editor.

3. Install Ruby Dependencies

Change to the directory redmine-4.1.0 And install the package and other Ruby dependencies:

cd ~/redmine-4.1.0
gem install bundler --no-rdoc --no-ri
bundle install --without development test postgresql sqlite --path vendor/bundle

4. Create keys and migrate databases

Run the following commands to create keys and migrate the database:

bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate

Apache configuration for Redmine

If you are still logged in as a user redmine, Please return to the regular user with the command exit On the station.

Next step we will create Apache vhost file for redmine, and replace it example.com With your domain name:

sudo nano /etc/httpd/conf.d/example.com.conf

Copy and paste the following composition

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /opt/redmine/redmine-4.1.0/public

    <Directory /opt/redmine/redmine-4.1.0/public>
        Options Indexes ExecCGI FollowSymLinks
        Require all granted
        AllowOverride all
    </Directory>

    ErrorLog /var/log/httpd/example.com-error.log
    CustomLog /var/log/httpd/example.com-access.log combined
</VirtualHost>

Restart the Apache service by typing the following command:

sudo systemctl restart httpd

Apache configuration with SSL

If you do not have a trusted SSL certificate for your domain, you can create a Let’s Encrypt SSL certificate by following these instructions.

After creating the certificate, edit the Apache configuration as follows:

sudo nano /etc/httpd/conf.d/example.com.conf
<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com

  Redirect permanent / https://example.com/
</VirtualHost>

<VirtualHost *:443>
  ServerName example.com
  ServerAlias www.example.com

  Protocols h2 http:/1.1

  <If "%{HTTP_HOST} == 'www.example.com'">
    Redirect permanent / https://example.com/
  </If>

  DocumentRoot /opt/redmine/redmine-4.1.0/public
  ErrorLog /var/log/httpd/example.com-error.log
  CustomLog /var/log/httpd/example.com-access.log combined

  SSLEngine On
  SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

  <Directory /opt/redmine/redmine-4.1.0/public>
    Options Indexes ExecCGI FollowSymLinks
    Require all granted
    AllowOverride all
  </Directory>

</VirtualHost>

Don’t forget to replace example.com with your Redmine domain and set the correct path for the SSL Certificate file. All HTTP requests will be directed to HTTPS.

Reach out to Redmine

Open a browser and type in your domain, if the installation is successful, a screen similar to the following screenshots will appear:

The default login credentials for Redmine are:

  • Username: admin
  • Password: admin

When logging in for the first time, you will be prompted to change your password as shown below:

After changing the password, you will be directed to the user account page.

If you cannot access the page, it is possible that your firewall is blocking the Apache port.

Use the following command to open the required ports:

sudo firewall-cmd --permanent --zone=public --add-port=443/tcp
sudo firewall-cmd --permanent --zone=public --add-port=80/tcp
sudo firewall-cmd --reload

Conclusion

I have successfully installed Redmine on a CentOS system. You can check Redmine documentation and learn more about how to configure and use Redmine.

.

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *