Project

General

Profile

HowTo Install Redmine on Debian 9 » History » Version 4

Bruce Schaller, 2017-12-29 23:42
Added missing steps

1 2 Bruce Schaller
h1. How to Install Redmine on Debian 9 (Stretch)
2
3
I was having some trouble installing redmine because I am not an experienced Debian administrator!  I used the talking points in several other guides and some googling to get these instructions together.  
4
5 1 Bruce Schaller
1. Install the pre-requisites for redmine and all its packages.
6
7
> apt install gcc build-essential zlib1g zlib1g-dev zlibc ruby-zip libssl-dev libyaml-dev libcurl4-openssl-dev ruby gem libapache2-mod-passenger apache2 apache2-dev libapr1-dev libxslt1-dev checkinstall libxml2-dev ruby-dev vim libmagickwand-dev imagemagick sudo rails
8
> 
9 3 Bruce Schaller
2.  Install your database of choice.  If installing another database, it's very easy!  Just follow the instructions here instead:
10 1 Bruce Schaller
11 3 Bruce Schaller
12 1 Bruce Schaller
> apt install postgresql
13
14
3. If installing postgres, install dev.  Use the version number installed in the previous step.
15
16
> apt install postgresql-server-dev-* (See version in step 2 during install)
17
 
18
4. Choose a directory where to install redmine.  I used /opt.  You can use wherever you like, but you will need to update the following steps as necessary based on your desired install location.
19
20
Install redmine in /opt
21
22
> cd /opt
23
24
> mkdir redmine
25
26
> cd redmine
27
28
Get redmine  - use the download page and review the functionality that you need to determine the right version for you.  I wanted DMSF, which is not yet compatible with the latest version.  If in doubt, check it out!
29
30
> wget http://www.redmine.org/releases/redmine-3.3.4.tar.gz
31
32
Unpack
33
> tar xzf ./redmine-3.3.4.tar.gz
34
35
5. Login as the default postgres user and create a new role and database. Use your own password )).
36
> sudo -u postgres psql postgres
37
38
> CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'your_password' NOINHERIT VALID UNTIL 'infinity';
39
40
> CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
41
42
then press CTRL-D to escape the shell.
43
44
edit /etc/postgresql/9.6/main/pg_hba.conf and set postgres to trust : 
45
46
> "local all postgres trust “
47
> sudo service postgresql reload 
48
49
6. Create the /opt/redmine/redmine-3.3.4/config/database.yml file with the following contents…
50
51
> production:
52
> >   adapter: postgresql
53
> >   database: redmine
54
> >   host: localhost
55
> >   username: redmine
56
> >   password: your_password
57
> 
58 4 Bruce Schaller
Note that the spacing is important in this file!  under the “Production” line, each other line must be indented by two spaces, not tabs.  Replace your_password with the password specified above.  Seriously, don’t use your_password…. Remeber to save!  ALSO- Postgresql password can't start with @ character (or other non alpha numerics?) .
59 1 Bruce Schaller
60
7. Next, set up the database schema and load the initial database.
61 4 Bruce Schaller
62
> bundle install
63 1 Bruce Schaller
64
> bundle exec rake generate_secret_token
65
66
> RAILS_ENV=production bundle exec rake db:migrate
67
68
> RAILS_ENV=production bundle exec rake redmine:load_default_data
69
70
8.Do a quick test to verify that redmine is working using webrick.
71
72
> bundle exec ruby /usr/bin/rails server -b your_ip webrick -e production
73
74
And try to connect via browser to your ip:3000. Webrick is not for production systems.  It is a good way to check things before getting started with Apache, though.
75
76
9. Next, let’s set up Apache.
77
78
> cd /opt/
79
80
> sudo chown -R www-data:www-data /opt/redmine
81
82
> cd /opt/redmine/redmine-3.3.4
83
84
> sudo chmod -R 755 files log tmp public/plugin_assets
85
86
> sudo chown www-data:www-data Gemfile.lock
87
88
9.1 Create a symbolic link which points from the working directory of apache to the redmine public folder…
89
90
> sudo ln -s /opt/redmine/redmine-3.3.4/public/ /var/www/html/redmine
91
92
9.2 Need to create a new vhost configuration…
93
94
> sudo nano /etc/apache2/sites-available/master.conf
95
96
and paste in….
97
98
> <VirtualHost *:80>
99
> 
100
> ServerAdmin admin@example.com
101
> Servername hostname
102
> DocumentRoot /var/www/html/
103
> 
104
> <Location /redmine>
105
> RailsEnv production
106
> RackBaseURI /redmine
107
> Options -MultiViews
108
> </Location>
109
> 
110
> </VirtualHost>
111
112
Then, run….
113
114
> sudo a2dissite 000-default.conf
115
116
> sudo a2ensite master.conf
117
118
9.3 add this line to /etc/apache2/mods-available/passenger.conf…. in the body of the document- not just the 1st line.
119
120
> PassengerUser www-data
121
122
run…
123
124
> sudo service apache2 restart
125
126
10. Open your browser and navigate to: http://your-ip-address/redmine
127
128
And hopefully, you're up and running.
129 3 Bruce Schaller
130
Sources:
131
* [[HowTo Install Redmine on Debian 8 with Apache2-Passenger|Redmine with Apache and MySQL on Debian 8 jessie]]