Project

General

Profile

HowTo Install Redmine 50x on Ubuntu 2004 with Apache2 » History » Revision 6

Revision 5 (Marc Morocutti, 2022-06-07 15:09) → Revision 6/11 (Marc Morocutti, 2022-06-07 15:24)

h1. HowTo Install Redmine 5.0.x on Ubuntu 20.04 with Apache2 

 h2. Installing dependencies 

 <pre> 
 # update & upgrade  
 sudo apt-get update && sudo apt-get upgrade -y 

 # install required packages 
 sudo apt install -y apache2 ruby ruby-dev build-essential libapache2-mod-passenger libmysqlclient-dev 

 # if you want to install mysql server locally 
 sudo apt install -y mysql-server 
 </pre>  

 h2. Download & Extract Redmine 

 Go grab the latest version from [[Download|here]]. For this example it will be 5.0.1 
 <pre> 
 # download and extract 
 cd 
 wget https://redmine.org/releases/redmine-5.0.1.tar.gz 
 cd /opt 
 sudo tar -xvzf ~/redmine-5.0.1.tar.gz 

 # symlink to remove version reference 
 sudo ln -s redmine-5.0.1 redmine 
 </pre> 

 h2. Configure database 

 Create a database and create a user for redmine. Example for localhost installation below: 
 <pre> 
 sudo mysql 

 mysql>  
 CREATE DATABASE redmine CHARACTER SET utf8mb4; 
 mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'secretPassword'; 
 mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost'; 
 mysql> FLUSH PRIVILEGES; 
 </pre> 

 h2. Edit database configuration file 

 <pre> 
 # copy the example file 
 cd /opt/redmine 
 cp config/database.yml.example config/database.yml 

 # edit config file with your editor of choice (mine is vi) 
 vi config/database.yml 
 </pre> 

 Replace or update the production: block with your configuration. One example based on the mysql config above. 

 <pre> 
 production: 
   adapter: mysql2 
   database: redmine 
   host: localhost 
   username: redmine 
   password: "secretPassword" 
   # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7 
   encoding: utf8mb4 
 </pre> 

 h2. Run Redmine scripts 

 # generate secret token 
 bundle exec rake generate_secret_token 

 # migrate database 
 RAILS_ENV=production bundle exec rake db:migrate 

 # load default data 
 RAILS_ENV=production bundle exec rake redmine:load_default_data 

 h2. Configure Apache 

 Create an apache configuration file in /etc/apache2/sites-available (e.g. redmine.conf) with the following content: 
 <pre> 
 <VirtualHost *:80> 
	 ServerName redmine.example.com # change to suite your needs 
	 RailsEnv production 
	 DocumentRoot /opt/redmine/public 

	 <Directory "/opt/redmine/public"> 
	         Allow from all 
	         Require all granted 
	 </Directory> 

	 ErrorLog ${APACHE_LOG_DIR}/redmine_error.log 
         CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined 
 </VirtualHost> 
 </pre> 

 If this is a new standalone installation, it will have created a default apache site. Disable it and enable the redmine config created above. 

 <pre> 
 # disable default apache sites 
 a2dissite 000-default.conf 

 # enable redmine 
 a2ensite redmine.conf 

 # reload apache 
 systemctl reload apache2 
 </pre> 

 h2. Test Redmine 

 Point your browser to the IP/DNS Name of the server and it should show the default Redmine screen. 
 Login with admin/admin 

 #party