HowTo Install Redmine 12x + Mercurial on Ubuntu lucid server » History » Revision 15
Revision 14 (Dimitry Profus, 2011-09-18 05:49) → Revision 15/22 (Dimitry Profus, 2011-09-18 09:34)
h1. How to install Redmine on Ubuntu lucid server
{{toc}}
h2. Redmine Installation
# Install the LAMP stack
<pre>
$ sudo tasksel install lamp-server
</pre>
# Install the required packages
<pre>
$ sudo apt-get install build-essential llibmysqlclient15-dev ibdigest-sha1-perl libgemplugin-ruby libgemplugin-ruby1.8 libruby-extras libruby1.8-extras rails rake ruby rubygems rubygems1.8 ruby1.8-dev subversion libopenssl-ruby1.8
</pre>
# Install the required Ruby gems
<pre>
$ sudo gem install rails -v=2.3.11 --no-ri --no-rdoc
$ sudo gem install rake -v=0.8.7 --no-ri --no-rdoc
$ sudo gem uninstall rake -v=0.9.2
$ sudo gem install i18n -v=0.4.2 --no-ri --no-rdoc
$ sudo gem install mysql --no-ri --no-rdoc
</pre>
# Download Redmine into /user/share/redmine directory
<pre>
$ sudo svn co http://redmine.rubyforge.org/svn/branches/1.2-stable /usr/share/redmine
</pre>
# Create an empty MySQL database and accompanying user named redmine for example.
<pre>
$ mysql -u root -p
(enter the mysql root user password)
> create database redmine character set utf8;
> create user 'redmine'@'localhost' identified by '[password]';
> grant all privileges on redmine.* to 'redmine'@'localhost' identified by '[password]';
> exit
</pre>
# Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment.
<pre>
$ sudo cp /usr/share/redmine/config/database.yml.example /usr/share/redmine/config/database.yml
$ sudo nano /usr/share/redmine/config/database.yml
Modify to the following and save (ctrl+x)
production:
adapter: mysql
socket: /var/run/mysqld/mysqld.sock
database: redmine
host: localhost
username: redmine
password: [password]
encoding: utf8
</pre>
# Generate a session store secret.
<pre>
$ cd /usr/share/redmine
$ sudo rake generate_session_store
</pre>
# Create the database structure, by running the following command under the application root directory:
<pre>
$ cd /usr/share/redmine
$ sudo rake db:migrate RAILS_ENV="production"
</pre>
# Insert default configuration data in database, by running the following command:
<pre>
$ sudo RAILS_ENV=production rake redmine:load_default_data
</pre>
# Setting up permissions
<pre>
$ cd /usr/share/redmine
$ sudo chown -R www-data:www-data files log tmp public/plugin_assets
$ sudo chmod -R 755 files log tmp public/plugin_assets
</pre>
# Test using the webrick web server
<pre>
$ cd /usr/share/redmine
$ ruby script/server webrick -e production
Point your web browser at http://[my server ip]:3000
You should now see the application welcome page.
</pre>
h2. Apache Integration
# Install the required packages
<pre>
$ sudo apt-get install libapache2-mod-passenger libapache-dbi-perl libapache2-mod-perl2 libapache2-svn
</pre>
# Add a symbolic link to the public redmine web directory
<pre>
$ sudo ln -s /usr/share/redmine/public /var/www/redmine
</pre>
# Configure Passanger to run as www-data
<pre>
$ sudo nano /etc/apache2/mods-available/passenger.conf
Add the follow line and save (ctrl+x)
PassengerDefaultUser www-data
</pre>
# Create a new Apache site file
<pre>
$ sudo nano /etc/apache2/sites-available/redmine
</pre>
Add the following lines and save (ctrl+x)
<pre>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
ServerName myservername
RewriteEngine on
RewriteRule ^/$ /redmine [R]
<Directory /var/www/redmine>
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
</pre>
For SSL add the following text instead
<pre>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
ServerName myservername
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/redmine.pem
RewriteEngine on
RewriteRule ^/$ /redmine [R]
<Directory /var/www/redmine>
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
</pre>
# Enable the Redmine website
<pre>
$ sudo a2dissite default
$ sudo a2ensite redmine
</pre>
# Enable the Passenger and Rewite modules and restart Apache
<pre>
$ sudo a2enmod passenger
$ sudo a2enmod rewrite
$ sudo /etc/init.d/apache2 restart
</pre>
# Test the setup
<pre>
Open up your favorite web browser and goto
http://[my site or ip]/redmine
</pre>
h2. Mercurial Integration
# Install the latest Mercurial release
<pre>
$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:mercurial-ppa/releases
$ sudo apt-get update
$ sudo apt-get install mercurial
</pre>
# Create the hg web directory
<pre>
$ sudo mkdir -p /var/www/hg/repos
</pre>
# Create the web cgi script file
<pre>
$ sudo nano /var/www/hg/hgwebdir.cgi
Add the following and save
#!/usr/bin/env python
#
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb.hgwebdir_mod import hgwebdir
import mercurial.hgweb.wsgicgi as wsgicgi
application = hgwebdir('hgweb.config')
wsgicgi.launch(application)
</pre>
# Create the cgi web config file
<pre>
$ sudo nano /var/www/hg/hgweb.config
Add the following and save
[paths]
/=/var/www/hg/repos/**
[web]
allow_push = *
push_ssl = false
allowbz2 = yes
allowgz = yes
allowzip = yes
</pre>
# Setup permissions
<pre>
$ sudo chown -R www-data:www-data /var/www/hg
$ sudo chmod gu+x /var/www/hg/hgwebdir.cgi
</pre>
# Create a Apache config file
<pre>
$ sudo nano /etc/apache2/conf.d/hg.config
Add the following and save
PerlLoadModule Apache::Redmine
ScriptAlias /hg "/var/www/hg/hgwebdir.cgi"
<Location /hg >
AuthType Basic
AuthName "Mercurial"
Require valid-user
#Redmine auth
PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
RedmineDSN "DBI:mysql:database=redmine;host=localhost"
RedmineDbUser "redmine"
RedmineDbPass "password"
</Location>
</pre>
# Add a symbolic link to Redmine.pm
<pre>
$ sudo ln -s /usr/share/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache/Redmine.pm
$ sudo ln -s /usr/share/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache2/Redmine.pm
</pre>
# Enable the required Apache modules and restart Apache
<pre>
$ sudo a2enmod perl
$ sudo /etc/init.d/apache2 restart
</pre>
# Create a new test repository and project in Redmine
<pre>
$ sudo hg init /var/www/hg/repos/test
$ sudo chown -R www-data:www-data /var/www/hg/repos/test
Create a new project with and identifier 'test'
In the project Settings > Repository set
SCM: Mercurial
Path to repository: /var/www/hg/repos/test
Press the 'Create' button
Goto to the Repository tab of the test project
</pre>
# View the test repository in the web browser
<pre>
> http://[my site name]/hg/test
</pre>
h2. Subversion Integration
# Install the latest Mercurial release
<pre>
$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:svn/ppa
$ sudo apt-get update
$ sudo apt-get install subversion libapache2-svn
</pre>
# Create the svn repository directory
<pre>
$ sudo mkdir /var/www/svn
</pre>
# Setup permissions
<pre>
$ sudo chown -R www-data:www-data /var/www/svn
</pre>
# Create a Apache config file
<pre>
$ sudo nano /etc/apache2/conf.d/svn.config
</pre>
Add the following and save
<pre>
PerlLoadModule Apache::Redmine
<Location /svn>
DAV svn
SVNParentPath "/var/www/svn"
Order deny,allow
Deny from all
Satisfy any
PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
AuthType Basic
AuthName "Redmine Subversion Repository"
#read-only access
<Limit GET PROPFIND OPTIONS REPORT>
Require valid-user
Allow from 127.0.0.1
# Allow from another-ip
Satisfy any
</Limit>
# write access
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
## for mysql
RedmineDSN "DBI:mysql:database=redmine_default;host=localhost"
RedmineDbUser "redmine"
RedmineDbPass "password"
</Location>
</pre>
# Enable the required Apache modules and restart Apache
<pre>
$ sudo a2enmod dav_svn
$ sudo /etc/init.d/apache2 restart
</pre>
# Create a new test repository
<pre>
$ sudo svn create /var/www/svn/test
$ sudo chown -R www-data:www-data /var/www/svn/test
</pre>
h2. Email Integration
# Install and configure Sendmail
<pre>
$ sudo apt-get install sendmail
$ sudo sendmailconfig
(Answer Yes to all questions which you will be asked)
</pre>
# Update the Redmine configuration file
<pre>
$ sudo nano /usr/share/redmine/config/configuration.yml
Add the following text and save
production:
email_delivery:
delivery_method: :sendmail
</pre>