花了兩天時間,基於centos6.5操做系統,搭建了redmine環境,在這裏記錄下過程當中遇到的問題以及搭建流程。php
centos6.5;html
redmine2.5.0;mysql
Ruby1.9.3;linux
yum -y install zip unzip 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 httpd mysql mysql-server
chkconfig httpd on chkconfig mysqld on service httpd start service mysqld start
Because we not have a password for the root account so you press Enter to skip. Enter current password for root (enter for none): #輸入當前mysql的root密碼,由於yum套件關係,root密碼爲空,直接回車便可 Select Yes to set the password for the MySQL root account. #是否設置新的mysql root密碼,選是 Set root password? [Y/n] y Enter and confirm your password, remove the anonymous user, select Yes Remove anonymous users? [Y/n] y #是否移除匿名用戶,安全起見,選是 Allow remote login to MySQL as root account, select No. Disallow root login remotely? [Y/n] n #是否關閉root遠程登陸,看你如何選擇了,官網說否,若是不是外網服務器的話,開放也無所謂。 Delete the test database, select Yes Remove test database and access to it? [Y/n] y #移除測試數據庫 Reload privilege tables, select Yes #刷新權限配置信息 Reload privilege tables now? [Y/n] y
vi /etc/selinux/config SELINUX=disabled
編輯保存退出後,輸入如下命令,不重啓系統關閉selinuxc++
setenforce 0
注:web
setenforce 1 設置SELinux 成爲enforcing模式sql
setenforce 0 設置SELinux 成爲permissive模式,即關閉selinux數據庫
service iptables stop chkconfig iptables off
由於不是外網服務器用不到iptables作安全過濾。apache
由於redmine是ruby開發,安裝php和phpmyadmin主要是爲了方便管理mysql數據庫vim
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
\curl -L https://get.rvm.io | bash
運行成功會生成一個文件,而後運行如下命令
source /etc/profile.d/rvm.sh rvm list known
2.6版本須要ruby 支持的版本,在這咱們選擇1.9.3 穩定版
rvm install 1.9.3
注:這個ruby版本很考究的,目前安裝官網文檔,安裝redmine 2.5X的均可以用1.9.3
安裝完成後檢查ruby版本
ruby -v
返回顯示:ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux] ,說明安裝成功。
yum -y install rubygems
注:rubygems是Ruby’s packages management program 包管理程序,至關於yum 或者apt-get,全部ruby的東西由它來保(an)護(zhuang)
gem install passenger passenger-install-apache2-module
注:
The full name of the Passenger is Phusion Passenger, known as mod_rails or mod_rack, it is a web application intergrate with Apache and it can operate as a standalone web server support for the Ruby On Rails applications.總的來講就是ruby和apache結合的代謝物,redmine的apache支持,這樣能夠經過apache訪問.
上述安裝完成後會提示:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-5.0.28/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-5.0.28 PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p551/wrappers/ruby </IfModule>
注意是安裝完成的提示,複製出來而後使用,將複製的內容保存爲一個新的apache配置文件
vi /etc/httpd/conf.d/passenger.conf
粘貼內容後保存退出,重啓apache
service httpd restart
mysql -u root -p create database redmine_db character set utf8 ; #建立數據庫 create user 'admin'@'localhost' identified by 'admin'; #建立用戶 grant all privileges on redmine_db.* to 'admin'@'localhost'; #受權 quit ;
wget http://www.redmine.org/releases/redmine-2.5.0.tar.gz #下載最新版本,只要是2.5X範圍便可 tar xvfz redmine-2.5.0.tar.gz mv redmine-2.5.0 redmine rm -rf redmine-2.5.0.tar.gz
注:
教程是新建了一個文件夾來做爲存放目錄,我在這裏直接安裝到主目錄下,並更改文件名爲redmine.難怪按照教程的路徑去配置後面的文件會找不到...
安裝完畢後,咱們須要在httpd的redmine.conf中進行修改:
cd /redmine/config cp database.yml.example database.yml vi database.yml #輸入mysql訪問信息,帳號,密碼,數據庫名字,使用第一個production配置,編輯完成後保存退出 production: adapter: mysql2 database: redmine host: localhost username: redmine password: "redmine" encoding: utf8
注意:官網中說MySQL database using ruby 1.9 (adapter must be set to mysql2)
cd /var/www/redmine 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
其實仔細看提示,都會告訴你該執行什麼命令來解決問題。
安裝成功的提示:
Bundle complete! 21 Gemfile dependencies, 56 gems now installed. ------ Details here: http://www.elabs.se/blog/60-introducing-capybara-2-1
安裝完成後初始化數據庫,默認選擇便可。
rake generate_secret_token #初始化redmine數據庫表名 RAILS_ENV=production rake db:migrate RAILS_ENV=production rake redmine:load_default_data
cd redmine/public mkdir plugin_assets cp dispatch.fcgi.example dispatch.fcgi cp htaccess.fcgi.example .htaccess
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 rm -rf epel-release-6-8.noarch.rpm
mkdir -p /data/redmine-2.6.3/files #因爲我本身把redmine安裝在主目錄下,執行這句命令時,提示我文件已存在...
cd redmine-2.6.3/config cp configuration.yml.example configuration.yml
因爲咱們的files目錄在redmine根目錄下,所以configuration不用配置了,若是files目錄在其餘地方,咱們須要
vim configuration.yml attachments_storage_path: /var/redmine/files
<VirtualHost *:80> ServerName your_domain #我填的是所在服務器的IP地址 ServerAdmin your_domain@domain.com #沒有指定域名,因此我沒寫這句 DocumentRoot /redmine/public/ # !!! Be sure to point DocumentRoot to 'public'! ErrorLog logs/redmine_error_log <Directory "/redmine/public/"> Options Indexes ExecCGI FollowSymLinks Order allow,deny Allow from all # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. </Directory> </VirtualHost>
注:redmine目錄要正確,指定好對應的域名(若是有的話...)。
以便apache能夠訪問redmine(先切到redmine安裝的目錄下,個人是根目錄,因此...)
chown -R apache:apache redmine chmod -R 755 redmine service httpd restart
測試試試看
binggo~
默認的用戶名和密碼都爲admin
全部配置到此爲止(其實我沒有配置email...從此有空再說),主要參考文檔:
http://www.redmine.org/projects/redmine/wiki/Install_Redmine_25x_on_Centos_65_complete