CentOS7+ApacheServer2.4+MariaDB10.0+PHP7.0+禪道項目管理軟件8.0環境部署php
by:授客 QQ:1033553122html
目錄node
1、 實踐環境 mysql
2、 安裝操做系統 c++
3、 安裝MariaDB數據庫 sql
5、 PHP安裝與配置 apache
CentOS 7操做系統(CentOS-7-x86_64-DVD-1503-01.iso)
下載地址:http://ftp.riken.jp/Linux/centos/7/isos/x86_64/
Apache HTTP Server(httpd-2.4.17.tar.gz)
下載地址1:http://pan.baidu.com/s/1c1pfUiW
下載地址2:http://httpd.apache.org/download.cgi
MariaDB 10.0(MariaDB-10.0.19-centos7-x86_64)
下載地址1:http://pan.baidu.com/s/1jH3gPbK
下載地址2:https://downloads.mariadb.org/mariadb/+releases/
PHP 7.0(php-7.0.0.tar.gz)
下載地址1: http://pan.baidu.com/s/1o7v7hou
下載地址2:http://php.net/downloads.php
禪道項目管理軟件8.0.stable版本(ZenTaoPMS.8.0.stable.zip)
下載地址1:http://pan.baidu.com/s/1bolelv5
下載地址2:
http://sourceforge.net/projects/zentao/files/8.0/ZenTaoPMS.8.0.stable.zip/download
Apache Server安裝相關依賴軟件
apr(apr-1.5.2.tar.gz), apr-util(apr-util-1.5.4.tar.gz)
下載地址:http://mirrors.cnnic.cn/apache/apr/
pcre(pcre-8.37.tar.gz)
下載地址:http://pcre.org/
PHP安裝相關依賴軟件
libxml2(libxml2-2.6.27.tar.gz)
下載地址:http://download.chinaunix.net/download/0007000/6095.shtml
以上依賴軟件包集合下載地址2:http://pan.baidu.com/s/1hrsv7nu
軟件選擇(SOFTWARE SELECTION):
磁盤分區(INSTALLATION DESTINATION)
安裝
[root@localhost home]# ls
lost+found MariaDB-10.0.19-centos7-x86_64-server.rpm
MariaDB-10.0.19-centos7-x86_64-client.rpm MariaDB-10.0.19-centos7-x86_64-shared.rpm
MariaDB-10.0.19-centos7-x86_64-common.rpm MariaDB-10.0.19-centos7-x86_64-test.rpm
MariaDB-10.0.19-centos7-x86_64-devel.rpm
[root@localhost home]# rpm -iUvh MariaDB*.*
warning: MariaDB-10.0.19-centos7-x86_64-client.rpm: Header V4 DSA/SHA1 Signature, key ID 1bb943db: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:MariaDB-common-10.0.19-1.el7.cent################################# [ 14%]
2:MariaDB-client-10.0.19-1.el7.cent################################# [ 29%]
started; log sequence number 1616697
……(略)
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
'/usr/bin/mysql_secure_installation'
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
……(略)
4:MariaDB-devel-10.0.19-1.el7.cento################################# [ 57%]
5:MariaDB-shared-10.0.19-1.el7.cent################################# [ 71%]
6:MariaDB-test-10.0.19-1.el7.centos################################# [ 86%]
Cleaning up / removing...
7:mariadb-libs-1:5.5.41-2.el7_0 ################################# [100%]
編輯/etc/my.cnf文件,添加以下帶背景色內容
[root@localhost ~]# vim /etc/my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[mysqld]
user=mysql
~
~
啓動數據庫服務器
[root@localhost home]# /usr/sbin/mysqld --user=mysql
修改root用戶密碼
[root@localhost home]# /usr/bin/mysqladmin -u root password 'test1234'
進行安全設置
[root@localhost home]# /usr/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n
... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
建立用戶與受權
[root@localhost ~]# mysql -u root -ptest1234
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.0.19-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create user 'testacc'@'182.168.1.103' identified by 'test1234';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on *.* to 'testacc'@'%' identified by 'test1234';
Query OK, 0 rows affected (0.00 sec)
> grant all privileges on *.* to 'testacc'@'192.168.1.100'identified by 'test1234';
Query OK, 0 rows affected (0.00 sec)
> flush privileges;
注:這裏192.168.1.100爲mysql客戶端所在主機,即我本地主機
安裝相關依賴軟件
[root@localhost tmp]# tar -xvzf apr-1.5.2.tar.gz
……(略)
[root@localhost tmp]# tar -xvzf apr-util-1.5.4.tar.gz
……(略)
[root@localhost tmp]# tar -xvzf pcre-8.37.tar.gz
……(略)
1、安裝pcre
[root@localhost yum.repos.d]# yum install gcc
……(略)
[root@localhost yum.repos.d]# yum install gcc-c++
……(略)
注:若是編譯pcre時未安裝gcc,gcc-c++,會分別報告以下錯誤
configure: error: no acceptable C compiler found in $PATH
configure: error: You need a C++ compiler for C++ support.
安裝pcre
[root@localhost tmp]# cd pcre-8.37
[root@localhost pcre-8.37]# ./configure --prefix=/usr/local/pcre
……(略)
[root@localhost pcre-8.37]# make && make install
……(略)
2、安裝apr
[root@localhost tmp]# cd apr-1.5.2/
[root@localhost apr-1.5.2]# ./configure --prefix=/usr/local/apr
……(略)
[root@localhost apr-1.5.2]# make && make install
……(略)
3、安裝apr-util
[root@localhost tmp]# cd apr-util-1.5.4/
[root@localhost apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
……(略)
[root@localhost apr-util-1.5.4]# make && make install
……(略)
安裝Apache Server
[root@localhost tmp]# tar -xvzf httpd-2.4.17.tar.gz
[root@localhost tmp]# cd httpd-2.4.17/
[root@localhost httpd-2.4.17]# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
……(略)
[root@localhost httpd-2.4.17]# make && make install
……(略)
簡單配置與啓動
編輯httpd.conf,找到ServerName,去掉註釋符號,或者在其下新增一行
[root@localhost httpd-2.4.16]# vim /usr/local/apache/conf/httpd.conf
啓動服務
[root@localhost httpd-2.4.16]# /usr/local/apache/bin/apachectl -k start
訪問
注意:若是沒法訪問,關閉防火牆或者開放端口(臨時),以下
[root@localhost services]# systemctl stop firewalld.service
[root@localhost services]# iptables -I INPUT -p TCP --dport 80 -j ACCEPT
注:建議先臨時關閉防火牆,不然後面的數據庫用戶也沒法遠程鏈接,這會致使禪道安裝失敗
安裝依賴包
[root@localhost tmp]# tar -xvzf libxml2-2.6.27.tar.gz
[root@localhost tmp]# cd libxml2-2.6.27
[root@localhost libxml2-2.6.27]# ./configure --prefix=/usr/local/libxml12
……(略)
[root@localhost libxml2-2.6.27]# make && make install
……(略)
安裝php
[root@localhost tmp]# tar -xvzf php-7.0.0.tar.gz
……(略)
[root@localhost php-7.0.0]# yum install php
……(略)
[root@localhost php-7.0.0]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/local/libxml12/ --with-pdo-mysql
……(略)
[root@localhost php-7.0.0]# make && make install
……(略)
注: --with-pdo-mysql很是重要,若是這裏不指定該選項,安裝禪道時可能會報錯,以下,pdo_mysql擴展未加載
如下是php官網文檔中的部分(也就是不用本身去單獨編譯安裝PDO_MYSQL擴展了,網上關於這個的安裝教程筆者試過,死活不行,各類錯誤)
For example, on Ubuntu the php5-mysql package installs the ext/mysql, ext/mysqli, and PDO_MYSQL PHP extensions. On CentOS, the php-mysql package also installs these three PHP extensions.
Alternatively, you can compile this extension yourself. Building PHP from source allows you to specify the MySQL extensions you want to use, as well as your choice of client library for each extension.
When compiling, use --with-pdo-mysql[=DIR] to install the PDO MySQL extension, where the optional [=DIR] is the MySQL base library. As of PHP 5.4, mysqlnd is the default library. For details about choosing a library, see Choosing a MySQL library.
Optionally, the --with-mysql-sock[=DIR] sets to location to the MySQL unix socket pointer for all MySQL extensions, including PDO_MYSQL. If unspecified, the default locations are searched.
Optionally, the --with-zlib-dir[=DIR] is used to set the path to the libz install prefix.
$ ./configure --with-pdo-mysql --with-mysql-sock=/var/mysql/mysql.sock
參考鏈接:http://php.net/manual/en/ref.pdo-mysql.php
配置php
[root@localhost php-5.6.12]# cp php.ini.dist /usr/local/php/lib/php.ini
注:若是沒有php.ini.dist 則把php.ini-development php.ini-production中的任何一個重命名爲php.ini.dist便可
配置 httpd.conf 讓apache支持PHP
# vim /usr/local/apache/conf/httpd.conf
找到 AddType application/x-gzip .gz .tgz ,而後添加以下帶背景顏色的內容(.前面有空格)
#################Added by laiyu##################
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#################################################
#AddType application/x-gzip .tgz
重啓Apache
[root@localhost php-7.0.0]# /usr/local/apache/bin/apachectl stop
[root@localhost php-7.0.0]# /usr/local/apache/bin/apachectl start
測試php是否成功安裝
寫一個php測試頁info.php,放到Apache的htdocs目錄下。
在瀏覽器中輸入:服務器地址/info.php,如:http://192.168.40.80/info.php
若是可看到php版本,系統等相關信息則表示成功了
修改改配置文件php.ini
1、找到以下帶背景色內容,去掉註釋符號「;」
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
2、找到以下帶背景色內容,再其下新增以下內容
; The path can be defined as:
;
; session.save_path = "N;/path"
(注:如下帶背景色內容爲新增的)
; added by shouke
session.save_path = "0;/var/lib/php/session/"
;
; where N is an integer. Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories. This is useful if
; your OS has problems with many files in one directory, and is
a more efficient layout for servers that handle many sessions.
; NOTE 1: PHP will not create this directory structure automatically.
; You can use the script in the ext/session dir for that purpose.
; NOTE 2: See the section on garbage collection below if you choose to
; use subdirectories for session storage
;
; The file storage module creates files using mode 600 by default.
; You can change that by using
;
; session.save_path = "N;MODE;/path"
說明:如上,session.save_path = "N;MODE;/path",其中,N 表示多級目錄,值爲數字,若是大於0,則不會執行自動垃圾回收,對於絕大多數站點,大於1或者2的值會不太合適——由於這須要建立大量的目錄:例如,值設置爲 3 須要在文件系統上建立 64^3 個目錄,將浪費不少空間和 inode。僅僅在絕對確定站點足夠大時,才能夠設置 N 大於2。MODE 表示建立的 Session 文件權限,默認使用 mode 600 建立文件。/path 表示 Session 存儲路徑
保存,重啓Apache
找到; extension_dir = "./",在其下新增一行,以下帶背景色內容
; http://php.net/extension-dir
; extension_dir = "./"
extension_dir = "/usr/local/php/lib/php/extensions"
; On windows:
; extension_dir = "ext"
說明:這一步修改操做或許能夠不執行,
修改會話存儲目錄權限
[root@localhost session]# chmod o=rwx -R /var/lib/php/session/
注:若是這裏進行修改權限操做,那麼安裝禪道時可能會報以下錯誤
[root@localhost tmp]#unzip ZenTaoPMS.8.0.stable.zip
……(略)
[root@localhost tmp]#mv zentaopms /usr/local/apache/htdocs/
接着打開瀏覽器訪問
http://192.168.1.103/zentaopms/www/index.php
打開後會出現一個界面,上面有一個大大的安裝按鈕,點擊安裝按鈕開始安裝(很差意思,這一步忘記截圖了)
如上,勾選協議,點擊【下一步】,
如上,點擊下一步
如上,填寫數據庫相關信息,注意這裏的信息必須準確填寫,,點擊【保存】
如上,點擊【下一步】
如上,輸入公司名稱,超級管理員賬號和密碼信息,點擊【保存】
如上,安裝成功,有必要的話刪除安裝文件install.php,點擊【登錄禪道管理系統】
登錄,查看
查看數據庫
注:要麼關閉防火牆,要麼開放相關端口並寫入靜態配置文件,否則會出現沒法訪問的狀況。
接下來的問題:
1.假如以上部署在內網,咋讓外網的人員也能夠訪問呢?
2.數據備份
pdf版下載:
CentOS7+ApacheServer2.4+MariaDB10.0+PHP7.0+禪道項目管理軟件8.0環境部署.pdf