0. Introduction
[Redmine] Redmine is a flexible project management web application. Written using the Ruby on Rails framework, it is cross-platform and cross-database.
[Ruby on Rails] Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.
1. Environment & Resource
1.1 Environment
Red Hat Enterprise Linux AS release 4 (Nahant Update 3) 64bit
GCC 3.4.5
1.2 Resource
MySQL 5.1.60 (http://www.mysql.com/downloads/mysql/5.1.html)
Apache httpd server 2.2.21 (http://httpd.apache.org/download.cgi)
redmine | 1.2.2 | 1.1.0 | http://rubyforge.org/frs/?group_id=1850 |
ruby | 1.8.7 | 1.8.7 | http://ftp.ruby-lang.org/pub/ruby/1.8/ |
rubygems | 1.6.2 | 1.3.7 | http://rubyforge.org/frs/?group_id=126 |
rake | 0.8.7 | 0.8.7 | |
rack | 1.1.1 | 1.0.1 | |
rails | 2.3.11 | 2.3.5 |
zlib 1.2.5 (http://www.zlib.org/)
i18n 0.4.2
mysql-ruby 2.8.2 (http://rubyforge.org/frs/?group_id=4550)
passenger 3.0.11 (http://rubyforge.org/frs/?group_id=5873)
openssl 0.9.8k (http://www.openssl.org/source/)
Run the following commands to get some gem files:
wget http://rubygems.org/downloads/rake-0.8.7.gem
wget http://rubygems.org/downloads/rack-1.1.1.gem
wget http://rubygems.org/downloads/rails-2.3.11.gem
wget http://rubygems.org/downloads/activesupport-2.3.11.gem
wget http://rubygems.org/downloads/activerecord-2.3.11.gem
wget http://rubygems.org/downloads/actionpack-2.3.11.gem
wget http://rubygems.org/downloads/actionmailer-2.3.11.gem
wget http://rubygems.org/downloads/activeresource-2.3.11.gem
wget http://rubygems.org/downloads/rack-1.0.1.gem
wget http://rubygems.org/downloads/rails-2.3.5.gem
wget http://rubygems.org/downloads/activesupport-2.3.5.gem
wget http://rubygems.org/downloads/activerecord-2.3.5.gem
wget http://rubygems.org/downloads/actionpack-2.3.5.gem
wget http://rubygems.org/downloads/actionmailer-2.3.5.gem
wget http://rubygems.org/downloads/activeresource-2.3.5.gem
wget http://rubygems.org/downloads/i18n-0.4.2.gem
You can chech your downloaded files with me, see appendix 6.3.
2. Steps
2.0 Add Environment Variable
vim ~/.bashrc
And add the following lines:
export CYN_USR="$HOME/usr"
export CYN_DOWNLOAD="$HOME/download"
And execut:
source ~/.bashrc
Attention!!! You should NOT use $CYN_USR and $CYN_DOWNLOAD when you install redmine in your machine, it just an abbreviation of the full path, you should use the full path! $CYN_USR is the folder where the program installed, like the “Program Files” folder under Windows Opration System. $CYN_DOWNLOAD is the folder where I downloaded executable files and packages.
32bit/64bit??? The demo is tested under a 64bit operation system, and the 32bit operation system has the same steps. The only difference is the MySQL package, you should download a 32bit version, and the 32bit and 64bit version are in the same page of MySQL website. Other softwares are the same in 32bit or 64bit, because the ruby is cross-platform. What’s more, we will use source code to install the left softwares.
File list You can find what’s in folder $CYN_DOWNLOAD in the appendix 6.3.
2.1 MySQL Installation
cd $CYN_USR
tar zxvf $CYN_DOWNLOAD/mysql-5.1.60-linux-x86_64-glibc23.tar.gz
(OR tar zxvf $CYN_DOWNLOAD/mysql-5.1.60-linux-i686-glibc23.tar.gz in 32 bit system)
ln -s mysql-5.1.60-linux-x86_64-glibc23 mysql
(OR ln -s mysql-5.1.60-linux-i686-glibc23 mysql in 32 bit system)
cd mysql
scripts/mysql_install_db --user=work
The “work” is your linux user name, and you will get the prompt as appendix 6.1 shows
You can start the MySQL daemon with:
$CYN_USR/mysql/bin/mysqld_safe &
You can stop the MySQL daemon with:
$CYN_USR/mysql/bin/mysqladmin -u root -p SHUTDOWN
2.2 Apache Http Server Installation
cd $CYN_USR
tar zxvf $CYN_DOWNLOAD/httpd-2.2.21.tar.gz
cd httpd-2.2.21
./configure --prefix=$CYN_USR/httpd
make
make install
You can start/stop/restart your apache server with the following command:
$CYN_USR/httpd/bin/apachectl start
$CYN_USR/httpd/bin/apachectl stop
$CYN_USR/httpd/bin/apachectl restart
2.3 Ruby Installation
cd $CYN_USR
tar zxvf $CYN_DOWNLOAD/ruby-1.8.7-p174.tar.gz
cd ruby-1.8.7-p174
./configure --prefix=$CYN_USR/ruby
make
make install
2.4 Add Environment Variable
vim ~/.bashrc
And add the following lines:
export MYSQL_HOME="$CYN_USR/mysql"
export HTTPD_HOME="$CYN_USR/httpd"
export RUBY_HOME="$CYN_USR/ruby"
export PATH="$PATH:$RUBY_HOME/bin:$MYSQL_HOME/bin:$MYSQL_HOME/lib:$HTTPD_HOME/bin"
And execute
source ~/.bashrc
2.5 Rubygems Installation
cd $CYN_USR
tar zxvf $CYN_DOWNLOAD/rubygems-1.6.2.tgz
cd rubygems-1.6.2
ruby setup.rb
2.6 zlib Installation
cd $CYN_USR
tar zxvf $CYN_DOWNLOAD/zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure
make
make test
make install
cd $CYN_USR/ruby-1.8.7-p174/ext/zlib
ruby extconf.rb
make
make install
2.7 Rake, Rack and Rails Installation
Install rails 2.3.11 with:
cd $CYN_DOWNLOAD
gem install --local rake-0.8.7.gem
gem install --local rack-1.1.1.gem
gem install --local rails-2.3.11.gem
Install rails 2.3.5 with:
cd $CYN_DOWNLOAD
gem install --local rake-0.8.7.gem
gem install --local rack-1.0.1.gem
gem install --local activesupport-2.3.5.gem
gem install --local activerecord-2.3.5.gem
gem install --local actionpack-2.3.5.gem
gem install --local actionmailer-2.3.5.gem
gem install --local activeresource-2.3.5.gem
gem install --local rails-2.3.5.gem
2.8 i18n Installation
gem install --local i18n-0.4.2.gem
2.9 MySQL Configuration
mysql -u root -p
CREATE DATABASE redmine CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redminepwd';
GRANT ALL ON redmine.* TO 'redmine'@'localhost';
2.10 MySQL-Ruby Installation
cd $CYN_USR
tar zxvf $CYN_DOWNLOAD/mysql-ruby-2.8.2.tar.gz
cd mysql-ruby-2.8.2
ruby extconf.rb --with-mysql-dir=$CYN_USR/mysql
make
ruby ./test.rb -- localhost redmine redminepwd redmine 3306
make install
2.11 Passenger Installation
cd $CYN_USR
tar zxvf $CYN_DOWNLOAD/passenger-3.0.11.tar.gz
cd passenger-3.0.11
./bin/passenger-install-apache2-module
You will get the prompt like appendix 6.2
2.12 Redmine Installation
cd $CYN_USR
tar zxvf $CYN_DOWNLOAD/redmine-1.2.2.tar.gz
2.13 Redmine Configuration
cd $CYN_USR/redmine-1.2.2
cp config/database.yml.example config/database.yml
vim config/database.yml
In the config/database.yml file, modify the production/development/test session like this:
production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: redminepwd
encoding: utf8
And execute:
rake generate_session_store
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
2.14 Apache Server Configuration
In $CYN_USR/httpd/conf/httpd.conf add the following:
LoadModule passenger_module $CYN_USR/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot $CYN_USR/passenger-3.0.11
PassengerRuby $CYN_USR/ruby/bin/ruby
Listen 8085
<VirtualHost *:8085>
ServerName www.yourhost.com
DocumentRoot $CYN_USR/redmine-1.2.2/public
<Directory $CYN_USR/redmine-1.2.2/public>
AllowOverride all
Options -MultiViews
Options Indexes ExecCGI FollowSymLinks
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
2.15 Test your website
Visit http://localhost:8085/ in your browser.
3. Errors you may meet
To be added, and you can e-mail me or make comments on the end of this article.
4. Reference
[1] http://www.redmine.org/projects/redmine/wiki/RedmineInstall
[2] http://www.cnblogs.com/wuchang/archive/2011/10/04/2199018.html
5. More Information
5.1 Official websites
[3] http://www.ruby-lang.org/en/
[6] http://rack.rubyforge.org/
[7] http://tmtm.org/en/mysql/ruby/
5.2 Wikis
[1] http://en.wikipedia.org/wiki/Redmine
[2] http://en.wikipedia.org/wiki/Ruby_on_Rails
[3] http://en.wikipedia.org/wiki/Ruby_(programming_language)
6. Appendix
6.1 MySQL Installration
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h your_host_name password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
6.2 Passenger Installation
--------------------------------------------
The Apache 2 module was successfully installed.
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module $CYN_USR/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot $CYN_USR/passenger-3.0.11
PassengerRuby $CYN_USR/ruby/bin/ruby
After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!
Press ENTER to continue.
--------------------------------------------
Deploying a Ruby on Rails application: an example
Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
<VirtualHost *:80>
ServerName www.yourhost.com
DocumentRoot /somewhere/public # <-- be sure to point to 'public'!
<Directory /somewhere/public>
AllowOverride all # <-- relax Apache security settings
Options -MultiViews # <-- MultiViews must be turned off
</Directory>
</VirtualHost>
And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:
$CYN_USR/passenger-3.0.11/doc/Users guide Apache.html
Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/
Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
6.3 File list of $CYN_DOWNLOAD
actionmailer-2.3.11.gem
actionmailer-2.3.5.gem
actionpack-2.3.11.gem
actionpack-2.3.5.gem
activerecord-2.3.11.gem
activerecord-2.3.5.gem
activeresource-2.3.11.gem
activeresource-2.3.5.gem
activesupport-2.3.11.gem
activesupport-2.3.5.gem
httpd-2.2.21.tar.gz
i18n-0.4.2.gem
mysql-5.1.60-linux-i686-glibc23.tar.gz
mysql-5.1.60-linux-x86_64-glibc23.tar.gz
mysql-ruby-2.8.2.tar.gz
openssl-0.9.8k.tar.gz
passenger-3.0.11.tar.gz
rack-1.0.1.gem
rack-1.1.1.gem
rails-2.3.11.gem
rails-2.3.5.gem
rake-0.8.7.gem
redmine-1.2.2.tar.gz
ruby-1.8.7-p174.tar.gz
rubygems-1.3.7.tgz
rubygems-1.6.2.tgz
zlib-1.2.5.tar.gz
OK, that’s all of redmine installation, congratulations and thank you for your reading!