How to Install Redmine 4.1 on Ubuntu 19.04/20.04
Dependencies
sudo apt install build-essential libmysqlclient-dev libmysqlclient-dev imagemagick libmagickwand-dev libmagickcore-devInstall Apache2 & Passenger
Install PGP key and add HTTPS support for APT
sudo apt-get install -y dirmngr gnupgsudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificatesAdd APT repository
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger focal main > /etc/apt/sources.list.d/passenger.list'sudo apt-get updateInstall Passenger + Apache module
sudo apt-get install apache2 apache2-dev libapache2-mod-passengerInstall MySQL
sudo apt-get install mysql-server mysql-client sudo mysql_secure_installationCreate Database
sudo mysqlCREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmineuser'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON redmine.* TO 'redmineuser'@'%';
FLUSH PRIVILEGES;
EXIT;Download Redmine 4.0 Stable
cd /optsudo git clone -b 4.1-stable --single-branch https://github.com/redmine/redmine.gitcd /opt/redmineSetup Redmine DB Configuration
sudo cp /opt/redmine/config/database.yml.example /opt/redmine/config/database.ymlsudo nano /opt/redmine/config/database.ymlproduction:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: “{change-with-strong-password}”
encoding: utf8Install Ruby
sudo apt-add-repository ppa:brightbox/ruby-ngsudo apt-get updateInstall the packages:
sudo apt-get install ruby2.6 ruby2.6-devInstall Gems
sudo gem install bundlercd /opt/redminesudo bundle config set --local without 'development test postgresql sqlite'sudo bundle installGenerate Keys and Migrate the Database
Run the following command to generate keys and migrate the database:
cd /opt/redmine/sudo bundle exec rake generate_secret_tokensudo RAILS_ENV=production bundle exec rake db:migrateMake changes to web configuration
sudo nano /etc/apache2/mods-available/passenger.conf<IfModule mod_passenger.c>
PassengerDefaultUser www-data
PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
PassengerDefaultRuby /usr/bin/ruby
</IfModule>sudo nano /etc/apache2/sites-available/redmine.conf<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html/redmine
PassengerAppRoot /opt/redmine
<Directory /var/www/html/redmine>
RailsBaseURI /redmine
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>Create Link and set folder permission
sudo ln -s /opt/redmine/public /var/www/html/redminesudo chown -R www-data:www-data /opt/redminesudo chown -R www-data:www-data /var/www/html/redmineActivate Redmine
sudo a2ensite redmine sudo a2enmod passenger sudo a2enmod rewrite sudo systemctl restart apache2- Go to http://example.com ( replace example.com with your server address)
- Log in with admin/admin and set your new password.