sudo apt-get install build-essential ruby ruby1.8-dev libopenssl-ruby libmysql-ruby rubygems rake
Install rails.
sudo gem install rails -v=2.3.5
Then create symbolic link to rails.
sudo ln -s /var/lib/gems/1.8/bin/rails /usr/bin/rails
Go to www directory and checkout redmine from SVN.
cd /var/www
svn checkout http://redmine.rubyforge.org/svn/trunk redmine
Copy config file.
sudo cp redmine/config/database.yml.example redmine/config/database.yml
Change database configuration.
sudo nano redmine/config/database.yml
production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: redmine's password
encoding: utf8
Optional to change email configuration.
sudo cp redmine/config/email.yml.example redmine/config/email.yml
sudo nano redmine/config/email.yml
production:
delivery_method: :sendmail
Then go to redmine directory and generate a session store secret.
cd redmine
RAILS_ENV=production rake config/initializers/session_store.rb
Create database structure.
RAILS_ENV=production rake db:migrate
Add default configuration data to database.
RAILS_ENV=production rake redmine:load_default_data
Now run Redmine for firs time temporally.
ruby script/server webrick -e production
Now we can access Redmine at http://localhost:3000
Use following commands to running redmine on apache and Enable mod proxy and rewrite.
sudo a2enmod proxy
sudo a2enmod rewrite
Restart apache and install mongrel.
sudo /etc/init.d/apache2 restart
sudo apt-get install mongrel
Create folder mongrel inside /var/log.
sudo mkdir /var/log/mongrel
When you are in redmine directory Start mongrel.
sudo mongrel_rails start -d -p 3000 -e production -P /var/log/mongrel/mongrel-1.pid -l /var/log/mongrel/mongrel.log
Access redmine at http://localhost:3000
Create apache’s virtual host.
sudo nano /etc/apache2/sites-available/redmine
Add following proxy configuration.
<virtualhost *:80>
ServerName http://localhost
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000
ProxyPreserveHost on
<proxy *>
Order allow,deny
Allow from all
</Proxy>
</VirtualHost>
Create symbolic link.
sudo ln -s /etc/apache2/sites-available/redmine /etc/apache2/sites-enabled/redmine
Restart apache.
sudo /etc/init.d/apache2 restart
Access redmine at http://localhost:3000
If you need to stop mongrel, run the following command inside redmine directory.
sudo mongrel_rails mongrel::stop -P /var/log/mongrel/mongrel-1.pid
Possible errors and solutions
To see the running rubby sessions
lsof|grep 3000
This will give you a line starting with.
ruby 6205 admin 4u IPv4
If you need destroy the session
kill -9 6205
If you see followwing error
** !!! PID file /var/log/mongrel/mongrel-1.pid already exists. Mongrel could be running already. Check your /var/log/mongrel/mongrel.log for errors.
** !!! Exiting with error. You must stop mongrel and clear the .pid before I'll attempt a start.
Use following command or destroy session using above step.
rm /var/log/mongrel/mongrel-1.pid
rm /var/log/mongrel/mongrel.log
Thank goes to Just Notes