linux(CentOS,fedora)服务器上redmine的全套安装与配置(ruby,rubygems,rails,ruby-mysql ,各种报错与解决方法)
经过几天的努力,几乎翻遍网上的所有资料,终于完成的redmine的安装与配置.现在分享给大家,希望对后来者能有所帮助.
此文虽为原创,但广大网民功不可没,在此先表示感谢.(如有安装包需求,请来我共享里下载.)
ps:有些版本 会造成 中文 返回 报错,尝试其他版本 便可以解决。
正文起:
1. 安装gcc
yum install gcc
2. 创建下载目录
cd /mnt
mkdir redmine
cd redmine/
3. 下载 ruby-1.9.2-p290.tar.gz
wget -P . http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz
chmod 777 ruby-1.9.2-p290.tar.gz
tar xzvf ruby-1.9.2-p290.tar.gz
cd ruby-1.9.2-p290
./configure -prefix=/usr/local/1.9.2ruby
make && make install
export PATH=/usr/local/1.9.2ruby/bin:$PATH (添加到配置文件最好)
cd ..
4. 下载 rubygems-1.4.2.tgz
wget -P . http://rubyforge.org/frs/download.php/73882/rubygems-1.4.2.tgz
chmod 777 rubygems-1.4.2.tgz
tar xzvf rubygems-1.4.2.tgz
cd rubygems-1.4.2
ruby setup.rb
报错undefined method `path' for Gem:Module (NoMethodError)
不用管
cd ..
5. yum install zlib-devel
cd ruby-1.9.2-p290
cd ext
cd zlib
ruby extconf.rb
make
make install
cd ..
cd ..
cd ..
6. 安装rails
gem install rails -v=3.0.3
显示以下字符安装成功
Successfully installed thor-0.14.6
Successfully installed railties-3.0.3
Successfully installed bundler-1.0.18
Successfully installed rails-3.0.3
23 gems installed
Installing ri documentation for activesupport-3.0.3...
Installing ri documentation for builder-2.1.2...
Installing ri documentation for i18n-0.6.0...
..........
Installing RDoc documentation for thor-0.14.6...
Installing RDoc documentation for railties-3.0.3...
Installing RDoc documentation for bundler-1.0.18...
Installing RDoc documentation for rails-3.0.3...
rails -v
Rails 3.0.3
7. 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...
8. 安装mysql
yum -y install mysql-server
service mysqld start
mysqladmin -u root password 'gonsin'
mysql -u root -p
gonsin
quit
9. 安装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...
ERROR: While generating documentation for ruby-mysql-2.9.4
... MESSAGE: Error while evaluating /usr/local/1.9.2ruby/lib/ruby/1.9.1/rdoc/generator/template/darkfish/classpage.rhtml: undefined method `accept' for nil:NilClass (at "\n\n\t\t\t\t<div class=\"method-description\">\n\t\t\t\t\t\n\t\t\t\t\t")
... RDOC args: lib README.rdoc ChangeLog
(continuing with the rest of the installation)
8. 安装redmine
wget -P . http://rubyforge.org/frs/download.php/74944/redmine-1.2.0.tar.gz
chmod 777 redmine-1.2.0.tar.gz
tar xzvf redmine-1.2.0.tar.gz
mkdir /usr/local/redmine
cd /usr/local/redmine
cp -r /mnt/redmine/redmine-1.2.0 .
cd redmine-1.2.0/
cd config/
cp database.yml.example database.yml
9. 如果没有vim请安装
yum install vim
10. mysql -u root -p
gonsin
create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'redmine';
grant all privileges on redmine.* to 'redmine'@'localhost';
quit
mysql -u redmine -p
redmine
quit
(能进入redmine库就好)
11. 配置database.yml
vim database.yml
production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: redmine
encoding: utf8
cd ..
cd ..
12. 配置
cd /usr/local/redmine/redmine-1.2.0
rake db:migrate RAILS_ENV="production"
报错A
rake aborted!
no such file to load -- openssl
解决A:
安装openssl
cd /mnt/redmine/
wget -P . http://www.openssl.org/source/openssl-0.9.8k.tar.gz
chmod 777 openssl-0.9.8k.tar.gz
tar xzvf openssl-0.9.8k.tar.gz
cd openssl-0.9.8k
make
make install
cd /mnt/redmine/ruby-1.9.2-p290/ext/openssl/
ruby extconf.rb --with-openssl-include=/usr/local/ssl/include/ --with-openssl-lib=/usr/local/ssl/lib
make
{{{可能出错:
/usr/bin/ld: /usr/local/ssl/lib/libssl.a(s2_meth.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a s
hared object; recompile with -fPIC
/usr/local/ssl/lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
解决:
安装zlib
下载zlib-1.2.3.tar.gz
tar xzvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
vi Makefile
找到 CFLAGS=-O3 -DUSE_MMAP
在后面加入-fPIC,即变成CFLAGS=-O3 -DUSE_MMAP -fPIC
接下面步骤
make
make install }}}
cd /mnt/redmine/ruby-1.9.2-p290/ext/openssl/
ruby extconf.rb --with-openssl-include=/usr/local/ssl/include/ --with-openssl-lib=/usr/local/ssl/lib
make
make install
报错B
rake aborted!
RubyGem version error: rack(1.2.3 not ~> 1.1.0)
解决B:
gem install rack -v=1.1.0
显示以下字符安装成功
Successfully installed rack-1.1.0
1 gem installed
Installing ri documentation for rack-1.1.0...
Installing RDoc documentation for rack-1.1.0...
报错C
rake aborted!
A key is required to write a cookie containing the session data. Use config.action_controller.session
= { :key => "_myapp_session",
解决C:
rake config/initializers/session_store.rb
报错D:
such file or directory - /tmp/mysql.sock
解决D:
cd config/
vim database.yml
“host: Localhost” to “host: 127.0.0.1″
cd ..
报错E:
rake aborted!
Mysql::ProtocolError: invalid packet: sequence number mismatch(3 != 1(expected)): SET NAMES 'utf8'
解决E:
cd /usr/local/1.9.2ruby/bin
gem install mysql
rake redmine:load_default_data RAILS_ENV="production"
zh
ruby script/server webrick -e production
成功 :
=> Booting WEBrick
=> Rails 2.3.11 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-09-15 18:42:52] INFO WEBrick 1.3.1
[2011-09-15 18:42:52] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
[2011-09-15 18:42:52] INFO WEBrick::HTTPServer#start: pid=29059 port=3000
补充:
修改端口
cd /usr/local/redmine/redmine-1.2.0/vendor/rails/railties/lib/commands
vim server.rb
options = {
:Port => 13599, (原来为3000)
:Host => "0.0.0.0",
:environment => (ENV['RAILS_ENV'] || "development").dup,
:config => RAILS_ROOT + "/config.ru",
:detach => false,
:debugger => false,
:path => nil
}
ruby script/server webrick -e production
我X终于完了.