環境:
- Ubuntu10.04
- Redmine2.4.1
設定MySQL
CREATE DATABASE redmine CHARACTER SET utf8; CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password'; GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
安裝RVM (Ruby Version Manager)與RubyGems (Ruby package manager)
sudo adduser redmine sudo su redmine sudo apt-get install curl sudo su redmine curl -L https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc rvm install 1.9.3 rvm use 1.9.3 ruby -v wget http://production.cf.rubygems.org/rubygems/rubygems-2.1.7.tgz tar zxvf rubygems-2.1.7.tgz cd rubygems-2.1.7/ ruby setup.rb
使用RubyGems安裝bunlder
gem update –system
gem install bunlder
安裝Ruby rmagick與Ruby MySQL Adapter
ruby rmagick
sudo apt-get install imagemagick sudo apt-get install libmagickwand-dev gem install rmagick
ruby mysql2
sudo apt-get install libmysql-ruby libmysqlclient-dev
gem install mysql2
安裝redmine
下載redmine,並解壓縮至至/home/redmine/redmine_site
cd ~/redmine_site cp ./config/database.yml.example ./config/database.yml vim ./config/database.yml
production: adapter: mysql2 (note: For Rails < 3.1 use mysql instead of mysql2) database: redmine host: localhost username: redmine password: my_password
bundle install --without development test postgresql sqlite rmagick rake generate_secret_token RAILS_ENV=production rake db:migrate RAILS_ENV=production rake redmine:load_default_data
測試Redmine是否安裝成功 (http://localhost:3000/redmine/)
ruby script/rails server webrick -e production
設定Redmine使用Apache2
sudo vim /etc/apache2/http.conf
Listen 8083 <VirtualHost *:8083> ServerName Redmine DocumentRoot /home/redmine/redmine_site/public/ <Directory /home/redmine/redmine_site/public/> Options Indexes ExecCGI FollowSymLinks Order allow,deny Allow from all AllowOverride all </Directory> </VirtualHost>
gem install passenger --no-rdoc --no-ri passenger-install-apache2-module cd /etc/apache2/mods-available sudo vim passenger.conf
PassengerRoot /home/redmine/.rvm/gems/ruby-1.9.3-p484/gems/passenger-4.0.25 PassengerDefaultRuby /home/redmine/.rvm/wrappers/ruby-1.9.3-p484/ruby
sudo vim passenger.load
LoadModule passenger_module /home/redmine/.rvm/gems/ruby-1.9.3-p484/gems/passenger-4.0.25/buildout/apache2/mod_passenger.so
cd /etc/apache2/mods-enabled sudo ln -s /etc/apache2/mods-available/passenger.conf sudo ln -s /etc/apache2/mods-available/passenger.load