Project

General

Profile

HowTo Install Redmine on Debian 9 » History » Version 1

Bruce Schaller, 2017-09-09 05:57

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