Project

General

Profile

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

Marc Morocutti, 2022-06-07 15:24

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 6 Marc Morocutti
mysql> 
37
CREATE DATABASE redmine CHARACTER SET utf8mb4;
38
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'secretPassword';
39
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
40
FLUSH PRIVILEGES;
41 3 Marc Morocutti
</pre>
42 2 Marc Morocutti
43 3 Marc Morocutti
h2. Edit database configuration file
44
45
<pre>
46
# copy the example file
47
cd /opt/redmine
48
cp config/database.yml.example config/database.yml
49
50
# edit config file with your editor of choice (mine is vi)
51
vi config/database.yml
52
</pre>
53
54
Replace or update the production: block with your configuration. One example based on the mysql config above.
55
56
<pre>
57
production:
58
  adapter: mysql2
59
  database: redmine
60
  host: localhost
61
  username: redmine
62
  password: "secretPassword"
63
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
64
  encoding: utf8mb4
65 2 Marc Morocutti
</pre>
66 4 Marc Morocutti
67
h2. Run Redmine scripts
68
69
# generate secret token
70
bundle exec rake generate_secret_token
71
72
# migrate database
73
RAILS_ENV=production bundle exec rake db:migrate
74
75
# load default data
76
RAILS_ENV=production bundle exec rake redmine:load_default_data
77
78
h2. Configure Apache
79
80
Create an apache configuration file in /etc/apache2/sites-available (e.g. redmine.conf) with the following content:
81
<pre>
82
<VirtualHost *:80>
83
	ServerName redmine.example.com # change to suite your needs
84
	RailsEnv production
85
	DocumentRoot /opt/redmine/public
86
87
	<Directory "/opt/redmine/public">
88
	        Allow from all
89
	        Require all granted
90
	</Directory>
91
92
	ErrorLog ${APACHE_LOG_DIR}/redmine_error.log
93
        CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined
94
</VirtualHost>
95
</pre>
96 5 Marc Morocutti
97
If this is a new standalone installation, it will have created a default apache site. Disable it and enable the redmine config created above.
98
99
<pre>
100
# disable default apache sites
101
a2dissite 000-default.conf
102
103
# enable redmine
104
a2ensite redmine.conf
105
106
# reload apache
107
systemctl reload apache2
108
</pre>
109
110
h2. Test Redmine
111
112
Point your browser to the IP/DNS Name of the server and it should show the default Redmine screen.
113
Login with admin/admin
114
115
#party