centos下配置redmine

1.CentOS 6.5下安裝基本的軟件環境

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

2.安裝apache和mysql,並配置redmine數據庫

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install mysql-community-server httpd -y

安裝完成後,service mysqld start,並進行相關數據庫配置

mysql> create database redmine character set utf8; 

Query OK, 1 row affected (0.00 sec)  

mysql> create user 'redmine'@'localhost' identified by 'redmine'; 

Query OK, 0 rows affected (0.00 sec)  

mysql> grant all privileges on redmine.* to 'redmine'@'localhost'; 

Query OK, 0 rows affected (0.00 sec)  

mysql> flush privileges;      

Query OK, 0 rows affected (0.00 sec)

3.iptables設置

如果服務器開了防火牆,我們需要進行相關設置(練習時可以關閉防火牆)

/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

4.安裝php環境

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


5.安裝ruby環境

[root@usvr-126 ~]#\curl -L https://get.rvm.io | bash

[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

2.6版本需要ruby 支持的版本,在這我們選擇1.9.3 穩定版 

rvm install 2.1.0

[root@usvr-126 ~]# ruby -v

ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]

6.安裝rubygems 

yum -y install rubygems

7.安裝redmine的apache支持,這樣可以通過apache訪問

gem install passenger
passenger-install-apache2-module

命令執行完後按照提示進行配置http:

vim /etc/httpd/conf.d/passenger.conf

LoadModule passenger_module /usr/local/rvm/gems/ruby-2.3.1/gems/passenger-5.0.30/buildout/apache2/mod_passenger.so

   <IfModule mod_passenger.c>

     PassengerRoot /usr/local/rvm/gems/ruby-2.3.1/gems/passenger-5.0.30

     PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.3.1/wrappers/ruby

   </IfModule>

8.安裝redmine

wget http://www.redmine.org/releases/redmine-2.6.3.tar.gz
tar -zxvf redmine-2.6.3.tar.gz
mv redmine-2.6.3 /data

安裝完畢後,我們需要在httpd的redmine.conf中進行修改:

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

<VirtualHost *:80>

      ServerName 192.168.0.42

      # !!! 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>

~                      

重啓   service httpd restart   

 

cd /data/redmine-2.6.3/config

cp database.yml.example database.yml

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


10.安裝rails,安裝過程中會出現很多問題,我們來一一解決吧。 

cd /data/redmine-2.6.3

gem install bundler

bundle install 

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

執行gem install mysql2 -v '0.3.18'報錯:

checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing

我們執行yum install mysql-devel後成功安裝,接着bundle install 

rake generate_secret_token

初始化redmine數據庫表名

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

11.修改fastcgi‘

cd /data/redmine-2.6.3/public
mkdir plugin_assets
cp dispatch.fcgi.example dispatch.fcgi
cp htaccess.fcgi.example .htaccess

12.安裝mod_fcgi

rpm --import https://Fedoraproject.org/static/0608B895.txt
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum -y install mod_fcgid

13.創建文件目錄

mkdir -p /data/redmine-2.6.3/files
cd /data/redmine-2.6.3/config
cp configuration.yml.example configuration.yml

由於我們的files目錄在redmine根目錄下,因此configuration不用配置了,如果files目錄在其他地方,我們需要 

vim configuration.yml
p_w_uploads_storage_path: /var/redmine/files

14.最後啓動redmine

cd /data/redmine-2.6.3
chown -R apache:apache redmine-2.6.3
chmod -R 755 redmine-2.6.3
service httpd restart

http://ip      默認的用戶名和密碼都爲admin

另外若apache訪問不了,我們可以先用redmine自己的啓動方式啓動,然後ip:3000端口進行訪問,如果訪問成功,則redmine配置沒問題,可能是apache的配置問題或漏改配置了

下面是redmine的啓動方式,

[root@usvr-126 redmine-2.6.3]# cd /data/redmine-2.6.3  
[root@usvr-126 redmine-2.6.3]# ruby script/rails server webrick -e production
=> Booting WEBrick
=> Rails 3.2.21 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2015-03-28 01:09:30] INFO  WEBrick 1.3.1
[2015-03-28 01:09:30] INFO  ruby 1.9.3 (2014-11-13) [x86_64-linux]
[2015-03-28 01:09:30] INFO  WEBrick::HTTPServer#start: pid=14577 port=3000


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章