Installing Redmine 3.0 on clean Ubuntu 14.04
In this tutorial we will install Redmine on a clean installation of Ubuntu server 14.04 with an Apache server and MySql.
Redmine wil be reachable under the subdomain redmine.example.com.
Here Redmine will be installed to /var/www/vhosts/redmine.
I use unzip to unpack the archive.
The placeholder for the username you’re logged into the system is $sysUser$.
Step 1 – Installing required software
First we need to update our packages.If you encounter any problems later on try to fix them by updating your packages again.
sudo apt-get update && sudo apt-get -y upgradeNow install apache2 and mysql:
sudo apt-get install apache2 mysql-server mysql-clientWhile installing mysql-server you will be asked for a MySql root password to set.
Step 2 – Database creation
To create the database log in as root user with the password you set earlier.
mysql -u root -pThe following MySql queries create the database and the user to access this database. Be sure you have my_password replaced with an other password (not the root password) before executing.
CREATE DATABASE redmine CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'my_password';To exit mysql simply type exit and execute.
Step 3 – Downloading Redmine
Now switch in your vhosts directory download Redmine and unzip it. If you want you can use the .tar.gz file with the tar command as well.
cd /var/www/vhosts
wget http://www.redmine.org/releases/redmine-3.0.1.zip
unzip redmine-3.0.1.zip
mv redmine-3.0.1 redmineStep 4 – Database configuration
We need to alter the file /var/www/vhosts/redmine/config/database.yml.example and save it as database.yml.
Replace my_password with the password set in the MySql query before.
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: my_passwordIf your MySql server is running on another Port (eg. 3344) you can use the following config:
production:
adapter: mysql
database: redmine
host: localhost
port: 3344
username: redmine
password: my_passwordStep 5 – Installing ruby
First we have to remove the old version of ruby.
sudo apt-get remove rubyExecute the following command (not as root user) with the ‚\‘ at the beginning.
It will install ruby at your system, usable for every user in the group rvm.
The installation folder is /usr/local/rvm.
\curl -sSL https://get.rvm.io | sudo bash -s stable --railsIn my case the first run failed because of a missing signature. The command to install this signature will be displayed in the error-message. In my case it was this:
sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3Then rerun the command to install ruby.
After some time ruby is installed with rails.
Now the users $sysUser$ and www-data need to be added to the group rvm.
sudo usermod -aG rvm $sysUser$
sudo usermod -aG rvm www-dataAfter a relogin the change should be applyed. You have to switch folders back to your Redmine folder.
gem install bundler
bundle install --without development test rmagickIf you encounter any problems with mysql during installation execute sudo apt-get install libmysqlclient-dev.
Then execute the command again.
Step 6 – Configuring Redmine with ruby
Generate a secret cookie token:
bundle exec rake generate_secret_tokenCreate the database structure:
RAILS_ENV=production bundle exec rake db:migrateInsert the default configuration:
RAILS_ENV=production bundle exec rake redmine:load_default_dataStart the webrick server to test if everything is ok. You can access the webrick server from localhost only, so its ok if it throws no errors while starting. Then shutdown the webrick server.
bundle exec ruby bin/rails server webrick -e productionStep 7 – Installing passenger
Because the repository version of passenger will install the old ruby from the repository again, we have to install it via gem.
gem install passengerNow we have to install some other packages, required for passenger integration in apache2:
sudo apt-get install libcurl4-openssl-dev apache2-threaded-dev libapr1-dev libaprutil1-devThen execute the following commands to install the passenger module to apache2.
sudo -i
passenger-install-apache2-moduleAlter the file /etc/apache2/mods-avaiable/passenger.load to this:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.0/gems/passenger-5.0.5/buildout/apache2/mod_passenger.soAnd the file /etc/apache2/mods-available/passenger.conf to this:
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-2.2.0/gems/passenger-5.0.5
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.0/wrappers/ruby
</IfModule>Now enable the passenger mod:
a2enmod passengerStep 8 – Configuring Apache
To reach redmine under redmine.example.com we have to create a new file in /etc/apache2/sites-avaiable.
I called the file redmine.example.com.conf.
<VirtualHost *:80>
ServerName redmine.example.com
ServerAlias www.redmine.example.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/vhosts/redmine/public
<Directory /var/www/vhosts/redmine/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>To activate the site execute a2ensite redmine.example.com.conf and rename the file /var/www/vhosts/redmine/public/dispatch.fcgi.example to dispatch.fcgi.
Now restart apache2 via sudo service apache2 restart.
Everything should be up and running.
Sources
- http://www.redmine.org/projects/redmine/wiki/redmineinstall
- http://stackoverflow.com/a/4510847/1469540
- https://rvm.io/rvm/install
- https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-on-ubuntu-14-04-using-rvm
- http://www.interworx.com/support/faq/how-to-install-ruby-on-rails-and-passenger/ [Link is down for some reason]
- http://wiki.ubuntuusers.de/Benutzer_und_Gruppen