0. Environment
CentOS 6.0 32bit (CentOS-6.0-i386-bin-DVD.iso)
1.Steps
1.1 Mount CD
$ mkdir /mnt/cdrom
$ mount /dev/cdrom /mnt/cdrom
1.2 Install rpm packages
$ cd /mnt/cdrom/Packages
$ rpm -ivh ppl-0.10.2-11.el6.i686.rpm
$ rpm -ivh cloog-ppl-0.15.7-1.2.el6.i686.rpm
$ rpm -ivh mpfr-2.4.1-6.el6.i686.rpm
$ rpm -ivh cpp-4.4.4-13.el6.i686.rpm
$ rpm -ivh kernel-headers-2.6.32-71.el6.i686.rpm
$ rpm -ivh glibc-headers-2.12-1.7.el6.i686.rpm
$ rpm -ivh glibc-devel-2.12-1.7.el6.i686.rpm
$ rpm -ivh gcc-4.4.4-13.el6.i686.rpm
$ rpm -ivh libstdc++-devel-4.4.4-13.el6.i686.rpm
$ rpm -ivh gcc-c++-4.4.4-13.el6.i686.rpm
2. Reference
[1] http://whbill.blog.51cto.com/3280780/707092
In this blog, the author installed the following packages, but in my experiment, there is no need to install all of them
rpm -ivh glibc-common-2.12-1.7.el6.i686.rpm
rpm -ivh kernel-headers-2.6.32-71.el6.i686.rpm
rpm -ivh libgcc-4.4.4-13.el6.i686.rpm
rpm -ivh glibc-2.12-1.7.el6.i686.rpm
rpm -ivh mpfr-2.4.1-6.el6.i686.rpm
rpm -ivh cpp-4.4.4-13.el6.i686.rpm
rpm -ivh libgomp-4.4.4-13.el6.i686.rpm
rpm -ivh nscd-2.12-1.7.el6.i686.rpm
rpm -ivh glibc-headers-2.12-1.7.el6.i686.rpm
rpm -ivh glibc-devel-2.12-1.7.el6.i686.rpm
rpm -ivh ppl-0.10.2-11.el6.i686.rpm
rpm -ivh cloog-ppl-0.15.7-1.2.el6.i686.rpm
rpm -ivh gcc-4.4.4-13.el6.i686.rpm
rpm -ivh libstdc++-4.4.4-13.el6.i686.rpm
rpm -ivh libstdc++-devel-4.4.4-13.el6.i686.rpm
rpm -ivh gcc-c++-4.4.4-13.el6.i686.rpm
1、添加用户
1)Ubuntu 10.04
useradd dbrg –d /usr/dbrg -m -s /etc/bash
2)CentOS 6.0
useradd dbrg –d /home/dbrg -m -s /bin/bash
2、修改用户密码
passwd dbrg
3、查看用户(组)
1)查看当前登录用户名
whoami
2)查看dbrg用户详细信息
id dbrg
3)查看当前登录用户所在的组
groups
4)查看dbrg用户所在的组
groups dbrg
4、用户(组)相关文件
1)组文件
/etc/group
2)用户文件
/etc/shadow
/etc/passwd
5、sudo权限管理
/etc/sudoers
/etc/sudoers.d
0. 简介
0.1 基础概念
[Redmine] Redmine是用Ruby开发的基于web的项目管理软件,是用ROR框架开发的一套跨平台项目管理系统,据说是源于Basecamp的ror版而来,支持多种数据库,有不少自己独特的功能,例如提供wiki、新闻台等,还可以集成其他版本管理系统和BUG跟踪系统,例如SVN、CVS、TD等等。(百度百科)
[Ruby on Rails] Ruby on Rails 是一个可以使你开发,部署,维护 web 应用程序变得简单的框架。(百度百科)
0.2 本文说明
1)本文没有使用apt-get和yum命令,所以对于各种linux的发行版本都适用,包括ubuntu,fedora,centos,redhat等。
2)作者在32位和64位系统下均测试成功,本文提供的方法支持32位和64位系统,有不同的地方在文中都已标明。
3)本文支持两个Redmine版本,分别是1.1.0和1.2.2,细微差别也在文中说明,请读者按照1.2资源下载表格中对应的版本进行安装,因为Redmine对于版本是敏感的,必须是特定版本,不能过高也不能过低,其他组合不保证部署成功。
4)作者在写作本文的时候Redmine已出另一个更新版本1.3.0,后续本文会作相应更新。
5)有任何问题,欢迎留言或发邮件沟通。
1. 环境 & 资源下载
1.1 环境
Red Hat Enterprise Linux AS release 4 (Nahant Update 3) 64bit
GCC 3.4.5
1.2 资源下载
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/)
curl 7.23.1 (http://curl.haxx.se/)
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
你可以和本文附录6.4的下载文件列表进行对比。
2. 步骤
2.0 添加环境变量
打开用户目录下的.bashrc文件
vim ~/.bashrc
在.bashrc文件中添加下面两行:
export CYN_USR="$HOME/usr" export CYN_DOWNLOAD="$HOME/download"
执行下面的语句使环境变量设置立即生效,而不用重启
source ~/.bashrc
注意!!! 你完全不必使用$CYN_USR和$CYN_DOWNLOAD,它们只是方便我后面的操作以及目录描述,强烈推荐大家使用绝对路径。在本文中,$CYN_USR表示我的程序安装目录,就像windows系统中的C:\Program Files目录一样,$CYN_DOWNLOAD是我下载安装包的保存路径。
32位还是64位??? 本文的演示是在64位linux上做的,但我也在32位机器上部署过Redmine,步骤上是一样的。唯一的不同就是MySQL的安装包不一样,有32位和64位之分,它们的下载地址是相同的。还有一些软件采用源代码安装方式,也避免了选择32位还是64位的问题。其他基于ruby的软件,因为ruby的跨平台性安装包和部署方法没有差别。
$CYN_DOWNLOAD文件列表 作者的$CYN_DOWNLOAD目录内容见本文的附录6.4。
2.1 安装MySQL
cd $CYN_USR tar zxvf $CYN_DOWNLOAD/mysql-5.1.60-linux-x86_64-glibc23.tar.gz (或者在32位系统中 tar zxvf $CYN_DOWNLOAD/mysql-5.1.60-linux-i686-glibc23.tar.gz) ln -s mysql-5.1.60-linux-x86_64-glibc23 mysql (或者在32位系统中 ln -s mysql-5.1.60-linux-i686-glibc23 mysql) cd mysql scripts/mysql_install_db --user=work
其中,work是你的linux用户名,有的文章说新建一个mysql用户组和一个mysql用户,读者可以尝试
安装后MySQL会有提示,参考本文附录6.1
开启MySQL服务:
$CYN_USR/mysql/bin/mysqld_safe &
关闭MySQL服务:
$CYN_USR/mysql/bin/mysqladmin -u root -p SHUTDOWN
2.2 安装Apache Http服务器
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
开启、关闭、重启apache服务器:
$CYN_USR/httpd/bin/apachectl start $CYN_USR/httpd/bin/apachectl stop $CYN_USR/httpd/bin/apachectl restart
2.3 安装Ruby
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 为MySQL、Apache、Ruby添加环境变量
vim ~/.bashrc
在用户目录下的.bashrc文件中添加下面几行内容:
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"
执行下面语句让配置立即生效:
source ~/.bashrc
2.5 安装Rubygems
cd $CYN_USR tar zxvf $CYN_DOWNLOAD/rubygems-1.6.2.tgz cd rubygems-1.6.2 ruby setup.rb
2.6 安装zlib
这个包应该是和解压.gem包有关
cd $CYN_USR tar zxvf $CYN_DOWNLOAD/zlib-1.2.5.tar.gz cd zlib-1.2.5 ./configure --prefix=$CYN_USR/zlib make make test make install cd $CYN_USR/ruby-1.8.7-p174/ext/zlib ruby extconf.rb --with-zlib-include=$CYN_USR/zlib/include --with-zlib-lib=$CYN_USR/zlib/lib/ make make install
2.7 安装Rake、Rack和Rails
如果你要配置Redmine-1.2.2,请安装rails-2.3.11,act*-2.3.11.gem会自动安装,但要保证和rails-2.3.11.gem在同一个目录下:
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
如果你要配置Redmine-1.1.0,请安装rails-2.3.5:
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
gem install --local i18n-0.4.2.gem
2.9 配置MySQL
新建一个名为redmine的数据库,新建一个名为redmine的用户,密码是redminepwd,并赋予对名为redmine的数据库的所有权限
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
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 $CYN_USR/mysql/mysql.sock make install
2.11 安装Openssl
cd $CYN_USR tar zxvf $CYN_DOWNLOAD/openssl-0.9.8k.tar.gz cd openssl-0.9.8k ./config --prefix=$CYN_USR/openssl make make test make install cd $CYN_USR/ruby-1.8.7-p174/ext/openssl ruby extconf.rb --with-openssl-include=$CYN_USR/openssl/include/ --with-openssl-lib=$CYN_USR/openssl/lib/ make make install
2.12 安装cURL
cd $CYN_USR tar zxvf $CYN_DOWNLOAD/curl-7.23.1.tar.gz cd curl-7.23.1 ./configure --prefix=$CYN_USR/curl --with-ssl=$CYN_USR/openssl --with-zlib=$CYN_USR/zlib make make test (optional) make install
在./configure后有提示语句,见本文附录6.3
2.13 为cURL、OpenSSL、zlib添加环境变量
vim ~/.bashrc
在用户目录下的.bashrc文件中添加下面几行内容:
export ZLIB_HOME="$CYN_USR/zlib" export OPENSSL_HOME="$CYN_USR/openssl" export CURL_HOME="$CYN_USR/curl" export CPATH="$CURL_HOME/include:$ZLIB_HOME/include:$OPENSSL_HOME/include:$CPATH" export PATH="$CURL_HOME/bin:$OPENSSL_HOME/bin:$PATH"
执行下面语句让配置立即生效:
source ~/.bashrc
2.14 安装Passenger
passenger可以让apache服务器搭载ruby on rails网站
cd $CYN_USR tar zxvf $CYN_DOWNLOAD/passenger-3.0.11.tar.gz cd passenger-3.0.11 ./bin/passenger-install-apache2-module
安装完成后会有类似附录6.2的提示
2.15 安装Redmine
cd $CYN_USR tar zxvf $CYN_DOWNLOAD/redmine-1.2.2.tar.gz
2.16 配置Redmine
主要是配置数据库
cd $CYN_USR/redmine-1.2.2 cp config/database.yml.example config/database.yml vim config/database.yml
在config/database.yml文件中,修改production/development/test节的内容,填写数据库信息,下面是production节的示例
production: adapter: mysql database: redmine host: localhost username: redmine password: redminepwd encoding: utf8 socket: $CYN_USR/mysql/mysql.sock
执行下面三条语句,初始化数据库,建立表结构,并且写入相应数据
rake generate_session_store RAILS_ENV=production rake db:migrate RAILS_ENV=production rake redmine:load_default_data
可以执行下面的语句在rails自带服务器webrick上测试redmine
ruby script/server webrick -p 3000 -e production
2.17 配置Apache Server
在$CYN_USR/httpd/conf/httpd.conf文件中添加下面内容,注意把$CYN_USR换成你的绝对路径
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.18 测试网站
在浏览器中访问http://localhost:8085/
3. 可能遇到的问题
本部分内容有待添加,欢迎读者留言与我讨论
3.1 MySQL安装出现权限问题
我在CentOS上测试的时候,发现无法使用低权限用户把MySQL安装到redmine要安装的目录下,只有使用root用户将MySQL安装到/usr/local/mysql目录下,也就是安装包里面说的方法,代码如下(注意,需要root用户来执行):
4. 引用
[1] http://www.redmine.org/projects/redmine/wiki/RedmineInstall
[2] http://www.cnblogs.com/wuchang/archive/2011/10/04/2199018.html
5. 更多信息
5.1 官方网站
[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)
5.3 Windows上的安装
方法一:
安装instantrails(http://rubyforge.org/projects/instantrails)是一种方式,但是不推荐,会出现路径错误,因为它的开发者是在D盘下打的包,经过测试路径可能写死了,不方便我们移到别的文件夹下
将下载的InstantRails-2.0-win.zip文件解压到不包含空格的目录下,推荐系统盘根目录
方法二:
(1)安装MySQL
推荐5.1版本(http://www.mysql.com/downloads/mysql/5.1.html)
(2)安装ruby
下载地址:http://rubyforge.org/frs/?group_id=167
(3)安装rubygems
同linux
(4)安装rake、rack、rails
同linux
(5)安装i18n
同linux
(6)安装mysql-ruby
下载地址:http://rubyforge.org/frs/?group_id=1598
下载文件:mysql-2.8.1-x86-mswin32.gem
在cmd下运行
gem install --local mysql-2.8.1-x86-mswin32.gem
然后拷贝下的$MYSQL_HOME/lib/libmysql.dll文件到$RUBY_HOME/bin/目录下
6. 附录
6.1 安装MySQL的提示
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的提示
--------------------------------------------
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 安装cURL的提示
curl version: 7.23.1 Host setup: i686-pc-linux-gnu Install prefix: /home/yineng/usr/curl Compiler: gcc SSL support: enabled (OpenSSL) SSH support: no (--with-libssh2) zlib support: enabled krb4 support: no (--with-krb4*) GSSAPI support: no (--with-gssapi) SPNEGO support: no (--with-spnego) TLS-SRP support: no (--enable-tls-srp) resolver: default (--enable-ares / --enable-threaded-resolver) ipv6 support: enabled IDN support: no (--with-libidn) Build libcurl: Shared=yes, Static=yes Built-in manual: enabled Verbose errors: enabled (--disable-verbose) SSPI support: no (--enable-sspi) ca cert bundle: /etc/pki/tls/certs/ca-bundle.crt ca cert path: no LDAP support: no (--enable-ldap / --with-ldap-lib / --with-lber-lib) LDAPS support: no (--enable-ldaps) RTSP support: enabled RTMP support: no (--with-librtmp) Protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP
6.4 目录$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
curl-7.23.1.tar.gz
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
本文的英文版:http://www.cnblogs.com/chenyineng/archive/2011/12/21/2295984.html
OK, 这就是Redmine部署的全部内容,恭喜你完成Redmine的部署,感谢你的阅读!
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!
0. Introduction
We can use "计划任务" to do some work which should be done frequently and timely. Such as run a software when your Windows start up or at 9 o'clock everyday etc.
1. Environment
My testing os is Windows XP, and it should be contained in other versions of Windows.
2. Steps
Start - All Program - 附件 - 系统工具 - 计划任务
It is easy to configure, so have fun yourself!