一.安裝版本說明
CentOS: 6.5-x86_64
Apache: 2.4.9
PHP: 5.5.65:
Mysql: 5.6.16
二.安裝CentOS_6.5-x86_64
1. 系統安裝流程
介面1選擇基本儲存裝置
介面2選擇全新安裝
網路介面3主機名稱:localhost中,選擇Systemeth0 點選編輯
彈出的System eth0編輯介面中,選取自動連接,選擇IPv4標籤,方法改為手動。
點選新增,位址列裡IP輸入192.168.1.XXX,子網路遮罩輸入24 ,閘道輸入192.168.1.1
DNS伺服器:202.96.209.13349.預設
介面5,密碼:XXXXX
介面6,選擇使用所有空間,左下角的檢視並修改分區佈局,勾上
介面7,資料儲存裝置區域中,將安裝的硬碟移到右邊的安裝在目標裝置中,並且點選選取引導裝載程式。
介面8,刪除LVM磁碟區群組下的設備,刪除設備下的分割標籤,如sda1,sda2等,僅保留sda,sdb這類的設備標籤。
創建新的分區方案,方案如下:
Sdb1 /boot 強制主分區 Sdb2 /Sdb3 /usr/local ext4 50GB
Sdb5 /var 建議將所有的系統日誌指向該目錄的
log目錄下
Sdb6 6144 MB
記憶體的1-2倍之間,建議
1.5倍 ext4 剩餘全部空間
介面9,並點選更換設備,選擇引導磁區的第一分割區介面10,選擇Minimal Desktop安裝完成後重新啟動建立使用者名稱:redmine 密碼:XXXXX設定時間網路同步啟動kdump,預設重新啟動設定時間網路同步啟動kdump,預設完成後重新啟動完成後重新啟動
2. 安裝基本依賴元件# su -
ssl openssl-devel pcre-develgd kernel keyutils patch perl kernel-headers compat* mpfr cppglibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devellibcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm*freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2libxml2-devel patch🠦 ptlrzsvel vinxml2libxml2-devel patch
pt ptlrzsvel vinm-
3. 修改防火牆
# vi/etc/sysconfig/iptables//修改牆設定檔,開放對應埠22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp-p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp-p tcp --dport 8000:9000-j ACCEPT
-A INPUT -m state --state NEW -m tcp-p tcp --dport 3306 -joc ACPTPT state --state NEW -m tcp-p tcp --dport 3000 -j ACCEPT
# /etc/init.d/iptablesrestart
#最後重啟防火牆使設定生效
4. 關閉SELINUX
# vi /etc/selinux/config
#SELINUXTYPE=targeted #註解掉
SELINUX= disabled #增加
# reboot #重啟系統
三.安裝Mysql-5.6.16
# su -//改成root用戶權限
1. 安裝cmm-2.8.10.221
# cd cmake-2.8.10.2
# ./bootstrap
# make
# make install . 設定mysql使用者群組
#groupadd mysql
# useradd -r -g mysql mysql
3. 創造mysql 安裝目錄
# mkdir -p / home/data/mysqldb
//資料檔案目錄4. 編譯並安裝MySQL-5.6.16# tartargLvf mysql-5.6.16. .16
# cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/home/data/mysqldb-DMYSQL_TCP_PORT=3306 -DSYSCONFDIR=/et5 - DDEFAULT_COLLATION=utf8_bin-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWITH_DEBUG=0 -DWITH_READLINE=1 -DWITH_SSL=yes
#(有時候會出現找不到/usr/local/mysql/data 等警告,不管他,直接繼續編譯)# rm CMakeCache.txt
重新運作配置,需刪除CMakeCache.txt檔案
# make
# make install /mysql
# chown -R mysql:mysql .
6. 修改資料庫檔案目錄
# cd /home/data/mysqldb
# cd /usr /local/mysql
# scripts/mysql_install_db--user=mysql --datadir=/home/data/mysqldb
8. 複製mysql服務啟動配置文件
# cp/usr/ local/mysql/support-files/my-default.cnf /etc/my.cnf (可覆蓋)
9. 複製mysql服務啟動腳本及加入PATH路徑
# cp support-files/mysql.sql/etc/init.
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export PATH
/pro /my.cnf在[mysqld]下加入
datadir =/home/data/mysqldb10. 設定開機啟動mysql
/555 d# chkconfig mysqld on
11. 修改mysql 密碼# service mysqld start
# /usr/loc/sl/Rido# service mysqld restart
# /usr/local/mysql/bin/mysql -u root–p //新密碼登入驗證
mysql> showdatabases;四.安裝Ruby-2.1.5
1. 安裝ruby-2.1.5
# tar xzf ruby-2.1.5.tar.gzure --prefix=/usr/local/ruby
# make
# make install
# 片
🜎🜎export PATH=/usr/local/ruby/bin:$PATH
# source /etc/profile
查看ruby版本號
# ruby -v# ruby -v
🟎 revision 48405) [x86_64-linux]2. 安裝為 rubygems-2.4.6
# tar xzf rubygems-2.4.6.tgz# tar xzf rubygems-2.4.6.tgzn.
# ruby setup. rb
# cd ..提示:gem是一種文件組織的包,一般的ruby的許多插件都有由這種各種的包提供。
# gem -v
2.4.6
# which gem
/usr? # gem sources -l
*** CURRENT SOURCES ***https://rubygems.org/
# gem sources --remove https://rubygems.org/
https從 sources# gem sources -ahttps://ruby.taobao.org/
https://ruby.taobao.org/ added to sources# gem sources -l*** SOURCES ***
https://ruby.taobao.org/
Redmine需要考慮Ruby版本相容性問題,請參考:http://www.redmine.org/projects/redmine/wiki/RedmineInstall
Redmine選擇安裝2.5.3版本,所以rails安裝3.2版本
# gem install rails -v=3.2.19 # rails -vRails 3.安裝Apache-2.4.91.
安裝apr-1.5.1
# tar –zxf apr-1.5.1.tar.g# tar –zxf apr-1.5.1.tar.g
# ./configure –prefix=/usr/local/apr
# make# make install
安裝apr-util-1.5 .4
# tar –zxf apr-util-1.5.4.tar.gz# cd apr-util-1.5.4
# ./config/whiv apr-util--with-apr=/usr/local/apr/bin/apr-1-config
# make
# makr install
# makr install
pcre-8.33
# tar –zxf pcre-8.33.tar.gz
# cd pcre-8.33
# ./configure --prefix=/usr/local/pcre
# make
# make install
# cd ..
4. 安裝有ssl-1.0.1l
# cd openssl- 1.0.1l
# ./config --prefix=/usr/local/openssl
-fPIC no-gost# make
# make install
# cd ..
5. 安裝apache-2.4.9
# tar –zxf httpd.2.4.9.tar.gz# cd prop.2.4. usr/local/apache2--with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache--enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so--enable-rewrite--enable-ssl --with-apr=/usr/local/apr/ --with-apr- util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --with-ssl=/usr/local/openssl
# make
# make
# cd ..
6. 追加fcgid模組# tar zxvf mod_fcgid-2.3.6.tar.gz# tar zxvf mod_fcgid-2.3.6.tar.gz
# APXS=/usr/ local/apache2/bin/apxs./configure.apxs ----->/soft/apache/bin是apache的安裝位址
# make
# make install
7.服務的話,需要先卸載# yum list |grep httpd
正式進行設定開機啟動
# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
# vi /etc/rc.d/init.d/httpd
在#!/bin/sh
後面加入下面兩行
#chkconfig:345 85 15
#description:Start and stops the Apache HTTP Server.
d/c# chkconfig --add httpd
8. 修改http.conf# mkdir –p/var/var/ usr/local/apache2/conf/ httpd.conf
添加ServerName localhost:80
redmine
虛擬伺服器預留連接埠
Listrn 8008 //為bugfree
DocumentRoot "/usr/local/apache2/htdocs”e
DocumentRoot" /var/www/html"
CustomLog "logs/access_log"common
e CustomLogo "/var/varlog/c/Fr "
e
ErrorLog"/ var/log/httpd/error_log"9. 驗證
重啟apache,# service httpd restart
然後用瀏覽器打開網頁。 六.安裝PHP-5.5.6
1. 安裝zlib-1.2.8# tar zxvf zlib-1.2.8.tar.gz --prefix=/usr/local/zlib
# make
# make install
# cd # tar zxvf libxml2- 2.7.1.tar.gz
# cd libxml2-2.7.1
# ./configure--prefix=/usr/local/libxml2 --without-zlib🜎 # make install
# cd ..
3. 安裝libpng-1.2.31
# m libpng-1.2.31# ./configure--prefix=/usr/local/libpng
# make
# make hill 片
# type-2.5.0.1
# tar zxvf freetype-2.5.0.1.tar.gz
# cd freetype-2.5.0.1
# ./configurepout-freeoper/prooutwout-operwooo-p未來詞--/configure # make
# make install
# cd ..
5.# cd jpeg-9/
# ./configure--prefix=/usr/local/jpeg9
# make
# make install.cd 2.5.7
# tar -zxvf libmcrypt-2.5.7.tar.gz
# cd libmcrypt-2.5.7# mkdir -p /usr/local/libmcrypt
# ./configureprefix=/usr /local/libmcrypt/
# make
# make install
# xvf gd-2.0.35. tar.gz
# mkdir -p /usr/local/gd
# cd gd-2.0.35
.gd m4_pattern_allow --with-jpeg=/usr/local/jpeg9--with-png=/usr/local/libpng --with-zlib=/usr/local/zlib--with-freetype=/usr/local/freetype - -with-libmcrypt=/usr/local/libmcrypt
# make
# make install
# cd. # tar -zxvf php-5.5.6.tar.gz
# cd php-5.5.6
# ./configure--prefix=/usr/local/php --with-config-file-path=/usr /local/php/etc--with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock--with-gd --with-iconv--with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/jpeg9--with-png-dir=/usr/local/libpng --with -zlib=/usr/local/zlib--with-libxml-dir=/usr/local/libxml2 --enable-xml --enable-bcmath--enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex--enable-mbstring --enable-ftp --enable-gd-native-ttf --without-pear--with-openssl --enable-pcntl --enable-sockets --with-xmlrpc - -enable-zip--enable-soap --with-gettext --enable-session --with-mcrypt=/usr/local/libmcrypt/--enable-mbstring --with-pdo-mysql=/usr/local/mysql
# make
# make install
/9. 修改apache2配置,載入php模組
# vi/usr/local/apache2/conf/httpd.conf在php;
添加
AddTypeapplication/x-httpd-php .php
AddTypeapplication/x-httpd-php-source .phps
OptionsIndexes FollowSymLinks
e Options Indexes FollowSymLinksIncludes IncludesNOEXEC ExecCGI
#service httpd restart
10.date_default_timezone_set( "PRC");
phpinfo();
?>打開瀏覽器,訪問192.168.1.32
11. tarcurl模組
# cd/home/redmine/php-5.5.6/ext/curl//php來源碼的目錄
# /usr/local/php/bin/phpize./config /usr/local/php/bin/php-config--with-curl=/home/redmine/curl-7.41.0# cd /home/redmine/curl-7.41.0
# make
# make install
修改php.ini檔案
# vi /usr/local/php/php.ini追加extension==curl. 1)直接在curl的源碼目錄最上層,運行phpize,提示如下錯誤:
Cannot find config.m4. Make sure that you run'/home/zhuyx/local/php-5.5.3/bin/phpize ' in the top level source directory ofthe module
原因:
phpize擴充安裝,來源套件需要有config.m4這個設定檔;目前擴充的原始碼包不包含(memcache的就包含)。 解決方法:
(1)進入php原始碼套件的ext/curl 下面執行phpize,再進行安裝
(2)./configure --with-php-config=/php編譯後目錄/bin/php -config --with-curl=curl原始碼目錄
問題擴充:
安裝其他的php擴充的時候,遇到類似問題,都可以採取上述解決方案。
七.安裝phpMyAdmin-4.3.12
1. 安裝phpMyAdmin-4.3.12
# unzipphpMyAdmin-4.3.12-all-languages。 /www/ html/phpMyAdmin開啟瀏覽器,位址http://192.168.1.32/phpMyAdmin
2. %,localhost,都對同名資料庫具有最大權限。
八.安裝Redmine-2.5.3
1. 部署程式檔案
# tar xzf redmine-2.5.3.tar.gz -C /usr/local/c🜎 .3,}
2. 安裝redmine依賴的所有ruby包
# cd /usr/local/redmine# cd /usr/local/redmine性能
# gem install bundler
#注意是在網站根目錄下執行
Successfully installed bundler-1.8.5
Parsing documentation for bundler-1.8.5個
D installing dock ormet 5353D instaled 337 月# bundle install --withoutdevelopment test rmagick #完成redmine依賴套件的安裝
bundler是用來管理ruby的套件相依性的工具Gem::RemoteFetcher::FetchError:ErrnoConnectionConnection:cE):: ETIMd ) for "rubygems.global.ssl.fastly.net"port 443 (https://rubygems.org/gems/builder-3.0.0.gem)
An error occurred while installing builder(3.0.0), anddler cannot continue.Make sure that `gem install builder -v'3.0.0'` succeeds before bundling.
# gem install builder -v'3.0.0' install mg .0'#gem install json -v '1.8.2'
# gem install net-ldap -v '0.3.1 '
#gem install ruby-openid -v '2.3.0' 4. #gem install redcarpet -v '2.3.0'
#bundle install --without development test rmagick # 再次執行
3. 初始化redmine資料庫
修改Redmine的database.yml
# cp database.yml.exampledatabase.yml
# vi database.yum #修改對應資料庫連線資訊
production:
adapter: mysql2
database: redmine建議使用
IP位址,而非機器名稱
redmine.server,預設的webrick在解析伺服器名稱方面效率非常低,導致回應非常慢,redmine.serverpass : "XXXXX"encoding: utf8為Rails產生cookies秘鑰 # RAILS_ENV=production rakedb:migrate
產生缺省資料
# RAILS_ENV=productionREDMINE_LANG=zh rake redmine:load_default_data
# cd /data/wwwroot/redmine
# mkdir -p public/plugin_ass chown -R redmine/usr/local/redmine/
# chmod -R 755 /usr/local/redmine/
tmp ;public/plugin_assets(若不存在則建立該路徑,plugins資源)5. 修改redmine設定檔
# cpconfiguration.y.expample /redmine/attachments
# chown -R redmine/home/data/redmine
#mkdir -p /var/log/redmine
#chown -R redmine.redmine /var/log/redmine
# vi configuration.yml _method: smtp
e
delivery_method: async_smtp
attachments_storage_path: /home/data/redmine/attachments
scm_stderr_log_file:/var/log/redmine/scm_stderr.log
6. 啟動與關閉redmine# vi /etc/passwd
#讓www用戶有bash權限,lnmp腳本安裝www用戶沒有bash權限# su redmine -c "rubyscript/rails server webrick -e production -d"
或# rubyscript/server webrick -e production -d或# ruby/usr/local/redmine/script/server webrick -e production –d /IP:3000(注意:開啟iptables 3000埠號)
缺省管理員使用者:login: admin
password: admin
停止服務方法:(ps指令查出此行程的pid號,再殺掉,目前好像只能這樣,我看了--help裡面,還沒停止的參數。)
# ps aux | grep ruby
# kill -9 [PID]
九.整合Apache和Redmine
1. 安裝Passenger
# gem install passenger
Fetching: passenger-5.0.4.gem (100%)
Fetching: passenger-5.0.4.gem (100%))帶.... Successfully installed passenger-5.0.4Parsing documentation for passenger-5.0.4Installing ri documentation for passenger-5.0.4Done doclling instaoter for passage 5t 53d # passenger-install- apache2-moduleWelcome to the PhusionPassenger Apache 2 module installer, v5.0.4.This installer will gush youb. s in total.
Here's what you can expect from the installation process:
1. The Apache 2 module willbe installed for you.
2. You'll learn how toconfigure Apache.
3.al. Don't worry if anything goes wrong. This installer will advise youon how to
solve any problems.
Press Enter to continue, 輸入 Ctrl-C to abort.
Press Enter to continue, or Ctrl-C to abort. ---------------------------------------Which languages are you interested in? UseNode 按回車
Installation instructions for required software
* To install Apache 2:
Please install it with yuminstall httpd
* To install Apache 2development installers installid * To install Apache PortableRuntime (APR) development headers:
Please install it with yuminstall apr-devel
* To install Apache PortableRuntime Utility (APU) development headers:
) install installaled didn't solve your problem , thenplease take
a look at the Users Guide:
/usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.4/doc/Users guideApache.html https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html
# ln -s/usr/local/apache2 /etc/httpd/lib
/apache2 /etc/httpd/lib
#m # ln -s/usr/local/apache2/modules /usr/lib/httpd/modules # ln -s/usr/local/apache2/bin/http # rm /usr/sbin/apxs# rm /usr/sbin/apxs
# rm /usr/sbin/apxs
# /bin/ln -s /usr/local/apache2/bin/apxs/usr/sbin/apxs
# yum install apr-devel# yum installapr-util-devel
# passenger-install-apache2-module
# passenger-install-apache2-module
----------------- ---------------------------
Almost there!Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.4/buildout/apache2/mod_passenger.so
PassengerDefaultRuby/usr/local/ruby/bin/ruby y web
applications on Apache, with a minimum amount of configuration!
Press ENTER to continue.
--------------------------- -----------------
Deploying a web application: an example
Suppose you have a web application in /somewhere. Add a virtual hostto your
Apache configuration file and set
Apache configuration file and set its DocumentRoot to/somewhere/public:DocumentRoot/somewhere/public
# relaxes Apachesecurity settings.
AllowOver
Options -MultiViews# Uncomment this ifyou're on Apache >= 2.4:
#Require
And that's it! You may also want to check the Users Guide forsecurity and optimization tips, troubleshooting and other useful information: /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.4/doc/Users guideApache.html.html://www. phusionpassenger.com/documentation/Users%20guide%20Apache.htmlEnjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)https://www.phusionpassenger.com trademark of Hongli Lai & Ninh Bui. 最後出現此表示安裝成功。 2. 配置Apache載入Passenger# vi /usr/local/apache2/conf/httpd.conf
/libm/cm 0/ gems/passenger-5.0.4/buildout/apache2/mod_passenger.so
by/gems/2.1.0 /gems/passenger-5.0.4
PassengerDefaultRuby/usr/local/ruby/bin/ruby
取消
LoadModulerewrite_module modules/mod_rewrite.so的
#註釋
取消Includeconf/extra/httpd-vhosts.conf
的#:wq退出3. 為redmine創建虛擬機
# vi /usr/local/ap2/c/F2/2/Fv.ServerAdmin maoyunzhi@jorudan.com .cn
# !!! Be sure to point DocumentRoot to'public'!
DocumentRoot /usr/local/redmine/publiccalo/ocoo🜥 public> # This relaxes Apache securitysettings.
Al
Options -MultiViews
Options -MultiViewsOptions -MultiViews
# Uncomment 的 Apache you're on Apache>
Require all granted
. dler fcgid-script .fcgi
FCGIWrapper"/usr/local/ruby/bin/ruby /usr /local/redmine/public/dispatch.fcgi".fcgi
ErrorLog d /redmine-access_log" common
:wq 退出/cd
/片/p .fcgi.exampledispatch.fcgi
# cp htaccess.fcgi.example. htaccess
4. 修改檔案權限# chown –R ache.apache/home/ redmine
# chown –R apache.apache/var/log/redmine
5. 重啟apache
# serviceservice httpd restart 十.安裝Bugfree-3.0.4
1. 安裝bugfree-3.0.4
# unzipbugfree_v3.0.4.zip
chmod -R 777 install
2. 設定bugfree參數開啟瀏覽器http://192.168.1.32/bugfree3.0.4/install/,對照路徑權限,逐一修改權限,逐一修改
權限# mkdir -p /home/data/bugfree/BugFile
# chown -R apache.apache /home/data/bugfree
# chmod -R 755 /home/ # chmod -R 777 資源
# chmod -R 777 受保護/運行時
# chmod -R 777 受保護/配置
# chmod -R 777 受保護/配置/ln
# viprotect/config.sample.php
e
'uploadPath' =>'/home/data/bugfree /BugFile','picPreviewApp'=> 'http://'.$_SERVER['SERVER_ADDR'].'/BugFile',
e '.$_SERVER['SERVER_ADDR'].': 8008/BugFile',
:wq 退出
# vi install/index.php(dirname( dirname(dirname(__FILE__)))).DIRECTORY_SEPARATOR. 'BugFile');
e
define('UPLOADPATH', realpath((dirname(dirname(dirname)(dirname()_)). //取消一個dirname值
:wq退出 # viq protected/extensions/kindeditor4/assets/ 修改
$save_path = '../../. . /BugFile/'; e
$save_path ='/home/data/bugfree/BugFile/';
$save_url = 'http://';
$save_url = 'http://'. '/BugFile/';e $save_url= 'http://'.$_SERVER['SERVER_ADDR'].':8008/BugFile/';
,所有前置條件都滿足後,選擇繼續,進入資料庫設定介面。開啟phpMyAdmin介面,新建2個使用者bugfree,設定主機分別為%和localhost,,密碼zaq12wsx,並建立同名資料庫。 在bugfree的資料庫設定介面中,伺服器為localhost,資料庫名為bugfree,密碼zaq12wsx,點選安裝。
3. 設定apache虛擬伺服器# vi /usr/local/apache2/conf/extra/httpd-vhosts.conf
ServerAdmin info@jorudan.com. cn
DocumentRoot"/var/www/html/bugfree3.0.4" ServerName 錯誤"CustomLog"/var/log/httpd/bugfree-access_log" common
low NOEXEC ExecCGI
目錄>
service httpd restart
如果修改沒有生效,請刪除assets下所有文件,在刷新頁面。
以上就介紹了CentOS6.5+apache+mysql+php+Ruby+Redmine+phpMyAdmin+BugFree,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。