当前位置: 游戏平台 > 互联网科技 > 正文

CentOS下配置Ruby on Rails并部署Redmine

时间:2019-11-05 23:44来源:互联网科技
CentOS下配置Ruby onRails并部署Redmine 先是引述百度介绍下redmine: 设置策画组件 Redmine是用Ruby开荒的根据web的品种管理软件,是用ROLacrosse框架开辟的后生可畏套跨平台项目处理体系,据悉

CentOS下配置Ruby on Rails并部署Redmine

先是引述百度介绍下redmine:

设置策画组件

Redmine是用Ruby开荒的根据web的品种管理软件,是用ROLacrosse框架开辟的后生可畏套跨平台项目处理体系,据悉是来源于Basecamp的ror版而来,扶助各类数据库,有不少和睦特殊的意义,比方提供wiki、新闻台等,还足以合二为豆蔻梢头其余版本管理体系和BUG追踪系统,举个例子Perforce、SVN、CVS、TD等等。这种 Web 格局的门类管理类别通过“项目(Project卡塔 尔(阿拉伯语:قطر‎”的款式把成员、任务(难点卡塔尔国、文书档案、商讨以致种种草样的财富集团在一同,咱们参预立异职分、文书档案等内容来推进项目标速度,同期系统接受时间线索和各类动态的表格方式来机关给成员报告项目进程。

  1. gcc编译遇到:

在装置redmine前,大家须求先来看下各类零件的版本要求:

yum -y install gcc

Redmine version Supported Ruby versions Rails version used
current trunk ruby 1.9.3, 2.0.01, 2.1, 2.2 Rails 4.2
trunk < r13482 ruby 1.8.72, 1.9.2, 1.9.3, 2.0.01, 2.1, jruby-1.7.6 Rails 3.2
3.0 ruby 1.9.3, 2.0.01, 2.1, 2.2 Rails 4.2
2.6 ruby 1.8.72, 1.9.2, 1.9.3, 2.0.01, 2.1, jruby-1.7.6 Rails 3.2
  1. 其余零器件:

一时官方网站2.0之上版本最新为2.6.3,由上图能够见到大家须求选取哪位版本的零器件。

yum install flex autoconf zlib curl zlib-devel curl-devel bzip2  bzip2-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel gcc+ gcc-c++ libxml2 libxml2-devel libxslt libxslt-devel

1.CentOS 6.5下安装基本的软件条件

安装libyaml

yum -y install libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA

  1. 安装libyaml-0.1.4

2.安装apache和mysql,并配置redmine数据库

wget

rpm -Uvh
yum install mysql-community-server httpd -y

tar xzvf yaml-0.1.4.tar.gz

安装达成后,service mysqld start,并开展相关数据库配置

cd yaml-0.1.4

mysql> create database redmine_db character set utf8;
Query OK, 1 row affected (0.00 sec)

./configure --prefix=/usr/local

mysql> create user 'redmine'@'localhost' identified by 'redmine';
Query OK, 0 rows affected (0.00 sec)

make

mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)

make install

mysql> flush privileges;
   
Query OK, 0 rows affected (0.00 sec)

  1. 安装libyaml-devel

3.iptables设置

安装源

若是服务器开了防火墙,大家须求实行相关设置

//32位系统

/sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
/sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT

su -c 'rpm -Uvh '

4.安装php环境

//64位系统

yum -y 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

su -c 'rpm -Uvh '

5.安装ruby环境

安装libyaml-devel

curl -L | bash
source /etc/profile.d/rvm.sh

yum install libyaml-devel

[root@usvr-126 ~]# source /etc/profile.d/rvm.sh
[root@usvr-126 ~]# rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p643]
[ruby-]2.1.4
[ruby-]2.1[.5]
[ruby-]2.2[.1]
[ruby-]2.2-head

安装MySQL

2.6本子需求ruby 扶助的版本,在此大家接收1.9.3 稳固版 

  1. 安装

rvm install 1.9.3

yum install mysql mysql-server mysql-devel

[root@usvr-126 ~]# ruby -v
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]

//启动mysql

6.安装rubygems 

service mysqld start/stop/restart

yum -y install rubygems

//修改mysql密码

7.安装redmine的apache扶持,那样能够通过apache访问

mysqladmin -uroot password 'new-password'

gem install passenger
passenger-install-apache2-module

//命令行登陆

命令执行完后依照提示进行布局http:

mysql -uroot -p

vim /etc/httpd/conf.d/passenger.conf
  LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-5.0.5/buildout/apache2/mod_passenger.so
  <IfModule mod_passenger.c>
    PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-5.0.5
    PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p551/wrappers/ruby
  </IfModule>

  1. 成立数据库

 

CREATE DATABASE redmine CHARACTER SET utf8;

vim /etc/http/conf.d/redmine.conf
  <VirtualHost *:80>
      ServerName www.yourhost.com
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /somewhere/public   
      <Directory /somewhere/public>
        # This relaxes Apache security settings.
        AllowOverride all
        # MultiViews must be turned off.
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        #Require all granted
      </Directory>
  </VirtualHost>

安装Ruby 1.9.3

出于我们的redmine还不曾设置,因而路径这两天还不配备,等按完redmine后在来铺排具体路径,注意root目录必需是redmine下的public目录。 

  1. 安装

8.安装redmine

wget

wget
tar -zxvf redmine-2.6.3.tar.gz
mv redmine-2.6.3 /data

tar zxvf ruby-1.9.3-p547.tar.gz

安装落成后,大家须要在httpd的redmine.conf中开展更动:

cd ruby-1.9.3-p547

  <VirtualHost *:80>
      ServerName 192.168.3.126
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /data/redmine-2.6.3/public
  ErrorLog logs/redmine_error_log
      <Directory /data/redmine-2.6.3/public>
<span style="white-space:pre"> </span> Options Indexes ExecCGI FollowSymLinks
        Order allow,deny
        Allow from all
        # This relaxes Apache security settings.
        AllowOverride all
        # MultiViews must be turned off.
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        #Require all granted
      </Directory>
  </VirtualHost>

./configure --prefix=/usr/local/ruby --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib --with-openssl

不用忘了service httpd restart

make

9.redmine相关陈设

make install

cd /data/redmine-2.6.3/public

  1. 测试

cp database.yml.example database.yml

ruby -v

注意:官方网址中说MySQL database using ruby 1.9 (adapter must be set to mysql2)

ruby 1.9.3p547 (2014-05-14) [x86_64-linux]

vim database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine"
  encoding: utf8

gem --version

10.安装rails,安装进度中会现身众多标题,大家来挨门逐户撤销吧。 

1.8.23.2

cd /data/redmine-2.6.3

  1. 环境

gem install bundler

vim /etc/profile

bundle install 

//在结尾加多

那边会报错:

RUBY_HOME=/usr/local/ruby

An error occurred while installing rack-cache (1.2), and Bundler cannot continue.
Make sure that `gem install rack-cache -v '1.2'` succeeds before bundling.

PATH=$PATH:$RUBY_HOME/bin

我们遵照提醒安装所需组件 

export RUBY_HOME PATH

gem install rack-cache -v '1.2'

//保存退出,操作:ESC -> :wq

然后重新bundle install,报错:

//确认功用,source /etc/profile

An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.

  1. ROOT环境

遵循提醒gem install nokogiri -v '1.6.6.2',再运营bundle install,报错:

alternatives --install /usr/bin/ruby ruby /usr/local/ruby/bin/ruby 300

ERROR:  Error installing nokogiri:
 ERROR: Failed to build gem native extension.

alternatives --install /usr/bin/gem gem /usr/local/ruby/bin/gem 300

依照提醒: 

安装Rails

If you are using Bundler, tell it to use the option:
 
    bundle config build.nokogiri --use-system-libraries
    bundle install

  1. 设置钦命版本

大家来输入指令:

gem install rails -v "3.2.17" -V

  bundle config build.nokogiri --use-system-libraries
  bundle install

安装Bundler

重复报错:

  1. 安装

An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.

编辑:互联网科技 本文来源:CentOS下配置Ruby on Rails并部署Redmine

关键词:

  • 上一篇:没有了
  • 下一篇:没有了