• 设备
    • 今日
    • 6

    CentOS 6.6 安装redmine

    CentOS 6.6 安装redmine

    Redmine是一个开源的、基于Web的项目管理和缺陷跟踪工具。它用日历和甘特图辅助项目及进度可视化显示。同时它又支持多项目管理。Redmine是一个自由开放源码软件解决方案,它提供集成的项目管理功能,问题跟踪,并为多个版本控制选项的支持。虽说像IBM Rational Team Concert的商业项目调查工具已经很强大了,但想坚持一个自由和开放源码的解决方案,可能会发现Redmine是一个有用的Scrum和敏捷的选择。 由于Redmine的设计受到Rrac的较大影响,所以它们的软件包有很多相似的特征。Redmine建立在Ruby on Rails的框架之上,它可以夸平台和数据库。


    前提安装redmine ruby环境版本要求:
    rvm 1.29.3
    gem 1.3.7
    ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
    Bundler version 1.15.4
    Rails 4.2.4
    Redmine 3.1.1.stable

    1.安装开发工具
    命令:yum groupinstall "Development tools"

    2安装rvm
    修改RVM的Ruby安装源到国内的淘宝镜像服务器,这样能提高安装速度
    gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
    gpg: 已创建目录‘/root/.gnupg’
    gpg: 新的配置文件‘/root/.gnupg/gpg.conf’已建立
    gpg: 警告:在‘/root/.gnupg/gpg.conf’里的选项于此次运行期间未被使用
    gpg: 钥匙环‘/root/.gnupg/secring.gpg’已建立
    gpg: 钥匙环‘/root/.gnupg/pubring.gpg’已建立
    gpg: 下载密钥‘D39DC0E3’,从 hkp 服务器 keys.gnupg.net
    gpg: /root/.gnupg/trustdb.gpg:建立了信任度数据库
    gpg: 密钥 D39DC0E3:公钥“Michal Papis (RVM signing) ”已导入
    gpg: 没有找到任何绝对信任的密钥
    gpg: 合计被处理的数量:1
    gpg:           已导入:1  (RSA: 1)

    # curl -sSL https://get.rvm.io | bash -s stable
    # curl -L https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
    vi /usr/local/rvm/config/db
    #ruby_url=https://cache.ruby-lang.org/pub/ruby 
    ruby_url=https://cache.ruby-china.org/pub/ruby

    # source /usr/local/rvm/scripts/rvm

    rvm -v 就可以查看rvm的版本信息,说明正确


    安装ruby依赖包
    命令:yum -y install zlib-devel curl-devel openssl* httpd-devel apr-devel apr-util-devel mysql-devel ImageMagick-devel wget rubygems mod_fcgid

    3.安装ruby
    使用人rvm list,列出已安装的ruby版本
    # No rvm rubies installed yet. Try 'rvm help install'.
    若有安装的ruby旧版本,根据rvm list结果 
    运行:rvm remove rvm list结果中的版本号,如:1.9.2

    # source /etc/profile.d/rvm.sh
    # rvm requirements
    Checking requirements for centos.
    Installing requirements for centos.
    Installing required packages: libffi-devel, readline-devel, sqlite-devel, libyaml-devel...........
    Requirements installation successful.
    ------
    若出现 :curl: (35) SSL connect error 
    先:yum update nss
    再:rvm requirements
    ------

    # rvm list known
    方法1:
    # rvm install 2.3.0

    方法2:
    tar zcvf ruby-2.4.2.tar.gz
    cd /usr/local/ruby-2.4.2
    ./configure --prefix=/usr/local/ruby
    ./configure -prefix=/usr/local/ruby

    5、查看ruby信息
    命令:ruby -v

    利用rvm安装 Ruby 2.2.3 并设为默认
    # sed -i -E 's!https?://cache.ruby-lang.org/pub/ruby!https://ruby.taobao.org/mirrors/ruby!' /usr/local/rvm/config/db
    # rvm gemset create
    # rvm list known
    # rvm install 2.2.3 (同时更新gem和安装ruby)
    Searching for binary rubies, this might take some time.
    No binary rubies available for: centos/6/x86_64/ruby-2.3.0.
    Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
    Checking requirements for centos.
    Requirements installation successful.
    Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.3.0, this may take a while depending on your cpu(s)...
    ruby-2.3.0 - #downloading ruby-2.3.0, this may take a while depending on your connection...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 13.5M  100 13.5M    0     0   273k      0  0:00:50  0:00:50 --:--:--  281k
    ruby-2.3.0 - #extracting ruby-2.3.0 to /usr/local/rvm/src/ruby-2.3.0....
    ruby-2.3.0 - #applying patch /usr/local/rvm/patches/ruby/ruby_2_3_gcc7.patch.
    ruby-2.3.0 - #applying patch /usr/local/rvm/patches/ruby/changeset_r53419.diff.
    ruby-2.3.0 - #applying patch /usr/local/rvm/patches/ruby/2.3.0/random_c_using_NR_prefix.patch.
    ruby-2.3.0 - #configuring..........................................................
    ruby-2.3.0 - #post-configuration..
    ruby-2.3.0 - #compiling......................................................................................
    ruby-2.3.0 - #installing...........................
    ruby-2.3.0 - #making binaries executable..
    ruby-2.3.0 - #downloading rubygems-2.6.13
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  750k  100  750k    0     0   228k      0  0:00:03  0:00:03 --:--:--  260k
    ruby-2.3.0 - #extracting rubygems-2.6.13....
    ruby-2.3.0 - #removing old rubygems.........
    ruby-2.3.0 - #installing rubygems-2.6.13..........................
    ruby-2.3.0 - #gemset created /usr/local/rvm/gems/ruby-2.3.0@global
    ruby-2.3.0 - #importing gemset /usr/local/rvm/gemsets/global.gems...............................................
    ruby-2.3.0 - #generating global wrappers........
    ruby-2.3.0 - #gemset created /usr/local/rvm/gems/ruby-2.3.0
    ruby-2.3.0 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
    ruby-2.3.0 - #generating default wrappers........
    ruby-2.3.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
    Install of ruby-2.3.0 - #complete 
    Please be aware that you just installed a ruby that requires 3 patches just to be compiled on an up to date linux system.
    This may have known and unaccounted for security vulnerabilities.
    Please consider upgrading to ruby-2.4.1 which will have all of the latest security patches.
    Ruby was built without documentation, to build it run: rvm docs generate-ri

    # 检查ruby和gem版本

    # gem -v
    2.6.13

    # ruby -v
    ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]

    最后
    # rvm use 2.3.0 --default

    --------
    安装时有可能会遇到下面的错误:
    Already installed ruby-2.2.3.
    To reinstall use:
    rvm reinstall ruby-2.2.3
    Gemset '' does not exist, 'rvm ruby-2.2.3 do rvm gemset create ' first, or append '--create'.
    按照提示我们可以重新安装或者使用:
    # rvm install 2.2.3 --create
    -------

    # rvm list //列出已安装的ruby版本

    正常显示即可


    安装rails

    gem安装(其实在 rvm install 2.3.0 已包括此安装,若gem -v显示 2.6.13版本号,以下不用处理)
    -------
    wget https://rubygems.org/rubygems/rubygems-2.6.13.tgz
    # tar zxvf rubygems-2.6.13
    # cd rubygems-2.6.13
    # ruby setup.rb
    ------

    由于国内网络原因(你懂的),导致rubygems.org存放 Amazon S3上面的资源文件间歇性连接失败。
    所以你会与遇到gem install rack或bundle install的时候半天没有响应,具体可以用gem install rails -V来查看执行过程。
    下面替换成淘宝的GEM镜像站:
    # gem sources -l
    *** CURRENT SOURCES ***
    https://rubygems.org/

    # gem sources -r https://rubygems.org/
    https://rubygems.org/ 
    removed from sources

    # gem sources -a https://ruby.taobao.org/
    https://ruby.taobao.org/ added to sources

    ------
    如果遇到 SSL 证书问题: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed 
    增加 ssl_verify_mode: 0 配置,增加 ssl_verify_mode: 0 配置
    vi ~/.gemrc
    ---
    :sources:
    - https://ruby.taobao.org/
    :ssl_verify_mode: 0
    ------

    # gem sources -l
    *** CURRENT SOURCES ***
    http://gems.ruby-china.org/

    gem install bundler
    gem install rails (在新窗口执行:gem install rails -V 监控安装过程 )
      安装出错提示:
    ERROR:  Error installing rails:
    activesupport requires Ruby version >= 2.2.2.

    curl: (60) Peer certificate cannot be authenticated with known CA certificate
    yum install ca-certificates

    # gem install passenger
    Building native extensions.  This could take a while...
    Successfully installed passenger-5.1.8
    Parsing documentation for passenger-5.1.8
    Done installing documentation for passenger after 15 seconds
    1 gem installed

    # passenger-install-apache2-module

    # vim /etc/httpd/conf.d/passenger.conf
       LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.3/gems/passenger-5.0.30/buildout/apache2/mod_passenger.so
       
         PassengerRoot /usr/local/rvm/gems/ruby-2.2.3/gems/passenger-5.0.30
         PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.3/wrappers/ruby
       

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

          ServerName www.a.com
          # !!! Be sure to point DocumentRoot to 'public'!
          DocumentRoot /var/www/html/redmine/public
      ErrorLog logs/redmine_error_log
         
            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
         
     
      
     安装redmine
    # cd /var/www/html
    # wget http://www.redmine.org/releases/redmine-3.1.1.tar.gz
    # tar -zxvf redmine-3.1.1.tar.gz
    # mv redmine-3.1.1 redmine
    # cd /var/www/html/redmine/
    # vim Gemfile
    #source 'https://rubygems.org' 改为:source 'https://ruby.taobao.org'
    # cp config/configuration.yml.example config/configuration.yml
    # cp config/database.yml.example config/database.yml

    vi config/database.yml
    production:
      adapter: mysql2
      database: redmine
      host: localhost
      username: redmine
      password: "redmine"
      encoding: utf8
        
    安装管理ruby的包依赖的工具bundler

    下面安装很容易报错,如果报错请尝试重新安装。
     #注意是在网站根目录下执行
    cd /var/www/html/redmine
    # gem install bundler  
    Successfully installed bundler-1.15.4
    Parsing documentation for bundler-1.15.4
    Done installing documentation for bundler after 3 seconds
    1 gem installed
    # gem install bundle
    Fetching: bundler-1.15.4.gem (100%)
    Successfully installed bundler-1.15.4
    Fetching: bundle-0.0.1.gem (100%)
    Successfully installed bundle-0.0.1
    Parsing documentation for bundler-1.15.4
    Installing ri documentation for bundler-1.15.4
    Parsing documentation for bundle-0.0.1
    Installing ri documentation for bundle-0.0.1
    Done installing documentation for bundler, bundle after 8 seconds
    2 gems installed

    #gem install rails -v=4.2.4
    安装成功如下:
    ......
    Installing ri documentation for sprockets-rails-3.2.1
    Parsing documentation for rails-4.2.0
    Installing ri documentation for rails-4.2.0
    Done installing documentation for i18n, thread_safe, tzinfo, activesupport, rack, rack-test, mini_portile2, nokogiri, loofah, rails-html-sanitizer, rails-deprecated_sanitizer, rails-dom-testing, builder, erubis, actionview, actionpack, activemodel, arel, activerecord, globalid, activejob, mime-types-data, mime-types, mail, actionmailer, thor, railties, concurrent-ruby, sprockets, sprockets-rails, rails after 476 seconds
    31 gems installed
    # bundle install
    or # bundle install --without development test rmagick
    为Rails生成cookies秘钥
    # cd /var/www/html/redmine/config
    # rake generate_secret_token 

    初始化redmine数据库表名
    创建mysql数据库
    #mysql -u root -p123456
    Mysql> create database redmine default character set utf8;
    grant all on redmine.* to root;
    grant all on redmine.* to root@localhost;
    grant all on redmine.* to redmineuser;
    grant all on redmine.* to redmineuser @localhost;
    use mysql;
    UPDATE user SET Password=PASSWORD('RedminPw01') WHERE User='redmineuser';
    flush privileges;
    Mysql>exit;

    # RAILS_ENV=production rake db:migrate
    # RAILS_ENV=production rake redmine:load_default_data

    这里会要求选择默认语言,我选的中文zh:

    修改fastcgi
    # cd /var/www/html/redmine/public/
    # cp dispatch.fcgi.example dispatch.fcgi
    # cp htaccess.fcgi.example .htaccess

    以上操作以后就可以在浏览器中输入www.a.com进行范围redmine,但是请提前做好域名的解析,如果不想做域名解析可以使用IP进行配置访问,具体IP访问配置这里就不做介绍了,
    如果安装错误可以测试看redmine的问题还是httpd的问题。
    在WEBrick服务上测试Redmine是否安装成功
    # bundle exec rails server webrick -e production -b 0.0.0.0
    cd /var/www/html/redmine/
    ruby bin/rails server webrick -e production -b 0.0.0.0 -d
    地址:http://IP:3000 (注意:打开iptables 3000端口号)
    缺省管理员用户:
    login: admin
    password: admin

    易迁易问题管理平台
    http://219.137.37.186:3000
    初始登录用户为邮箱前缀,邮箱中@的前缀
    初始登录密码为: 12345678

    ctchen@1000e56.com
    rjzhang@1000e56.com
    jzhao@1000e56.com
    swang@1000e56.com
    kzhang@1000e56.com
    zyqiu@1000e56.com
    bwhu@1000e56.com
    ljgao@1000e56.com
    jjchen@1000e56.com
    hmhe@1000e56.com
    david@1000e56.com
    chenzl 陈总
    jyhuang 黄剑勇

    问题集锦
    Because of the Great Firewall,the most important thing is changing your downloading source in case you spend unnecessary time on downloading software.No matter which way you use,such as gem,bundle,rvm. 
    因为“长城防火墙”的缘故,为了避免你在下载软件的时候花费不必要的时间,最重要的就是修改你使用的下载源,不管你用的哪种方式下载,比如,gem,bundle,rvm。 
    Reference:https://ruby.taobao.org/

    在CentOS上部署Redmine过程中,在安装Rails时 
    #gem install rails 
    总是报错。 
    错误: Failed to build gem native extension 
    这是我遇到的问题中报错的一项,最后通过以下方法得到了解决,所以贴出来分享下。我不知道为什么这样做,只是在不断尝试中发现终于不报错了。-_-| 
    对策: 
    for ubuntu:

    sudo apt-get install zlib1g-dev
    for Redhat or CentOs

    sudo yum install zlib-devel -y
    From Builds failing with “zlib is missing; necessary for building libxml2”

    在安装MySQL时 
    #gem install mysql 
    总是报错。 
    错误: Failed to build gem native extensionOn 
    Ubuntu/Debian and other distributions using aptitude 
    sudo apt-get install libmysql-ruby libmysqlclient-dev

    If the above command doesn’t work because libmysql-ruby cannot be found, the following should be sufficient: 
    sudo apt-get install libmysqlclient-dev

    On Red Hat/CentOS and other distributions using yum: 
    sudo yum install mysql-devel

    On Mac OS X with Homebrew: 
    brew install mysql 
    FROM StackOverFlow

    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) 
    http://support.moonpoint.com/software/database/mysql/not-running-centos7.php 
    关键是启动服务时用 
    systemctl start mariadb.service 
    用systemctl start mysqlb.service会报错,原因是现在的CentOS默认的MySQL都是安装Maria数据库,in a word,自从用了Maria数据库,一切都不是原来的模样。

    Your Gemfile.lock is corrupt. The following gem is missing from the DEPENDENCIES section: ‘nokogiri’(或者是其他的section) 
    rv Gemfile.lock

    忘了问题 :( 
    Try adding this line to your Gemfile 
    gem 'rack', '~> 1.6.4' 
    and then run: 
    bundle install 
    and see if that fixes your issue. 
    Update 
    If the above does not work, try uninstalling railties gem. Then install an older version of the rails (rails version 4.0.0 was used in the from the tutorial). The issue is due to the version mismatch/incompatibility of some of your gems.

    yum install rvm failed && How to install rvm 
    (1)Before any other step install mpapis public key (might need gpg2) (see security) 
    gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 
    (2)Install RVM (development version): 
    \curl -sSL https://get.rvm.io | bash 
    FROM Installing RVM

    /usr/local/rvm/gems/ruby-2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: key “inodot” is duplicated and overwritten on line 466 
    (1)vi /usr/local/rvm/gems/ruby-2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb 
    (2)按下Esc,输入 冒号 ,:set number 
    (3)找到第466行,把它用井号“#”注释掉

    原因可能是你曾经安装过一次ruby

    启动redmine

    ruby bin/rails server webrick -e production -b 219.137.37.186 -d

    参数说明: 
    -b 绑定ip。例如我的IP:42.96.137.217 
    -d 后台运行。 
    -e 指定默认配置文件。 
    rails server -h 可以获取更多的帮助。

    Ruby Version Manager简称RVM,是一款非常好用的ruby版本管理以及安装工具。

    关于rvm的安装,可以参考以下文章:
    use rvm install and manage ruby version  
    Set up professional rails3 develpment on ubuntu (part two)
    RVM的用法
    我将自己安装rvm过程中碰到的问题及解决办法简单列一下:
    1.执行:curl -k https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer >./ins
    会报错:Unknown SSL protocol error in connection to raw.github.com:443
    解决办法:去掉 -k ,即curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer >./ins
    2.执行cat ins|bash -s stable命令的时候,报错如下:
    Upgrading the RVM installation in /usr/local/rvm/
    cp: 无法获取"/usr/local/rvm/src/rvm/bin/rake" 的文件状态(stat): 没有那个文件或目录
    cp: 无法获取"/usr/local/rvm/src/rvm/bin/bundle" 的文件状态(stat): 没有那个文件或目录

    Upgrade of RVM in /usr/local/rvm/ is complete.
    # Administrator,
    #
    #   Thank you for using RVM!
    #   We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
    #
    # ~Wayne, Michal & team.

    In case of problems: http://rvm.io/help and https://twitter.com/rvm_io

    Upgrade Notes:

      * No new notes to display.

    解决办法:

    不用管他,直接 source /etc/profile.d/rvm.sh 就可以启用rvm,如果rvm成功安装的话,使用rvm -v就可以查看rvm的版本信息。

    root@kali:/# rvm -v

    rvm 1.25.23 (stable) by Wayne E. Seguin , Michal Papis [https://rvm.io/]


    3.使用rvm安装软件的时候,下载速度很慢,怎么办?
    解决办法:修改ruby的安装源到国内的淘宝镜像服务器
    root@kali:~# gem source --add 'http://ruby.taobao.org/'
    source http://ruby.taobao.org/ already present in the cache

    root@kali:~# gem source -l
    *** CURRENT SOURCES ***
    https://rubygems.org/
    http://ruby.taobao.org/

    4.系统中已经安装了ruby 2.0.0p353。但,rvm use 2.0.0p353的时候会出错:
    root@kali:~# rvm use 2.0.0p353
    ruby-2.0.0p353 is not installed.

    To install do: 'rvm install ruby-2.0.0p353'
    解决办法:使用人rvm list,列出已安装的ruby版本

    复制代码
     root@kali:~# rvm list
    rvm rubies
    =* ruby-2.0.0-p353 [ i686 ]
    # => - current
    # =* - current && default
    #  * - default
    复制代码
    然后,根据上面列出的ruby名称,rvm use ruby-2.0.0-p353就可以切换ruby版本了

    5.执行rvm gemset rails4命令后,报错如下:
    Unknown subcommand 'rails4'
    解决办法:rvm gemset create rails4  (create不要忘记了) 
    来自:PC 广东省广州市
    上一篇: Chrome启用Flash的方法
    您可能还喜欢这些:

    亲,沙发正空着,还不快来抢?

    评论审核已开启 记住我的个人信息 回复后邮件通知我