Project

General

Profile

HowTo Install Redmine on Debian Squeeze with Postgresql Ruby-on-Rails and Apache2-Passenger » History » Revision 10

Revision 9 (Frédéric Stemmelin, 2011-02-24 21:27) → Revision 10/11 (Carlos Miranda Molina, 2011-04-24 12:52)

h1. HowTo Install Redmine on Debian Squeeze with Postgresql Ruby-on-Rails and Apache2-Passenger 

 This howto is similar to the [[HowTo Install Redmine on Debian with Ruby-on-Rails and Apache2-Passenger]], but a little shorter and uses Postgresql instead of Mysql as the database server. 
 It should be noted that Redmine and all it's dependencies are available as packages in Debians' repo's, so there is no need to download Redmine from svn as we will do in this howto. 

 First we become root and install some needed packages: 
 <pre> 
 su 
 apt-get install postgresql-8.4 apache2 subversion rake rubygems libopenssl-ruby libpgsql-ruby libapache2-mod-passenger 
 gem install -v=2.3.5 rails 
 </pre> 
 Before configuring redmine we need to create a user and a database in Postresql. Make sure to replace <password> with your password. 
 <pre> 
 su postgres 
 psql 
 postgres=# CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD '<password>' NOINHERIT VALID UNTIL 'infinity'; 
 postgres=# CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine TEMPLATE template0; 
 postgres=# \q 
 exit 
 </pre> 
 Now, let's download Redmine and configure it 
 <pre> 
 cd /tmp 
 svn co http://redmine.rubyforge.org/svn/branches/1.0-stable redmine-1.0 
 mv redmine-1.0/ /var/lib/redmine 
 cd /var/lib/redmine 
 </pre> 
 First some database stuff. Replace <password> with your password. 
 <pre> 
 echo "production: 
  adapter: postgresql 
  database: redmine 
  host: localhost 
  username: redmine 
  password: <password> 
  encoding: utf8 
  schema_search_path: public" > config/database.yml 

 RAILS_ENV=production rake config/initializers/session_store.rb 
 rake generate_session_store 
 RAILS_ENV=production rake db:migrate 
 RAILS_ENV=production rake redmine:load_default_data  
 </pre> 
 Finally, we setup Apache. A symbolic link to the www dir and ownership given to www-data. 
 <pre> 
 ln -s /var/lib/redmine/public /var/www/redmine 
 chown -R www-data:www-data /var/www/redmine 
 </pre> 
 We enable the site and restart Apache. 
 <pre> 
 echo "RailsBaseURI /redmine" > /etc/apache2/sites-available/redmine 
 a2ensite redmine 
 /etc/init.d/apache2 restart 
 </pre> 
 

 That's it. You will find Redmine at either:  

 localhost/redmine  
 your-ip/redmine or  
 your-domain/redmine  


 If you need run redmine with a normal domain without alias (/redmine) you can follow the following instructions. 
 Install fcgid module for Apache 
 <pre> 
 aptitude install libapache2-mod-fcgid 
 </pre> 

 Configure a example VirtualHost /etc/apache2/sites-available/yourvirtualhost 
 <pre> 
 <VirtualHost *:80> 
   ServerAdmin mail@yourserver 
   ServerName    www.redmine.org 

   DefaultInitEnv RAILS_ENV production 
   DefaultInitEnv GEM_PATH /var/lib/gems/1.8 

   DocumentRoot /var/lib/redmine/public 
   <Directory /var/lib/redmine/public> 
     Options +FollowSymLinks +ExecCGI 
     RewriteEngine On 
     RewriteRule ^$ index.html [QSA] 
     RewriteRule ^([^.]+)$ $1.html [QSA] 
     RewriteCond %{REQUEST_FILENAME} !-f 
     RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] 
     ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly" 
     AllowOverride None 
     #AllowOverride all 
     Order allow,deny 
     allow from all 
   </Directory> 
   # Possible values include: debug, info, notice, warn, error, crit, 
   # alert, emerg. 
   LogLevel warn 

   CustomLog /var/log/apache2/access.log combined 
   ErrorLog /var/log/apache2/error.log 

   ServerSignature Off 
 </VirtualHost> 
 </pre> 

 Enable the new VirtualHost and restart Apache mod-rewrite also needs 
 <pre> 
 cd /etc/apache2/sites-available 
 a2ensite yourvirtualhost 
 a2enmod rewrite 
 /etc/init.d/apache2 restart 
 </pre> 

 Remember change owner and permissions of /var/lib/redmine/files/ (for upload files) 
 <pre> 
 chown -R www-data:www-data /var/lib/redmine/files/ 
 chmod -R 0777 /var/lib/redmine/files/ 
 </pre> 

  

 Log in with user: admin, password: admin