安装Redmine1.1.3+nginx

1、安装ruby

Redmine要求安装ruby1.8.7, 下载ruby-1.8.7

#wget  ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p302.tar.gz

(若提示wget没有安装,安装wget

#yum install wget

 #tar zxvf ruby-1.8.7-p302.tar.gz

#cd ruby-1.8.7-p302

# ./configure --prefix=/usr/local/ruby

# make && make install

#yum -y install make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel

 

设置Ruby环境变量

# vi /etc/profile

在已有的export下面添加一行

export PATH=/usr/local/ruby/bin:$PATH

保存退出:wq

# source /etc/profile 直接生效

 

2RubyGems安装

1.2.1要求的rubygems,的版本为:1.3.5,下载

# wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz

# tar zxvf rubygems-1.3.5.tgz

# cd rubygems-1.3.5

# ruby setup.rb

# Gem -v  //查看当前版本

如果rubygems版本过高或过低,都会导致rake失败。

 

3、安装rake

# gem install rake -v=0.8.7

Successfully installed rake-0.8.7

1 gem installed

Installing ri documentation for rake-0.8.7...

Installing RDoc documentation for rake-0.8.7...

4、安装rack

#gem install rack -v=1.0.1

Successfully installed rack-1.0.1

1 gem installed

Installing ri documentation for rack-1.0.1...

Installing RDoc documentation for rack-1.0.1...

5、安装rails 

# gem install rails -v=2.3.5  

Successfully installed activesupport-2.3.5

Successfully installed activerecord-2.3.5

Successfully installed actionpack-2.3.5

Successfully installed actionmailer-2.3.5

Successfully installed activeresource-2.3.5

Successfully installed rails-2.3.5

6 gems installed

Installing ri documentation for activesupport-2.3.5...

Installing ri documentation for activerecord-2.3.5...

Installing ri documentation for actionpack-2.3.5...

Installing ri documentation for actionmailer-2.3.5...

Installing ri documentation for activeresource-2.3.5...

Installing ri documentation for rails-2.3.5...

Installing RDoc documentation for activesupport-2.3.5...

Installing RDoc documentation for activerecord-2.3.5...

Installing RDoc documentation for actionpack-2.3.5...

Installing RDoc documentation for actionmailer-2.3.5...

Installing RDoc documentation for activeresource-2.3.5...

Installing RDoc documentation for rails-2.3.5...

6、安装i18n

#gem install i18n -v=0.4.2

Successfully installed i18n-0.4.2

1 gem installed

Installing ri documentation for i18n-0.4.2...

Installing RDoc documentation for i18n-0.4.2...

7、安装mysql驱动

#gem install mysql

8、安装mysql

(如果mysql已经安装,这里给跳过)

 

安装rpm包:

#rpm -ivh MySQL-client-community-5.0.37-0.rhel4.i386.rpm

#rpm -ivh MySQL-devel-community-5.0.37-0.rhel4.i386.rpm

#rpm -ivh MySQL-server-community-5.0.37-0.rhel4.i386.rpm

 

如果在安装的过程中发现系统中已经有其他的mysql的版本存在,需要先将系统中原有的版本卸载,如下图所示

可以使用命令

#rpm  -e  --nodeps  mysql-4.1.20-1.RHEL4.1.i386

卸载后再安装5.0.37的版本

 

如果出现类似libc.so.6()(64bit) is needed by MySQL-server-community-5.1.47-1.rhel5.x86_64这样的错误,就卸掉原来的版本,直接用

# yum -y install mysql-server

#mysq       //安装或使用mysql过程中,会遇到很多奇怪的问题,百度或谷歌一下就知道啦,这里就不复述了,会占用很大篇幅的

(基于大数据量的考虑,要把mysql数据文件放在大的硬盘下,需要修改mysql的配置文件,相当的繁琐)

9、下面创建redmine

mysql> create database redmine character set utf8;

mysql> create user 'redmine'@'localhost' identified by 'redmine';

mysql> grant all privileges on redmine.* to 'redmine'@'localhost';

 

10、安装redmine

# wget http://rubyforge.org/frs/download.php/74722/redmine-1.1.3.tar.gz

# tar zxvf redmine-1.1.3.tar.gz

# mv redmine-1.1.3 /usr/local/redmine

# cp database.yml.example database.yml

链接数据库

# vi config/database.yml

production:

  adapter: mysql

  database:redmine

  host: localhost

  username: redmineuser

  password: redminepw

  encoding: utf8

保存退出:wq

 

11、接下来创建数据库

#rake db:migrate RAILS_ENV="production"

# rake redmine:load_default_data RAILS_ENV="production

默认语言选择zh

报错1

rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
WARNING: 'task :t, arg, :needs => [deps]' is deprecated.  Please use 'task :t, [
args] => [deps]' instead. at D:/Downloads/ruby/redmine-1.1.3/lib/tasks/email.rake:170
这是因为rake版本太高造成的。
解决办法:
先执行gem list rake 查看rake版本。若果高于0.8.7那就是太高了(比方说0.9.0)。
这样的话就需要卸载0.9.0的,安装0.8.7的。
gem uninstall rake -v=0.9.0
gem install rake -v=0.8.7

 

报错2

rake aborted!

A key is required to write a cookie containing the session data. Use config.action_controller.session = { :key => "_myapp_session", :secret => "some secret phrase" } in config/environment.rb

解决办法:

rake config/initializers/session_store.rb

防火墙停止:service iptables stop

报错3

rake aborted!

No such file or directory - /tmp/mysql.sock

(See full trace by running task with --trace)

解决方法:

config/database.yml

修改成和my.cnf一样的路径,即在production最下面加一行:

Socket:/data/mysqldata/mysql/mysql.sock

 

报错4

rake aborted!

Access denied for user 'redmine'@'localhost' (using password: YES)

解决方法:

解决数据库用户的权限,问题基本上就解决了

 

12、启动web服务

# ruby script/server webrick -e production

# ruby /usr/local/redmine/script/server webrick -e production

 

13、更换web服务器

Redmine自带的webrick太慢,特别是局域网,据说是需要解析目标地址的主机名,直接给IP不用,硬要绕一圈。

使用网上推荐的mongrel

#gem install mongrel

#ruby /usr/local/redmine/script/server mongrel -e production

这样,服务器加端口号,就可以访问了,如本机IP192.168.2.153,访问如下地址即可192.168.2.153

另外,如果想让server在后台运行,请在启动程序后面加参数d,如下所示:

#ruby /usr/local/redmine/script/server mongrel -e production –d

14、更改nginx配置

首先安装好nginx,安装步骤就不累述了。
13步做完之后就启动了mongrel web server以及之上的rails, redmine, 并且占用了3000端口。
然后,在nginx的配置/etc/nginx/nginx.conf中,加入如下配置 

server { 
        listen 80; 
        server_name redmine.xxxxxxxx.com; 

        root  /usr/local/redmine/public; 

        location / { 
        proxy_pass http://xxxxxxxx.com:3000; 
                proxy_redirect off; 
                proxy_set_header Host $host;  #
注:这个不传进去,会暴露端口号,且会影响速度 
                proxy_set_header X-Real-IP $remote_addr; 
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        } 


配置好后,重启一下nginx服务,就OK了。

Redmine的安装文档网上有很多,但有些并未给出安装Redmine时一些依赖的软件版本。Redmine安装时需要依赖一些其它的软件。

 如果这些软件的版本有问题,会给安装带来比较大的麻烦。

参考文档:

redmine安装文档:

http://redmine.ossxp.com/redmine/documents/3

rubyrails的版本对应 :

http://www.redmine.org/projects/redmine/wiki/RedmineInstall

你可能感兴趣的:(职场,休闲,readmin)