1.优化系统
# cat /etc/redhat-release
CentOS release 5.3 (Final)
#yum install git
#git clone git://github.com/leopku/centostweak.git <--------此脚本只针对于 Centos系列
#chmod +x centostweak.sh
#./centostweak.sh
有关于 redmine 版本安装的一些对ruby rails rubygems 版本有要求,可以根据以下参考
redmine:http://www.redmine.org/projects/redmine/wiki/RedmineInstall
ruby:http://www.ruby-lang.org/en/downloads/
rubyGmes:http://rubyforge.org/projects/rubygems/
2.安装依赖包
yum -y install zlib-devel zlib openssl-devel perl cpio expat-devel gettest-devel curl gcc gcc-c++ make mysql-server mysql mysql-devel freetype-devel libpng-devel libjpeg-devel gd-devel bzip2-devel fontconfig libtiff-devel libwmf-devel
启动mysql服务
service mysqld start
安装RVM环境
curl -L https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer |bash -s stable
设置rvm全局环境变量
vim /etc/profile
最后加
export RVM_HOME="/usr/local/rvm/"
export CLASSPATH="/$RVM_HOME/bin:$PATH"
source /etc/profile <--------rvm 环境变量生效
3.安装 RUBY 1.9.2
http://www.ruby-lang.org/en/downloads/
./configure --prefix=/usr/local/ruby
make && make install
设在ruby环境变量
vim /etc/profile
export PATH=/usr/local/ruby/bin:/usr/local/ruby/lib/ruby/gems/1.9.1/gems:$PATH
export PATH="/usr/local/ImageMagick/bin:$PATH"
source /etc/profile <--------ruby 环境变量生效
rvm 1.9.2 --default
4.开始安装 rails 3.2.6
gem install rails -v=3.2.6
5. 安装 ImageMagick & rmagick &sqlite3
tar zxvf ImageMagick-6.6.4-7.tar.gz
./configure --prefix=/usr/local/ImageMagick
make && make install
设置Imageagick环境变量
vim /etc/profile
export PATH="/usr/local/ImageMagick/bin:$PATH"
source /etc/profile
gem install rmagick
gem install sqlite3 -v '1.3.6'
6.配置redmine数据库,以及授权用户
mysql> create database redmine character set utf8;
mysql> grant all privileges on redmine.* to 'redmine'@'locahost' identified by 'redmine';
mysql> flush privileges;
7.安装redmine 依赖
bundle install
8.安装mysql2
gem install "mysql2"
9. 开始下载安装redmine
cd /tmp
http://ftp.ruby-lang.org/pub/ruby/
tar zxvf redmine-2.0.3.tar.gz
mv redmine-2.0.3 /usr/local/redmine
cd /usr/local/redmine
cp config/database.yml.example config/database.yml
修改redmine 数据库连接文件如下:
cat config/database.yml
# Default setup is given for MySQL with ruby1.8. If you're running Redmine
# with MySQL and ruby1.9, replace the adapter name with `mysql2`. (这里已经提示 mysql2)
# Examples for PostgreSQL and SQLite3 can be found at the end.
production:
adapter: mysql2 <-----------类型一定是要 msyql2 (mysql一直是不对滴,bundle install 安装的版本mysql2-0.3.11 可以看看注视吆。)
database: redmine <-----------设置要连接的数据库
host: localhost <-----------mysql主机地址
username: root <-----------redmine 数据库的用户
password: <-----------设置的密码
encoding: utf8
关于database.yml的配置问题,让我着实处理了下。。实际上该文件一小点的不符要求就导致安装根本无法继续。并且给出的提示也多半不着头脑。
10.这是生成会话存储(跟1.X完全区分开rake generate_session_store)
rake generate_secret_token
11.创建数据库结构,应用程序根目录下运行以下命令:
RAILS_ENV=production rake db:migrate
本人也尽力去修改redmine默认的端口 ,努力了 没找到,so 改为启动指定端口 -p 80
Redmine 后台启动
ruby /usr/local/redmine/script/rails server webrick -e production -p80 >/dev/null 2>&1 &
设置开机启动Redmine
echo "ruby /usr/local/redmine/script/rails server webrick -e production -p80 >/dev/null 2>&1 &" >> /etc/rc.local
然后可以用浏览器 http://IP 登陆。
使用默认的管理员帐户登录:
登录者:admin
密码:admin
登陆后可以在admin的控制面板里修改语言为中文。经测试中文化较完善,显示、输入中文均未见什么问题。
设置发送邮件
cp config/configuration.yml.example config/configuration.yml
修改如下:
Example configuration.yml Configurations
Simple Login Authentication (default settings)
# Outgoing email settings
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.example.net
port: 25
domain: example.net
authentication: :login
user_name: [email protected]
password: redmine
development:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: 127.0.0.1
port: 25
domain: example.net
authentication: :login
user_name: [email protected]
password: redmine
设置redmine的log (就不用翻译了 对着改改就成了)
Logging configuration
Redmine defaults to a log level of :info, writing to the log subdirectory. Depending on site usage, this can be a lot of data so to avoid the contents of the logfile growing without bound, consider rotating them, either through a system utility like logrotate or via the config/additional_environment.rb file.
To use the latter, copy config/additional_environment.rb.example to config/additional_environment.rb and add the following lines. Note that the new logger defaults to a high log level and hence has to be explicitly set to info.
1#Logger.new(PATH,NUM_FILES_TO_ROTATE,FILE_SIZE)
2config.logger = Logger.new(config.log_path, 2, 1000000)
3config.logger.level = Logger::INFO
gem list 安装的软件包
[root@localhost ~]# gem list
*** LOCAL GEMS ***
actionmailer (3.2.6)
actionpack (3.2.6)
activemodel (3.2.6)
activerecord (3.2.6)
activeresource (3.2.6)
activesupport (3.2.6)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.5)
coderay (1.0.7)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
json (1.7.3)
mail (2.4.4)
metaclass (0.0.1)
mime-types (1.19)
minitest (1.6.0)
mocha (0.12.1)
multi_json (1.3.6)
mysql2 (0.3.11)
net-ldap (0.3.1)
polyglot (0.3.3)
prototype-rails (3.2.1)
rack (1.4.1)
rack-cache (1.2)
rack-openid (1.3.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.6)
railties (3.2.6)
rake (0.9.2.2, 0.8.7)
rdoc (3.12, 2.5.8)
rmagick (2.13.1)
ruby-openid (2.1.8)
shoulda (2.11.3)
sprockets (2.1.3)
thor (0.15.4)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
yard (0.8.2.1)
出现过程中遇到的一些比较纠结的问题
An error occured while installing pg (0.14.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.14.0'` succeeds before bundling.
解决办法:
修改 Gemfile 中把所有关于pg的行注销 (总体是我们不用PostgreSQL数据库 所以直接忽视)
还有相关的sqlite3
如下:
platforms :mri, :mingw do
# group :postgresql do
# gem "pg", ">= 0.11.0"
# end
# group :sqlite do
# gem "sqlite3"
# end