Project

General

Profile

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

拉哨 哈, 2022-06-23 16:46

1 1 Marc Morocutti
h1. HowTo Install Redmine 5.0.x on Ubuntu 20.04 with Apache2
2
3 8 Marc Morocutti
Based on [[RedmineInstall]] but limited to Ubuntu & MySQL, this will take on an empty Ubuntu 20.04 VM, this will install Redmine 5.0.1 with Apache2 and local MySQL database. For any questions or feedback, feel free to write to redmine@ion.lu
4 7 Marc Morocutti
5 1 Marc Morocutti
h2. Installing dependencies
6
7
<pre>
8
# update & upgrade 
9
sudo apt-get update && sudo apt-get upgrade -y
10
11
# install required packages
12 2 Marc Morocutti
sudo apt install -y apache2 ruby ruby-dev build-essential libapache2-mod-passenger libmysqlclient-dev
13 1 Marc Morocutti
14
# if you want to install mysql server locally
15
sudo apt install -y mysql-server
16
</pre> 
17
18 2 Marc Morocutti
h2. Download & Extract Redmine
19
20
Go grab the latest version from [[Download|here]]. For this example it will be 5.0.1
21
<pre>
22
# download and extract
23
cd
24
wget https://redmine.org/releases/redmine-5.0.1.tar.gz
25
cd /opt
26
sudo tar -xvzf ~/redmine-5.0.1.tar.gz
27
28
# symlink to remove version reference
29
sudo ln -s redmine-5.0.1 redmine
30
</pre>
31
32
h2. Configure database
33
34
Create a database and create a user for redmine. Example for localhost installation below:
35
<pre>
36
sudo mysql
37
38 6 Marc Morocutti
mysql> 
39
CREATE DATABASE redmine CHARACTER SET utf8mb4;
40
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'secretPassword';
41
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
42
FLUSH PRIVILEGES;
43 3 Marc Morocutti
</pre>
44 2 Marc Morocutti
45 3 Marc Morocutti
h2. Edit database configuration file
46
47
<pre>
48
# copy the example file
49
cd /opt/redmine
50
cp config/database.yml.example config/database.yml
51
52
# edit config file with your editor of choice (mine is vi)
53
vi config/database.yml
54
</pre>
55
56
Replace or update the production: block with your configuration. One example based on the mysql config above.
57
58
<pre>
59
production:
60
  adapter: mysql2
61
  database: redmine
62
  host: localhost
63
  username: redmine
64
  password: "secretPassword"
65
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
66
  encoding: utf8mb4
67 2 Marc Morocutti
</pre>
68 4 Marc Morocutti
69 7 Marc Morocutti
h2. Install Ruby dependencies
70 9 拉哨 哈
in redmine path
71 7 Marc Morocutti
<pre>
72
# install bundler
73
sudo gem install bundler
74
75
# install redmine bundle (give sudo password when prompted)
76
bundle install
77
</pre>
78
79 4 Marc Morocutti
h2. Run Redmine scripts
80
81 7 Marc Morocutti
<pre>
82 4 Marc Morocutti
# generate secret token
83
bundle exec rake generate_secret_token
84
85
# migrate database
86
RAILS_ENV=production bundle exec rake db:migrate
87
88
# load default data
89
RAILS_ENV=production bundle exec rake redmine:load_default_data
90 7 Marc Morocutti
</pre>
91 4 Marc Morocutti
92
h2. Configure Apache
93
94
Create an apache configuration file in /etc/apache2/sites-available (e.g. redmine.conf) with the following content:
95
<pre>
96 1 Marc Morocutti
<VirtualHost *:80>
97 7 Marc Morocutti
	ServerName redmine.example.com
98 4 Marc Morocutti
	RailsEnv production
99
	DocumentRoot /opt/redmine/public
100
101
	<Directory "/opt/redmine/public">
102
	        Allow from all
103
	        Require all granted
104
	</Directory>
105
106
	ErrorLog ${APACHE_LOG_DIR}/redmine_error.log
107 5 Marc Morocutti
        CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined
108
</VirtualHost>
109
</pre>
110
111
If this is a new standalone installation, it will have created a default apache site. Disable it and enable the redmine config created above.
112
113 1 Marc Morocutti
<pre>
114 5 Marc Morocutti
# disable default apache sites
115 7 Marc Morocutti
sudo a2dissite 000-default.conf
116 5 Marc Morocutti
117 1 Marc Morocutti
# enable redmine
118 7 Marc Morocutti
sudo a2ensite redmine.conf
119 5 Marc Morocutti
120
# reload apache
121 7 Marc Morocutti
sudo systemctl reload apache2
122 5 Marc Morocutti
</pre>
123
124
h2. Test Redmine
125
126
Point your browser to the IP/DNS Name of the server and it should show the default Redmine screen.
127
Login with admin/admin
128
129
#party