一、安装Mysql
[root@hn-1]#chkconfig mysqld on
[root@hn-1]#service mysqld start
如果之前已经创建过数据库,需要密码之类的:
mysqladmin -uroot -p password 'newpassword'
二、安装基本软件环境依赖包
yum install libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel \
libffi-devel zlib-devel openssl-devel libyaml-devel readline-devel \
curl-devel openssl-devel pcre-devel mysql-devel ImageMagick-devel ImageMagick gcc-c++ gcc c
三、安装PHP、php-fpm和phpMyAdmin
安装php、php-fpm和相关扩展包
yum install php php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc php-pecl-apc php-soap php-fpm
安装phpMyAdmin
yum install phpmyadmin
四、安装Rubby
cd /usr/local/src
wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-2.3.1.tar.gz
tar -zxvf ruby-2.3.1.tar.gz
cd ruby-2.3.1
./configure
make && make install
检查Ruby是否安装成功:
ruby -v
五、安装Rubygems(Ruby包管理器)
为了提高下载gem包速度,可以使用国内的淘宝源,你可以用 Bundler 的 Gem 源代码镜像命令
bundle config mirror.https://rubygems.org https://ruby.taobao.orgcd /usr/local/src
wget https://rubygems.org/rubygems/rubygems-2.6.8.tgz
tar -zxvf rubygems-2.6.8.tgz
cd rubygems-2.6.8
/usr/local/bin/ruby setup.rb
检查gem是否安装成功
gem -v
gem sources --add https://ruby.taobao.org/gem sources --remove https://rubygems.org/
gem sources -l (应该只剩下 taobao)
gem install bundler
gem install rmagick
- geminstallrake--no-document
- gem i mime-types--no-document
gem install nokogiri -- --use-system-libraries
- geminstallrbpdf--no-document
- geminstallrbpdf-font--no-document
gem install mysql2
六、安装Redmine3.3.3
Apache下安装Passenger用于部署rails应用
gem install passenger --no-ri --no-rdoc
passenger-install-apache2-module
命令执行完后按照提示进行配置passenger的虚拟目录文件
vi /etc/httpd/conf.d/passenger.conf
LoadModule passenger_module /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.1.5/buildout/apache2/mod_passenger.so
为Redmine创建空数据库和用户
登陆mysql
mysql -u root -p
进行相关数据库配置
mysql> CREATE DATABASE redmine CHARACTER SET utf8;
mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine';
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
下载redmine
cd /usr/local/src
wget http://www.redmine.org/releases/redmine-3.3.3.tar.gz
tar -zxf redmine-3.3.3.tar.gz
mv redmine-3.3.3 /opt/
cd /opt/redmine-3.3.3
bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2
bundle install --without development test
vim config/database.yml
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "redmine"
encoding: utf8
生成安全Token
创建redmine数据库表
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
激活FCGI
安装mod_fcgi
Redmine配置
更改附件文件存放路径
配置日志
配置Email(sendmail方式)
email_delivery: delivery_method: :smtp smtp_settings: address: xxxxxxxx.com port: 587 domain: example.net authentication: :login user_name: [email protected] password: xxxxxxx给Redmine创建虚拟目录
# vi /etc/httpd/conf.d/redmine.conf
Alias /redmine /opt/redmine-3.3.3/publicln -s /opt/redmine-3.3.3 /opt/redmine
启动Redmine
apache启动报错:Permission denied: make_sock: could not bind to address时执行:
setenforce 0
cd /opt/redmine-3.3.3/
nohup bundle exec rails server webrick -p3000 -b 0.0.0.0 -e production >/dev/null 2>&1 &
查进程:
ps -ef|grep rails
root 1777 16051 5 14:43 pts/2 00:00:02 /usr/local/bin/ruby bin/rails server webrick -p3000 -b 0.0.0.0 -e production
让 Apache 支持 cgi
vi /etc/httpd/conf/httpd.conf
- Options Indexes FollowSymLinks ( 找到这一行,删除“ Indexes ”,并添加“ Includes ”、“ ExecCGI ” )
- Options Includes ExecCGI FollowSymLinks ( 允许服务器执行 CGI 及 SSI)
- #AddHandler cgi-script .cgi ( 找到这一行,去掉行首的“ # ”,并在行尾添加“ .pl ” )
- AddHandler cgi-script .cgi .pl ( 允许扩展名为 .pl 的 CGI 脚本运行 )