Situatie
Redmine is a free and open-source project management software and issue-tracking tool. It is written using the Ruby on Rails framework and can be integrated with various version control systems. It includes a repository browser and a diff viewer. It can be used to manage projects’ features per project wikis and forums, time tracking, and role-based access control.
Before we start your system must have these packages:
$ sudo apt install wget curl nano software-properties-common dirmngr apt-transport-https gnupg2 ca-certificates lsb-release unzip debian-archive-keyring -y And ake sure everything is updated.
$ sudo apt update && sudo apt upgrade
Step 1 – Configure Firewall
The first step before installing any packages is to configure the firewall to allow HTTP and HTTPS connections. Check the status of the firewall.
$ sudo ufw status
You should see something like the following.
Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6)
Allow HTTP and HTTPs ports. Also, open port 3000 for Redmine.
$ sudo ufw allow http $ sudo ufw allow https $ sudo ufw allow 3000
Check the status again to confirm.
$ sudo ufw status Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere 80/tcp ALLOW Anywhere 443 ALLOW Anywhere 3000 ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) 80/tcp (v6) ALLOW Anywhere (v6) 443 (v6) ALLOW Anywhere (v6) 3000 (v6) ALLOW Anywhere (v6)
Step 2 – Install Apache Server
We will use the Apache webserver to deploy Redmine. Install Apache using the following command.
$ sudo apt install apache2
Check the status of the Apache service.
Step 3 – Install and Configure MySQL Server
We will use the MySQL database to store the data. Debian doesn’t have MySQL anymore in its repositories. So we will be using the official MySQL repository for installation.
Import MySQL GPG key.
$ curl https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 | gpg --dearmor | sudo tee /usr/share/keyrings/mysql.gpg >/dev/null
Create a MySQL repository file.
$ echo "deb [signed-by=/usr/share/keyrings/mysql.gpg arch=amd64] http://repo.mysql.com/apt/debian/ `lsb_release -cs` mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql.list
Update the system repository list.
$ sudo apt update
Install MySQL.
$ sudo apt install mysql-server
You will be prompted to set a root password. Choose a strong password. Next, you will be prompted to choose between the newer MySQL caching_sha2_password
encryption or the older mysql_native_password
encryption. Choose the newer one because Redmine supports it. Select OK to proceed and complete the installation.
Secure MySQL installation.
$ sudo mysql_secure_installation
First, you will be asked for the root password. Enter the password you chose during the installation. Next, you will be asked if you want to set up the Validate Password Plugin, which you can use to test the strength of your MySQL password. Choose Y
to proceed. You will be asked to choose the password validation level in the next step. Choose 2
which is the strongest level and will require your password to be at least eight characters long and include a mix of uppercase, lowercase, numeric and special characters.
Securing the MySQL server deployment. Enter password for user root: VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: Y There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
You will be shown the strength of your root password and will be asked if you want to change it. Enter N
if you don’t want to change and proceed further. If you wish to change it, you can do it now by entering Y
and choosing a password satisfying the requirements above.
Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : N ... skipping.
Press Y
and then ENTER
key for all the following prompts to remove anonymous users and the test database, disable root logins and load the newly set rules.
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Success. Normally, root should only be allowed to connect from ‘localhost’. This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y Success. By default, MySQL comes with a database named ‘test’ that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y – Dropping test database… Success. – Removing privileges on test database… Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y Success.
Enter the MySQL shell. Enter your root password to continue.
$ mysql -u root -p
Create redmine
user. Make sure the password meets the requirements set before.
mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'Your_password2';
Create redmine
database.
mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4;
Grant the user privileges to the redmine
database.
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
Exit the Shell.
mysql> exit
Step 4 – Install Ruby and other requisites
Redmine’s latest version is compatible with Ruby 3.1. Debian ships with Ruby 2.7 so we will need to install the latest version using Ruby Version Manager (RVM).
Install RVM’s GPG key.
$ gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Install RVM.
$ \curl -sSL https://get.rvm.io | bash -s stable
Source the RVM scripts.
$ source ~/.rvm/scripts/rvm
Install Ruby. You can check the latest version from the Ruby website.
Install all the remaining packages required by Redmine.
$ sudo apt install libxml2-dev libxslt1-dev zlib1g-dev imagemagick libmagickwand-dev libmysqlclient-dev apache2-dev build-essential libcurl4-openssl-dev
Visit the Redmine downloads page and check the latest stable version available. At the time of writing this tutorial, the latest available version is 5.0.5.
Use wget
to download Redmine.
$ wget https://www.redmine.org/releases/redmine-5.0.5.tar.gz
You might get the following error while downloading the archive because one of the root certificates on the website has expired.
WARNING: The certificate of ‘www.redmine.org’ is not trusted. WARNING: The certificate of ‘www.redmine.org’ doesn't have a known issuer. WARNING: The certificate of ‘www.redmine.org’ has expired.
If you get this error, run the following command instead to download.
$ wget https://www.redmine.org/releases/redmine-5.0.5.tar.gz --no-check-certificate
Extract and move the files to the /var/www/redmine
directory.
$ tar xfz redmine-5.0.5.tar.gz $ sudo mv redmine-5.0.5 /var/www/redmine
Shift to the /var/www/redmine
directory.
$ cd /var/www/redmine
You will get the following output and a warning about the Ruby version. You can safely ignore that.
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too, you can ignore these warnings with 'rvm rvmrc warning ignore /var/www/redmine/Gemfile'. To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. Unknown ruby interpreter version (do not know how to handle): >=2.5.0,<3.2.0.
Create Redmine configuration files by using the supplied example files.
$ cp config/configuration.yml.example config/configuration.yml $ cp config/database.yml.example config/database.yml $ cp public/dispatch.fcgi.example public/dispatch.fcgi
Open the database.yml
file for editing.
$ nano config/database.yml
Find and configure your database settings under the following section.
production: adapter: mysql2 database: redmine host: localhost username: redmine password: "Your_password2" # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7 encoding: utf8mb4
Save the file by pressing Ctrl + X and entering Y when prompted.
Install bundler for managing ruby gem dependencies.
$ gem install bundler
Set the environment for installing gem dependencies.
$ bundle config set --local without 'development test'
Install the gem dependencies.
$ bundle install
If you face any issues with gem versions, use the following command to restore.
$ gem pristine --all
Add webrick dependency.
$ bundle add webrick
Generate a random secret key to prevent tampering with the cookies for storing session data.
$ bundle exec rake generate_secret_token
Create the database structure.
$ RAILS_ENV=production bundle exec rake db:migrate
Insert the data into the MySQL database.
$ RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data
Create necessary directories and set file permissions.
$ mkdir -p tmp/pdf $ mkdir -p public/plugin_assets $ chown -R $USER:$USER files log tmp public/plugin_assets $ chmod -R 755 /var/www/redmine/
Run the following command to start a Rails server instance.
$ bundle exec rails server -u webrick -e production
Open the URL http://<yourserverIP>:3000/login
to obtain the Redmine Login screen.
Enter the default credentials (admin/admin) to log in. You will be asked to change the password. Next, you will be redirected to the My Account page. Redmine has been installed successfully.
Leave A Comment?