Project

General

Profile

HowTo Install Redmine on Debian 9 » History » Version 2

Bruce Schaller, 2017-09-09 06:03

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
2.  Install your database of choice.
10
11
> apt install postgresql
12
13
3. If installing postgres, install dev.  Use the version number installed in the previous step.
14
15
> apt install postgresql-server-dev-* (See version in step 2 during install)
16
 
17
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.
18
19
Install redmine in /opt
20
21
> cd /opt
22
23
> mkdir redmine
24
25
> cd redmine
26
27
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!
28
29
> wget http://www.redmine.org/releases/redmine-3.3.4.tar.gz
30
31
Unpack
32
> tar xzf ./redmine-3.3.4.tar.gz
33
34
5. Login as the default postgres user and create a new role and database. Use your own password )).
35
> sudo -u postgres psql postgres
36
37
> CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'your_password' NOINHERIT VALID UNTIL 'infinity';
38
39
> CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
40
41
then press CTRL-D to escape the shell.
42
43
edit /etc/postgresql/9.6/main/pg_hba.conf and set postgres to trust : 
44
45
> "local all postgres trust “
46
> sudo service postgresql reload 
47
48
6. Create the /opt/redmine/redmine-3.3.4/config/database.yml file with the following contents…
49
50
> production:
51
> >   adapter: postgresql
52
> >   database: redmine
53
> >   host: localhost
54
> >   username: redmine
55
> >   password: your_password
56
> 
57
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!
58
59
7. Next, set up the database schema and load the initial database.
60
61
> bundle exec rake generate_secret_token
62
63
> RAILS_ENV=production bundle exec rake db:migrate
64
65
> RAILS_ENV=production bundle exec rake redmine:load_default_data
66
67
8.Do a quick test to verify that redmine is working using webrick.
68
69
> bundle exec ruby /usr/bin/rails server -b your_ip webrick -e production
70
71
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.
72
73
9. Next, let’s set up Apache.
74
75
> cd /opt/
76
77
> sudo chown -R www-data:www-data /opt/redmine
78
79
> cd /opt/redmine/redmine-3.3.4
80
81
> sudo chmod -R 755 files log tmp public/plugin_assets
82
83
> sudo chown www-data:www-data Gemfile.lock
84
85
9.1 Create a symbolic link which points from the working directory of apache to the redmine public folder…
86
87
> sudo ln -s /opt/redmine/redmine-3.3.4/public/ /var/www/html/redmine
88
89
9.2 Need to create a new vhost configuration…
90
91
> sudo nano /etc/apache2/sites-available/master.conf
92
93
and paste in….
94
95
> <VirtualHost *:80>
96
> 
97
> ServerAdmin admin@example.com
98
> Servername hostname
99
> DocumentRoot /var/www/html/
100
> 
101
> <Location /redmine>
102
> RailsEnv production
103
> RackBaseURI /redmine
104
> Options -MultiViews
105
> </Location>
106
> 
107
> </VirtualHost>
108
109
Then, run….
110
111
> sudo a2dissite 000-default.conf
112
113
> sudo a2ensite master.conf
114
115
9.3 add this line to /etc/apache2/mods-available/passenger.conf…. in the body of the document- not just the 1st line.
116
117
> PassengerUser www-data
118
119
run…
120
121
> sudo service apache2 restart
122
123
10. Open your browser and navigate to: http://your-ip-address/redmine
124
125
And hopefully, you're up and running.