Installing from Debian packages
Official Redmine packages are available for Debian. As of July 2018, stable version 4.0.4 is supported in Debian 9.
If you will be using Redmine in a production environment requiring long term support and stability using official packages is recommended. You will be receiving automatic feature and security updates.
Installing from sources
If you want the very latest Redmine version and are comfortable doing manual upgrades and system administration, the following steps will guide you through installing Redmine from sources.
1. Install the pre-requisites for Redmine and all its packages.
$ sudo 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
2. Install your database of choice.
apt install postgresql
If installing Postgres, install dev.
apt install postgresql-server-dev-9.6
Choose a directory where to install Redmine. In this example /opt used. You can use another location, but you will need to update the following steps as necessary based on your choice.
Install Redmine in /opt
git clone https://github.com/redmine/redmine
Login as the default postgres user and create a new role and database. Use your own password.
sudo -u postgres psql postgres CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'your_password' NOINHERIT VALID UNTIL 'infinity'; CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
then press CTRL-D to escape the shell.
edit /etc/postgresql/9.6/main/pg_hba.conf
and set Postgres to trust :
"local all postgres trust " sudo service postgresql reload
Create the /opt/redmine/config/database.yml
file with the following contents…
production: adapter: postgresql database: redmine host: localhost username: redmine password: your_password
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. Remember to save. Keep in mind Postgresql passwords can’t start with @ character (or other non alpha numerics).
Next, set up the database schema and load the initial database.
bundle install bundle exec rake generate_secret_token RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production bundle exec rake redmine:load_default_data
Choose default_data in your language. Default is [en]
In my case i’ve got error
“An error occurred while installing pg (1.1.4), and Bundler cannot continue.”
solved it by running
sudo apt install postgresql-contrib libpq-dev.
Then bundle worked just fine.
Do a quick test to verify that redmine is working using webrick.
bundle exec ruby /usr/bin/rails server -b your_ip_address webrick -e production
Now try to connect via browser to http://your_ip_address:3000
. Webrick is not for production systems. It is a good way to check things before getting started with Apache, though.
Next, let’s set up Apache.
cd /opt/ sudo chown -R www-data:www-data /opt/redmine cd /opt/redmine/ sudo chmod -R 755 files log tmp public/plugin_assets sudo chown www-data:www-data Gemfile.lock
Create a symbolic link which points from the Apache working directory to the Redmine public folder
sudo ln -s /opt/redmine/public/ /var/www/html/redmine
Create a new vhost configuration
sudo nano /etc/apache2/sites-available/master.conf
and paste in:
<VirtualHost *:80> ServerAdmin [email protected] Servername hostname DocumentRoot /var/www/html/ <Location /redmine> RailsEnv production RackBaseURI /redmine Options -MultiViews </Location> </VirtualHost>
Then, run:
sudo a2dissite 000-default.conf sudo a2ensite master.conf
add this line to /etc/apache2/mods-available/passenger.conf
in the body of the document- not just the 1st line.
PassengerUser www-data
Restart the Apache web server:
sudo service apache2 restart
Open your browser and navigate to: http://your-ip-address/redmine
.
And hopefully, you’re up and running.