Project

General

Profile

Actions

HowTo Install Redmine 12x + Mercurial on Ubuntu lucid server » History » Revision 2

« Previous | Revision 2/22 (diff) | Next »
Dimitry Profus, 2011-09-18 01:18


How to install Redmine on Ubuntu lucid server

Redmine Setup

  1. Install the LAMP stack
    $ sudo tasksel install lamp-server
    
  2. Install the required packages
    $ sudo apt-get install libdigest-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 
    
  3. Install the required Ruby gems
    $ sudo gem install rails -v=2.3.11 --no-ri --no-rdoc
    $ sudo gem install rack -v=1.1.0 --no-ri --no-rdoc
    $ sudo gem install rake -v=0.8.7 --no-ri --no-rdoc
    
  4. Download Redmine into /user/shared/redmine directory
    $ sudo svn co http://redmine.rubyforge.org/svn/branches/1.2-stable /user/shared/redmine
    
  5. Create an empty MySQL database and accompanying user named redmine for example.
    $ mysql localhost -u root -p
    
    > create database redmine character set utf8;
    > create user 'redmine'@'localhost' identified by '[password]';
    > grant all privileges on redmine.* to 'redmine'@'localhost' identified by '[password]';
    
  6. Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment.
    $ sudo cp /usr/shared/redmine/config/database.yml.example /usr/shared/redmine/config/database.yml
    
    $ sudo nano /usr/shared/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]
    
  7. Create the database structure, by running the following command under the application root directory:
    $ cd /usr/shared/redmine
    
    $ sudo rake db:migrate RAILS_ENV="production" 
    
  8. Insert default configuration data in database, by running the following command:
    $ sudo RAILS_ENV=production rake redmine:load_default_data
    
  9. Setting up permissions
    $ cd /usr/shared/redmine
    $ sudo mkdir tmp public/plugin_assets
    $ sudo chown -R www-data:www-data files log tmp public/plugin_assets
    $ sudo chmod -R 755 files log tmp public/plugin_assets
    

Apache Setup

  1. Install the required packages
    $ sudo apt-get install libapache2-mod-passenger libapache-dbi-perl libapache2-mod-perl2 libapache2-svn
    
  2. Add a symbolic link to the public redmine web directory
    $ sudo ln -s /usr/share/redmine/public /var/www/redmine
    
  3. Configure Passanger to run as www-data
    $ sudo nano /etc/apache2/mods-available/passenger.conf
    
    Add the follow line and save (ctrl+x)
    
    PassengerDefaultUser www-data
    
  4. Create a new Apache site file
     
    $ sudo nano /etc/apache2/sites-available/redmine 
    

    Add the following lines and save (ctrl+x)
    <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>
    

    For SSL add the following text instead
    <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>
    
  5. Enable the Redmine website
    $ sudo a2dissite default
    $ sudo a2ensite redmine
    
  6. Enable the Passenger and Rewite modules and restart Apache
     
    $ sudo a2enmod passenger
    $ sudo a2enmod rewrite
    $ sudo /etc/init.d/apache2 restart
    

Mercurial Setup

  1. Install the latest Mercurial release
    $ sudo add-apt-repository ppa:mercurial-ppa/releases
    $ sudo apt-get update
    $ sudo apt-get install mercurial  
    
  2. Create the hg web directory
    $ sudo mkdir -p /var/www/hg/repos
    
  3. Create the web cgi script file
    $ 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)
    
  4. Create the cgi web config file
    $ 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
    
  5. Setup permissions
    $ sudo chown -R www-data:www-data /var/www/hg
    $ sudo chmod gu+x /var/www/hg/hgwebdir.cgi
    
  6. Create the Mercurial config file
    $ 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>
    
  7. Add a symbolic link to Redmine.pm
    $ sudo ln -s /usr/shared/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache/Redmine.pm
    $ sudo ln -s /usr/shared/redmine/extra/svn/Redmine.pm /usr/lib/perl5/Apache2/Redmine.pm  
    
  8. Enable the required Apache modules and restart Apache
    $ sudo a2enmod perl
    $ sudo /etc/init.d/apache2 restart
    
  9. Create a new test repository
    $ sudo hg init /var/www/hg/repos/test
    $ sudo chown -R www-data:www-data /var/www/hg/repos/test 
    
  10. View the test repository in the web browser
    > http://[my site name]/hg/test
    

Email Setup

  1. Install and configure Sendmail
    $ sudo apt-get install sendmail
    $ sudo sendmailconfig
    
    (Answer Yes to all questions which you will be asked)
    
  2. Update the Redmine configuration file
    $ sudo nano /usr/shared/redmine/config/configuration.yml
    
    Add the following text and save
    
     production:
       email_delivery:
         delivery_method: :sendmail
    

Updated by Dimitry Profus over 12 years ago · 2 revisions