Chinaunix首页 | 论坛 | 博客
  • 博客访问: 914236
  • 博文数量: 75
  • 博客积分: 6236
  • 博客等级: 准将
  • 技术积分: 726
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-03 14:43
文章分类

全部博文(75)

文章存档

2019年(1)

2018年(6)

2017年(4)

2015年(1)

2014年(9)

2013年(1)

2012年(3)

2011年(9)

2010年(3)

2009年(2)

2008年(4)

2007年(24)

2006年(8)

我的朋友

分类: 其他UNIX

2018-07-07 10:12:31

一、安装Mysql

[root@hn-1]#yum install mysql-server
[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.

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 --remove /

gem sources -l (应该只剩下 taobao)


gem install bundler

gem install rmagick


gem install rails --no-document-v='4.2.7'
  1. geminstallrake--no-document
  2. gem i mime-types--no-document


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

  1. geminstallrbpdf--no-document
  2. 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
  
     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


生成安全Token

# bundle exec rake generate_secret_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

cd /opt/redmine/publiccpdispatch.fcgi.example dispatch.fcgicphtaccess.fcgi.example .htaccess

安装mod_fcgi

yum installepel-release (安装epel源)yuminstallmod_fcgid

Redmine配置

cd /opt/redmine/configcpconfiguration.yml.example configuration.yml vi configuration.yml
attachments_storage_path: /opt/redmine/files

更改附件文件存放路径

mkdir-p /opt/redmine/fileschown-R apache:apache /opt/redmine

配置日志

cp-v additional_environment.rb.example additional_environment.rb
vi additional_environment.rb
#Logger.new(PATH,NUM_FILES_TO_ROTATE,FILE_SIZE) config.logger = Logger.new('/opt/redmine/logs/logfile.log', 2, 1000000) config.logger.level = Logger::ERROR

配置Email(sendmail方式)

  email_delivery:     delivery_method: :smtp     smtp_settings:       address: xxxxxxxx.com       port: 587       domain: example.net       authentication: :login       user_name: services@qq.com       password: xxxxxxx

给Redmine创建虚拟目录

# vi /etc/httpd/conf.d/redmine.conf

Alias /redmine /opt/redmine-3.3.3/publicPassengerBaseURI/redmine PassengerAppRoot/opt/redmine PassengerRuby/usr/local/bin/ruby Allow from all Options-MultiViews # Uncomment thisifyou're on Apache >= 2.4:#Require all granted

ln -s /opt/redmine-3.3.3 /opt/redmine

启动Redmine

cd /optchown-R apache:apache redmine-3.3.3chmod-R755redmine-3.3.3bundleexecrails server webrick -e productionservice httpd restart


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  

  1. Options Indexes FollowSymLinks   ( 找到这一行,删除“ Indexes ”,并添加“ Includes ”、“ ExecCGI ” )  
  2.  Options Includes ExecCGI FollowSymLinks   ( 允许服务器执行 CGI 及 SSI)  
  3.  #AddHandler cgi-script .cgi   ( 找到这一行,去掉行首的“ # ”,并在行尾添加“ .pl ” )  
  4.  AddHandler cgi-script .cgi .pl   ( 允许扩展名为 .pl 的 CGI 脚本运行 )  
阅读(905) | 评论(0) | 转发(0) |
0

上一篇:移动互联网第三方优质资源

下一篇:没有了

给主人留下些什么吧!~~