linux下redmine安装笔记

Redmine是用Ruby开发的基于web的项目管理软件,是用ROR框架开发的一套跨平台项目管理系统,据说是源于Basecamp的ror版而来,支持多种数据库,有不少自己独特的功能,例如提供wiki、新闻台等,还可以集成其他版本管理系统和BUG跟踪系统,例如SVN、CVS、TD等等。这种 Web 形式的项目管理系统通过“项目(Project)”的形式把成员、任务(问题)、文档、讨论以及各种形式的资源组织在一起,大家参与更新任务、文档等内容来推动项目的进度,同时系统利用时间线索和各种动态的报表形式来自动给成员汇报项目进度。

安装步骤:

一、安装ruby

下载ruby-1.8.7

http://www.ruby-lang.org/zh_cn/downloads

(wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p330.tar.gz)

#tar xzvf ruby-1.8.7.tar.gz

#cd ruby-1.8.7

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

#make && make install

设置环境变量

vim /etc/profile

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

source /etc/profile 直接生效

二、安装rubygems

如果系统中已经存在rubygems,可以通过如下方法卸载:

#ruby -e ‘puts $:’ //查找rubygems安装目录

#cd /usr/local/ruby/lib/ruby/site_ruby/1.8/

#rm -rf ubygems.rb rubygems rubygems.rb

#which gem gem1.8 //查找gem包的安装目录

#rm -rf /usr/local/ruby/bin/gem

下载rubygems-1.3.5

http://rubyforge.org/frs/?group_id=126

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

#tar zxvf rubygems-1.3.5

#cd rubygems-1.3.5

#ruby setup.rb

#gem -v //查看版本

注意:开始时把rubygems更新到最新版本1.6.2了,最后用rake创建表时失败,郁闷。

安装完rubygems后注意修改更新站点(前提要能上网),否则有的包可能无法正常安装。

#gem source -r http://gems.rubyforge.org 删除以前的更新站点

#gem source -a http://rubygems.org 添加现在的更新站点

三、安装rails

先安装:1. yum install -y zlib zlib-devel

2.进入ruby的解压目录(/ruby-1.8.7/ext/zlib),到ext/zlib下,执行命令:ruby extconf.rb

3.make;make install

#gem install rails -v=2.3.5

出错时的解决办法:(root@localhost rubygems-1.3.6]#

/usr/local/ruby/bin/gem install rails -v=2.3.4

/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’:

no such file to load — zlib (LoadError)
from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/package.rb:10
from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/format.rb:9
from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/installer.rb:10
… 11 levels…
from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:133:in `process_args’
from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:104:in `run’
from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run’
from /usr/local/ruby/bin/gem:21

解决方法:

1. yum install -y zlib zlib-devel

2.进入ruby的解压目录,到ext/zlib下,执行命令:ruby extconf.rb

3.make;make install)

Fetching: rake-0.8.7.gem (100%)

Fetching: activesupport-2.3.5.gem (100%)

Fetching: activerecord-2.3.5.gem (100%)

Fetching: rack-1.0.1.gem (100%)

Fetching: actionpack-2.3.5.gem(100%)

Fetching: actionmailer-2.3.5.gem(100%)

Fetching: activeresource-2.3.5.gem(100%)

Successfully installed rake-0.8.7

Successfully installed activesupport-2.3.5

Successfully installed activerecord-2.3.5

Successfully installed rack-1.0.1

Successfully installed actionpack-2.3.5

Successfully installed actionmailer-2.3.5

Successfully installed activeresource-2.3.5

Successfully installed rails-2.3.5

8 gems installed

Installing ri documentation for rake-0.8.7…

Installing ri documentation for activesupport-2.3.5…

Installing ri documentation for activerecord-2.3.5…

Installing ri documentation for rack-1.0.1…

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 rake-0.8.7…

Installing RDoc documentation for activesupport-2.3.5…

Installing RDoc documentation for activerecord-2.3.5…

Installing RDoc documentation for rack-1.0.1…

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…

四、安装i18n

#gem install i18n -v=0.4.2

Fetching:i18n-0.4.2.gem (100%)

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…

五、安装ruby-mysql

#gem install ruby-mysql

Successfully installed ruby-mysql-2.9.4

1 gem installed

Installing ri documentation for ruby-mysql-2.9.4…

Installing RDoc documentation for ruby-mysql-2.9.4…

补充 mysql的安装:

创建mysql用户名,用户组

# groupadd mysql

# useradd -g mysql mysql

下载mysql源码 http://download.mysql.cn/download_file/gz/5.0/mysql-5.0.22.tar.gz

tar -zxvf mysql-5.0.22.tar.gz

#cd mysql-5.0.22

(Mysql编译出错解决办法:

[root@myserver lamp]#checking for termcap functions library… configure: error: No curses/termca

如果编译时出现了以下错误:
checking for tgetent in -ltermcap… no
checking for termcap functions library… configure: error: No curses/termcap library found
说明 curses/termcap 库没有安装
去下载一个ncurses-5.6.tar.gz,
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz
tar zxvf ncurses-5.6.tar.gz
cd ncurses-5.6
./configure –prefix=/usr –with-shared –without-debug
make
make install clean

然后再重新编译Mysql进行安装。发现还是不行!

这下可苦 了我了,继续查找下,

[root@myserver lamp]# rpm -ivh /RPMS/Server/ncurses-
ncurses-5.5-24.20060715.i386.rpm ncurses-devel-5.5-24.20060715.i386.rpm
[root@myserver lamp]# rpm -ivh /RPMS/Server/ncurses-devel-5.5-24.20060715.i386.rpm
warning: /RPMS/Server/ncurses-devel-5.5-24.20060715.i386.rpm: Header V3

DSA signature: NOKEY, key ID 37017186
Preparing… ########################################### [100%]
1:ncurses-devel ########################################### [100%]
[root@myserver lamp]#

现在就可以重新编译Mysql进行安装。)

#./configure –prefix=/usr/local/mysql

–datadir=/mydata //数据库存放目录

–with-charset=utf8 //使用UTF8格式

–with-extra-charsets=complex //安装所有的扩展字符集

–enable-thread-safe-client //启用客户端安全线程

–with-big-tables //启用大表

–with-ssl //使用SSL加密

–enable-local-infile //允许从本地导入数据

–enable-assembler //汇编x86的普通操作符,可以提高性能

–with-plugins=innobase //数据库插件

–with-plugins=partition //分表功能,将一个大表分割成多个小表

#make && make install

初始化mysql数据库

#chown -R mysql:mysql /usr/local/mysql

#cp mysql-5.0.22/support-files/my-medium.cnf /etc/my.cnf

#cd /usr/local/mysql

#bin/mysql_install_db –user=mysql

#chown -R mysql:mysql /usr/local/mysql/var/ //把初始化的数据库目录给MySQL所有者

#/usr/local/mysql/bin/mysqld_safe –user=mysql & //启动MySQL

配置开机自动启动

#cp mysql-5.0.22/support-files/mysql.server /etc/init.d/mysqld

#chmod 755 /etc/init.d/mysqld

#chkconfig –add mysqld

#chkconfig mysqld on

#service mysqld restart

补充 mysql的配置:

配置my.cnf (/etc/my.cnf)

配置主要把安装的目录的那几项打开就行.

改动如下:

[client]
#password = your_password
port = 3306
socket = /tmp/mysql3306.sock

# The Mysql server
[Mysqld]
port = 3306
socket = /tmp/mysql3306.sock

打开下面几项
innodb_data_home_dir = /usr/local/mysql/var/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/var/
innodb_log_arch_dir = /usr/local/mysql/var/

六、安装redmine

注意redmine的版本

Redmine version

Supported Ruby versions

Required Rails version

Required Rack version

current trunk

ruby1.8.6, 1.8.7

Rails2.3.11

Rack1.1.0

trunk from r2887 tor4903

ruby1.8.6, 1.8.7

Rails2.3.5

Rack1.0.1

trunk from r2493 tor2886

ruby1.8.6, 1.8.7

Rails2.2.2
trunk before r2493

ruby1.8.6, 1.8.7

Rails2.1.2
1.1.x

ruby1.8.6, 1.8.7

Rails2.3.5

Rack1.0.1

1.0.x

ruby1.8.6, 1.8.7

Rails2.3.5

Rack1.0.1

0.9.x

ruby1.8.6, 1.8.7

Rails2.3.5

Rack1.0.1

0.8.x

ruby1.8.6, 1.8.7

Rails2.1.2
下载redmine-1.1.0

#mkdir /usr/local/redmine

#cd /usr/local/redmine

#svn co http://redmine.rubyforge.org/svn/branches/1.0-stable redmine-1.0

#cd /usr/local/redmine/redmine-1.0/config

#cp database.yml.example database.yml

#vim database.yml //数据库配置文件

production:

adapter: mysql

database:redmine

host: localhost

username: root //数据库访问用户名

password: “123456″ //数据库访问密码

encoding: utf8

使用rake创建表

# rake db:migrate RAILS_ENV=”production”

一、(如出现如下异常

rake/rdoctask is deprecated(obsolete and no longer supported).

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)

二、(no such file to load – openssl错误解决办法:install libopenssl-ruby)

a.报错:uninitialized constant ActiveSupport::Dependencies::Mutex

解决方法:rails和rubygems版本不匹配,rubygems降到1.3.5试试

b.报错: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

c.报错: No such file or directory – /tmp/mysql.sock

解决方法: 由于之前在mysql配置时my.cnf配置了socket导致

vim config/database.yml

在production栏目最后一行添加 socket: /tmp/mysql3306.sock

注意: socket的“:”后面必须有个空格,再接”/tmp/mysql3306.sock”

d.报错:

!!! The bundled mysql.rb driver has been removed from Rails 2.2.

Please install the mysql gem and try again: gem install mysql.

rake aborted!

需要安装mysql适配器。gem install mysql

e.报错1:

Access denied for user ‘mysql’@'localhost’ (using password: YES)

解决办法:

#mysql

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 2

Server version:5.0.22-log

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.

mysql>

mysql>grant all privileges on *.* to ‘mysql’@'localhost’ identified by ‘mysql’ with grant option;

mysql>flush privileges;

mysql>exit;

e.报错2:

Access denied for user ‘root’@'localhost’ (using password: YES)

解决办法:

service mysqld stop

/usr/local/mysql/bin/mysqld_safe –user=mysql –skip-grant-tables –skip-networking &

# mysql -u root mysql

mysql> UPDATE user SET Password=PASSWORD(‘newpassword’) where USER=’root’;

mysql> FLUSH PRIVILEGES;

mysql>quit

service mysqld restart

mysql -uroot –p

Enter password:
mysql>

f.报错:Unknown database ‘redmine’

解决办法:创建数据库redmine

mysql>create database redmine;

加载默认配置

# rake redmine:load_default_data RAILS_ENV=”production”

这里会要求选择默认语言,选中文zh:
Select language: bg, ca, cs, da, de, en, es, fi, fr, he, hu, it, ja, ko, lt, nl, no, pl,

pt, pt-br, ro, ru, sk, sr, sv, th, tr, uk, vn, zh, zh-tw [en] zh

这个默认设置只是在未登录时的界面语言,当用户登录后,默认语言还是英语,在My account里可以修改成其它语言。

启动WEB服务

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

更换web服务器

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

使用网上推荐的 mongrel

# gem install mongrel

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

本机ip为192.9.100.106,至此在本机使用http://192.9.100.106:3000 或 http://127.0.0.1:3000均能访问,但局域网其他机器仍然无法访问。

原因:redhat防火墙屏蔽了端口3000

解决办法: 配置防火墙,开放宽口3000

# /sbin/iptables -I INPUT -p tcp –dport 3000 -j ACCEPT

# /etc/rc.d/init.d/iptables save

# service iptables restart

至此,redmine安装完成。后面需要完成redmine、apache、subversion的整合。

以上安装在虚拟机上完成,PC 192.9.100.105上始终安装不上,一样的步骤,在gem install时老提示:

ERROR: http://gems.rubyforge.org/ does not appear to be a respository

ERROR: While executing gem … (Gem::RemoteFetcher::FetchError)

bad response Not Found 404 (http://gems.rubyforge.org/yaml)

Redmine邮件的配置

修改Redmine下文件夹config中的email.yml,信息如下:

production:
delivery_method: :smtp
smtp_settings:
address: mail.XXXXX
port: 25
domain: XXXXX.com
# authentication: :login
# user_name: [email protected]
# password: XXXXXX

development:
delivery_method: :smtp
smtp_settings:
address: mail.XXXXX
port: 25
domain: XXXXX.com
# authentication: :login
# user_name: [email protected]
# password: XXXXXX

注意用#注销掉的那三行信息,那是邮件服务器身份验证信息,但是如果你的用户已经使用了域验证,就不需要那三行信息,像我自己用的就是内部的邮件服务器(MS Exchange),就无须身份验证的必要。如果使用的是外面邮件服务器,一般是需要的;参数设置好了,然后重启Redmine服务,在配置中设置好发送邮件的帐号,然后测试。

你可能感兴趣的:(linux下redmine安装笔记)