centos5 安装redmine

时间:2024-12-12 19:06:26

一、下载依赖包

yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel
yum -y install zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel
yum -y install pcre-devel mysql-devel ImageMagick-devel ImageMagick

  

二、ruby安装(需要编译openssl)

wget https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.10.tar.gz
tar xf ruby-2.2.10.tar.gz
cd ruby-2.2.10
./configure --prefix=/usr/local/ruby --with-openssl-dir=/usr/local/ssl
make && make install
cp /usr/local/ruby/bin/* /usr/bin/

[root@iZm5ed0ahsyrcm360x1mnfZ ruby-2.2.10]# ruby -v
ruby 2.2.10p489 (2018-03-28 revision 63023) [x86_64-linux]
[root@iZm5ed0ahsyrcm360x1mnfZ ruby-2.2.10]# gem -v
2.4.5.5


  

三、换源

gem sources --remove https://rubygems.org/
echo ':ssl_verify_mode: 0' >> ~/.gemrc
gem sources --add https://gems.ruby-china.com/ ##查看
[root@iZm5ed0ahsyrcm360x1mnfZ ~]# gem sources --add https://gems.ruby-china.com/
https://gems.ruby-china.com/ added to sources
[root@iZm5ed0ahsyrcm360x1mnfZ ~]# gem sources -l
*** CURRENT SOURCES *** https://gems.ruby-china.com/

  

四、gem下载安装包

gem install rails -v=4
gem install bundler

gem install mysql2

gem update --system

yum install libxml2-devel libxslt-devel ruby-deve -y

gem install nokogiri -- --use-system-libraries

四、gem下载

  

gem install rails -v=4
gem install bundler
gem install mysql2
gem update --system
yum install libxml2-devel libxslt-devel ruby-deve -y
gem install nokogiri -- --use-system-libraries

  

五、创建数据库

create database redmine;
grant all privileges on redmine.* to 'redmine'@'localhost' identified by '123456';
flush privileges;

  

六、下载redmine

wget http://www.redmine.org/releases/redmine-3.4.6.tar.gz
tar xf  redmine-3.4.6.tar.gz
cd redmine-3.4.6
cd config
cp database.yml.example  database.yml vim database.yml

production:
adapter: mysql2
database: redmine
host: localhost
username: redmine   ##改
password: "123456"  ##改
encoding: utf8


  

七、安装其他包

cd redmine-3.4.6
\cp /usr/local/ruby/bin/* /usr/bin/
[root@iZm5ed0ahsyrcm360x1mnfZ redmine-3.4.6]# vim Gemfile 
source 'http://gems.ruby-china.com/' ###把第一行改成这个 bundle install --without development test rmagick
bundle install
gem  install rails -v=4.2.8

  

八、导入数据

cd config

[root@iZm5ed0ahsyrcm360x1mnfZ config]# pwd
/root/redmine-3.4.6/config
RAILS_ENV=production bundle exec rake generate_secret_token 
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data

  

九、本地测试

cd redmine-3.4.6
bundle exec rails server webrick -p3000 -b 0.0.0.0 -e production ##使用浏览器访问http://ip:3000

  

十、现在thin

gem install thin
cp /usr/local/ruby/bin/thin /usr/bin/
thin install [root@iZm5ed0ahsyrcm360x1mnfZ ~]# thin install
Installing thin service at /etc/rc.d/thin ...
mkdir -p /etc/rc.d
writing /etc/rc.d/thin
chmod +x /etc/rc.d/thin
mkdir -p /etc/thin To configure thin to start at system boot:
on RedHat like systems:
sudo /sbin/chkconfig --level 345 thin on
on Debian-like systems (Ubuntu):
sudo /usr/sbin/update-rc.d -f thin defaults
on Gentoo:
sudo rc-update add thin default Then put your config files in /etc/thin cd redmine-3.4.6 ##cdredmine目录
##修改Gemfile文件
gem "thin" ##添加一行

  

十一、创建配置

##创建配置
cat>>/etc/thin/redmine.yml<<EOF
pid: /var/run/thin/thin.pid
group: nginx
wait: 30
timeout: 30
log: /var/log/thin/thin.log
max_conns: 1024 require: [] environment: production max_persistent_conns: 512 servers: 4 daemonize: true user: nginx socket: /tmp/thin.sock chdir: /da
ta/www/redmine
EOF ##日志设置
cat>>/etc/logrotate.d/thin<<EOF
/var/log/thin/*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/thin restart >/dev/null
endscript
}
EOF

  

十二、nginx配置