分类: 其他UNIX
2018-07-07 10:12:31
安装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
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
为了提高下载gem包速度,可以使用国内的淘宝源,你可以用 Bundler 的 Gem 源代码镜像命令
bundle config mirror.cd /usr/local/src
wget /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 /gem sources -l (应该只剩下 taobao)
gem install bundler
gem install rmagick
gem install nokogiri -- --use-system-libraries
gem install mysql2
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
PassengerRoot /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.1.5
PassengerDefaultRuby /usr/local/bin/ruby
为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
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
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
# vi /etc/httpd/conf.d/redmine.conf
Alias /redmine /opt/redmine-3.3.3/publicln -s /opt/redmine-3.3.3 /opt/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