HowTo Install Redmine 25x on Ubuntu 1404 with Apache2 Phusion Passenger MySQL and Subversion » History » Version 8
ann luo, 2014-08-11 12:09
1 | 6 | Redmine Geist | h1. HowTo Install Redmine 2.5.x on Ubuntu 14.04 with Apache2 Phusion Passenger MySQL and Subversion |
---|---|---|---|
2 | 1 | Redmine Geist | |
3 | {{toc}} |
||
4 | |||
5 | h2. Installing Dependencys |
||
6 | |||
7 | <pre> |
||
8 | apt-get update && apt-get upgrade -y |
||
9 | |||
10 | 2 | Redmine Geist | sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server php5-mysql phpmyadmin libapache2-mod-perl2 libcurl4-openssl-dev libssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev libmysqlclient-dev libmagickcore-dev libmagickwand-dev curl git-core patch build-essential bison zlib1g-dev libssl-dev libxml2-dev libxml2-dev sqlite3 libsqlite3-dev autotools-dev libxslt1-dev libyaml-0-2 autoconf automake libreadline6-dev libyaml-dev libtool imagemagick apache2-utils |
11 | 1 | Redmine Geist | </pre> |
12 | |||
13 | I don't know if every package needed, but it works. |
||
14 | 2 | Redmine Geist | |
15 | h2. Installing Subversion |
||
16 | |||
17 | <pre> |
||
18 | sudo apt-get install subversion libapache2-svn |
||
19 | </pre> |
||
20 | 3 | Redmine Geist | |
21 | <pre> |
||
22 | sudo mkdir -p /var/lib/svn |
||
23 | sudo chown -R www-data:www-data /var/lib/svn |
||
24 | sudo a2enmod dav_svn |
||
25 | </pre> |
||
26 | |||
27 | Open config file |
||
28 | <pre> |
||
29 | sudo nano /etc/apache2/mods-enabled/dav_svn.conf |
||
30 | </pre> |
||
31 | |||
32 | Uncomment following lines |
||
33 | |||
34 | <pre> |
||
35 | <Location /svn> |
||
36 | DAV svn |
||
37 | SVNParentPath /var/lib/svn |
||
38 | AuthType Basic |
||
39 | AuthName "My repository" |
||
40 | AuthUserFile /etc/apache2/dav_svn.passwd |
||
41 | AuthzSVNAccessFile /etc/apache2/dav_svn.authz |
||
42 | <LimitExcept GET PROFIND OPTIONS REPORT> |
||
43 | Require valid-user |
||
44 | </LimitExcept> |
||
45 | </Location> |
||
46 | </pre> |
||
47 | |||
48 | <pre> |
||
49 | sudo a2enmod authz_svn |
||
50 | </pre> |
||
51 | |||
52 | Add the redmine user for reading from repository |
||
53 | <pre> |
||
54 | sudo htpasswd -c /etc/apache2/dav_svn.passwd redmine |
||
55 | |||
56 | sudo service apache2 restart |
||
57 | </pre> |
||
58 | |||
59 | Create the repository |
||
60 | 4 | Redmine Geist | <pre> |
61 | 3 | Redmine Geist | sudo svnadmin create --fs-type fsfs /var/lib/svn/my_repository |
62 | sudo chown -R www-data:www-data /var/lib/svn |
||
63 | 4 | Redmine Geist | </pre> |
64 | 3 | Redmine Geist | |
65 | Open file for configuration of repository access |
||
66 | <pre> |
||
67 | sudo nano /etc/apache2/dav_svn.authz |
||
68 | </pre> |
||
69 | |||
70 | Add access rights for redmine to the repository in the config file |
||
71 | <pre> |
||
72 | [my_repository:/] |
||
73 | redmine = r |
||
74 | </pre> |
||
75 | |||
76 | h2. Installing Ruby and Ruby on Rails |
||
77 | |||
78 | <pre> |
||
79 | sudo apt-get install ruby1.9.3 ruby1.9.1-dev ri1.9.1 libruby1.9.1 libssl-dev zlib1g-dev |
||
80 | sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \ |
||
81 | --slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \ |
||
82 | /usr/share/man/man1/ruby1.9.1.1.gz \ |
||
83 | --slave /usr/bin/ri ri /usr/bin/ri1.9.1 \ |
||
84 | --slave /usr/bin/irb irb /usr/bin/irb1.9.1 \ |
||
85 | --slave /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.1 |
||
86 | |||
87 | sudo gem update |
||
88 | sudo gem install bundler |
||
89 | </pre> |
||
90 | 1 | Redmine Geist | |
91 | h2. Installing of Redmine |
||
92 | 5 | Redmine Geist | |
93 | h3. Redmine |
||
94 | 3 | Redmine Geist | |
95 | Exampe for version 2.5.2, change the version number for other releases |
||
96 | |||
97 | <pre> |
||
98 | cd /usr/share |
||
99 | sudo wget http://www.redmine.org/releases/redmine-2.5.2.tar.gz |
||
100 | sudo tar xvfz redmine-2.5.2.tar.gz |
||
101 | sudo rm redmine-2.5.2.tar.gz |
||
102 | sudo mv redmine-2.5.2 redmine |
||
103 | sudo chown -R root:root /usr/share/redmine |
||
104 | sudo chown www-data /usr/share/redmine/config/environment.rb |
||
105 | sudo ln -s /usr/share/redmine/public /var/www/html/redmine |
||
106 | </pre> |
||
107 | |||
108 | h3. MySQL |
||
109 | |||
110 | <pre> |
||
111 | mysql -u root -p |
||
112 | </pre> |
||
113 | |||
114 | Execute following lines to MySQL |
||
115 | |||
116 | <pre> |
||
117 | CREATE DATABASE redmine character SET utf8; |
||
118 | CREATE user 'redmine'@'localhost' IDENTIFIED BY 'my_password'; |
||
119 | GRANT ALL privileges ON redmine.* TO 'redmine'@'localhost'; |
||
120 | exit |
||
121 | </pre> |
||
122 | |||
123 | Configure Redmine database connection |
||
124 | |||
125 | <pre> |
||
126 | sudo cp redmine/config/database.yml.example redmine/config/database.yml |
||
127 | </pre> |
||
128 | |||
129 | Open database config file |
||
130 | |||
131 | <pre> |
||
132 | sudo nano redmine/config/database.yml |
||
133 | </pre> |
||
134 | |||
135 | Change the username and the password in the config file |
||
136 | |||
137 | <pre> |
||
138 | database.yml: |
||
139 | production: |
||
140 | adapter: mysql2 |
||
141 | database: redmine |
||
142 | host: localhost |
||
143 | username: redmine |
||
144 | password: my_password |
||
145 | encoding: utf8 |
||
146 | </pre> |
||
147 | |||
148 | h3. Configuration |
||
149 | |||
150 | <pre> |
||
151 | cd /usr/share/redmine/ |
||
152 | sudo bundle install --without development test postgresql sqlite |
||
153 | sudo rake generate_secret_token |
||
154 | sudo RAILS_ENV=production rake db:migrate |
||
155 | sudo RAILS_ENV=production rake redmine:load_default_data |
||
156 | sudo mkdir public/plugin_assets |
||
157 | sudo chown -R www-data:www-data files log tmp public/plugin_assets |
||
158 | sudo chmod -R 755 files log tmp public/plugin_assets |
||
159 | </pre> |
||
160 | |||
161 | h2. Installing Phusion Passenger |
||
162 | |||
163 | h3. Add repository |
||
164 | |||
165 | Add repository for Phusion Passenger |
||
166 | |||
167 | <pre> |
||
168 | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7 |
||
169 | sudo apt-get install apt-transport-https ca-certificates |
||
170 | </pre> |
||
171 | |||
172 | Open repository config file |
||
173 | |||
174 | <pre> |
||
175 | sudo nano /etc/apt/sources.list.d/passenger.list |
||
176 | </pre> |
||
177 | |||
178 | Add following repository source |
||
179 | |||
180 | <pre> |
||
181 | deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main |
||
182 | </pre> |
||
183 | |||
184 | <pre> |
||
185 | sudo chown root: /etc/apt/sources.list.d/passenger.list |
||
186 | sudo chmod 600 /etc/apt/sources.list.d/passenger.list |
||
187 | </pre> |
||
188 | |||
189 | h3. Installing |
||
190 | |||
191 | <pre> |
||
192 | sudo apt-get update |
||
193 | sudo apt-get install libapache2-mod-passenger |
||
194 | </pre> |
||
195 | |||
196 | h3. Configuration |
||
197 | |||
198 | Open passenger config file |
||
199 | |||
200 | <pre> |
||
201 | sudo nano /etc/apache2/mods-available/passenger.conf |
||
202 | </pre> |
||
203 | |||
204 | Add following line to passenger config file |
||
205 | |||
206 | <pre> |
||
207 | PassengerDefaultUser www-data |
||
208 | </pre> |
||
209 | |||
210 | Open apache2 config file |
||
211 | |||
212 | <pre> |
||
213 | sudo nano /etc/apache2/sites-available/000-default.conf |
||
214 | </pre> |
||
215 | |||
216 | Add following part to apache2 config file |
||
217 | <pre> |
||
218 | <Directory /var/www/html/redmine> |
||
219 | RailsBaseURI /redmine |
||
220 | PassengerResolveSymlinksInDocumentRoot on |
||
221 | </Directory> |
||
222 | </pre> |
||
223 | |||
224 | <pre> |
||
225 | sudo a2enmod passenger |
||
226 | sudo service apache2 restart |
||
227 | </pre> |
||
228 | |||
229 | h2. Start Redmine |
||
230 | |||
231 | Remine should now available at your host |
||
232 | |||
233 | <pre> |
||
234 | http://yourhost/redmine |
||
235 | </pre> |
||
236 | |||
237 | Login data: |
||
238 | Username: admin |
||
239 | Password: admin |
||
240 | |||
241 | h2. e-Mail configuration |
||
242 | |||
243 | Example for smtp and encryption |
||
244 | |||
245 | Open redmine config file |
||
246 | |||
247 | <pre> |
||
248 | sudo nano /usr/share/redmine/config/configuration.yml |
||
249 | </pre> |
||
250 | |||
251 | Add following to redmine config file |
||
252 | |||
253 | <pre> |
||
254 | # Outgoing email settings |
||
255 | |||
256 | production: |
||
257 | email_delivery: |
||
258 | delivery_method: :smtp |
||
259 | smtp_settings: |
||
260 | enable_starttls_auto: true |
||
261 | address: smtp.host.com |
||
262 | port: 587 |
||
263 | domain: host.com |
||
264 | authentication: :login |
||
265 | user_name: myname |
||
266 | password: mypassword |
||
267 | </pre> |
||
268 | |||
269 | You can check the e-Mail config in web interface with testmail function |
||
270 | |||
271 | h2. Autoupdate Subversion repository view |
||
272 | |||
273 | In the project archive settings over web interface its needed to enable the web service for project archives and generate a api key |
||
274 | |||
275 | The following cronjob updates redmine to current subversion changesets every 15 minutes |
||
276 | |||
277 | <pre> |
||
278 | sudo crontab -e |
||
279 | </pre> |
||
280 | |||
281 | Add the cronjob |
||
282 | |||
283 | <pre> |
||
284 | */15 * * * * curl "http://yourhost/redmine/sys/fetch_changesets?key=APIKEY" > /dev/null |
||
285 | </pre> |
||
286 | 7 | ann luo | |
287 | If your hosting does not offer cron job configuration then you can use external services like these: |
||
288 | 8 | ann luo | https://www.easycron.com. |