Project

General

Profile

HowTo Install Redmine 50x on Ubuntu 2004 with Apache2 » History » Version 4

Marc Morocutti, 2022-06-07 14:51

1 1 Marc Morocutti
h1. HowTo Install Redmine 5.0.x on Ubuntu 20.04 with Apache2
2
3
h2. Installing dependencies
4
5
<pre>
6
# update & upgrade 
7
sudo apt-get update && sudo apt-get upgrade -y
8
9
# install required packages
10 2 Marc Morocutti
sudo apt install -y apache2 ruby ruby-dev build-essential libapache2-mod-passenger libmysqlclient-dev
11 1 Marc Morocutti
12
# if you want to install mysql server locally
13
sudo apt install -y mysql-server
14
</pre> 
15
16 2 Marc Morocutti
h2. Download & Extract Redmine
17
18
Go grab the latest version from [[Download|here]]. For this example it will be 5.0.1
19
<pre>
20
# download and extract
21
cd
22
wget https://redmine.org/releases/redmine-5.0.1.tar.gz
23
cd /opt
24
sudo tar -xvzf ~/redmine-5.0.1.tar.gz
25
26
# symlink to remove version reference
27
sudo ln -s redmine-5.0.1 redmine
28
</pre>
29
30
h2. Configure database
31
32
Create a database and create a user for redmine. Example for localhost installation below:
33
<pre>
34
sudo mysql
35
36
mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4;
37
mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'secretPassword';
38
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
39
mysql> FLUSH PRIVILEGES;
40 3 Marc Morocutti
</pre>
41 2 Marc Morocutti
42 3 Marc Morocutti
h2. Edit database configuration file
43
44
<pre>
45
# copy the example file
46
cd /opt/redmine
47
cp config/database.yml.example config/database.yml
48
49
# edit config file with your editor of choice (mine is vi)
50
vi config/database.yml
51
</pre>
52
53
Replace or update the production: block with your configuration. One example based on the mysql config above.
54
55
<pre>
56
production:
57
  adapter: mysql2
58
  database: redmine
59
  host: localhost
60
  username: redmine
61
  password: "secretPassword"
62
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
63
  encoding: utf8mb4
64 2 Marc Morocutti
</pre>
65 4 Marc Morocutti
66
h2. Run Redmine scripts
67
68
# generate secret token
69
bundle exec rake generate_secret_token
70
71
# migrate database
72
RAILS_ENV=production bundle exec rake db:migrate
73
74
# load default data
75
RAILS_ENV=production bundle exec rake redmine:load_default_data
76
77
h2. Configure Apache
78
79
Create an apache configuration file in /etc/apache2/sites-available (e.g. redmine.conf) with the following content:
80
<pre>
81
<VirtualHost *:80>
82
	ServerName redmine.example.com # change to suite your needs
83
	RailsEnv production
84
	DocumentRoot /opt/redmine/public
85
86
	<Directory "/opt/redmine/public">
87
	        Allow from all
88
	        Require all granted
89
	</Directory>
90
91
	ErrorLog ${APACHE_LOG_DIR}/redmine_error.log
92
        CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined
93
</VirtualHost>
94
</pre>