部署LAMP環(huán)境
一、安裝Apache
1、升級(jí)一下yum源
[root@centos59~]# yum update
2、安裝Apache
[root@centos59 ~]# yum list |grep httpd? ? ? //查看有哪些Apache可以安裝
[root@centos59 ~]# yum install -y httpd? ? ? //安裝Apache
[root@centos59 ~]# httpd -v? ? ? ? ? ? ? ? ? ? ? //查看Apache版本顯示內(nèi)容如下:
Server version: Apache/2.4.6 (CentOS)Server built:? Apr 24 2019 13:45:48
3、通過(guò)瀏覽器訪問(wèn)服務(wù)器的IP地址 驗(yàn)證Apache是否正常運(yùn)行

顯示以上頁(yè)面既安裝成功
如果不能訪問(wèn)一般是Centos自帶的防火墻造成的,解決方法如下:
[root@centos59 ~]#systemctl stop firewalld? ? ? ? ? ? //關(guān)閉防火墻
[root@centos59 ~]# systemctl status firewalld? ? ? ? //查看防火墻狀態(tài)
[root@centos59 ~]# systemctl restart httpd? ? ? ? ? ? //重啟Apache如果不想關(guān)閉防火墻,那我們可以在防火墻上允許訪問(wèn)80端口
[root@centos59t /]# firewall-cmd --permanent --zone=public --add-port=80/tcp? ? ? ? //開(kāi)啟80端口并且永久生效
[root@centos59 /]# firewall-cmd --reload? ? ? ? //重新載入防火墻配置
[root@centos59 /]# systemctl status firewalld? ? ? ? //查看防火墻狀態(tài)
二、安裝MySQL
1、安裝MySQL
[root@centos59 /]# yum install wget? ? ? ? //安裝wget
[root@centos59 /]# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm? ? ? ? //下載mysql5.7的rpm文件
[root@centos59 /]# yum localinstall mysql57-community-release-el7-8.noarch.rpm? ? ? ? //安裝rmp文件
[root@centos59 /]#yum install mysql-community-server? ? ? ? //安裝MySQL數(shù)據(jù)庫(kù) 約190M左右
2、啟動(dòng)并配置MySQL數(shù)據(jù)庫(kù)
[root@centos59 /]# systemctl start mysqld? ? ? ? //啟動(dòng)數(shù)據(jù)庫(kù)
[root@centos59 /]# systemctl enable mysqld? ? ? ? //將MySQL設(shè)置為開(kāi)機(jī)啟動(dòng)項(xiàng)
[root@centos59 /]# systemctl daemon-reload? ? ?
3、修改MySQL數(shù)據(jù)庫(kù)密碼
[root@centos59 /]# grep 'temporary password' /var/log/mysqld.log? ? ? ? //查看MySQL數(shù)據(jù)的原始密碼文件 2019-07-05T04:53:19.343216Z 1 [Note] A temporary password is generatedforroot@localhost: K0iWLj6Z!BX)
[root@centos59 /]# mysql -u root -p? ? ? ? //進(jìn)入數(shù)據(jù)庫(kù)系統(tǒng)
mysql>setpasswordfor'root'@'centos59'=password('1234567');? ? ? ? //重新為數(shù)據(jù)庫(kù)設(shè)置密碼(需要注意密碼規(guī)則)
三、安裝PHP
1、安裝依賴文件
[root@centos59 ~]# yum install gcc-c++ libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel
2、安裝php組新版本rpm
[root@centos59 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpmRetrieving
https://mirror.webtatic.com/yum/el7/epel-release.rpmwarning: /var/tmp/rpm-tmp.F1aZTS: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEYPreparing...
################################# [100%]
Updating / installing...? 1:epel-release-7-5
################################# [100%]
[root@centos59 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmRetrieving
https://mirror.webtatic.com/yum/el7/webtatic-release.rpmwarning: /var/tmp/rpm-tmp.rnxYY3: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEYPreparing...
################################# [100%]
Updating / installing...? 1:webtatic-release-7-3
################################# [100%]
[root@centos59 ~]# yum search php71? ? ? ? ? //查看有哪些php最新版的安裝包文件
[root@centos59 ~]# yum install mod_php71w php71w-mysqlnd php71w-cli php71w-fpm? ? ? //安裝php7最新版
[root@centos59 ~]# systemctl restart httpd? ? ? ? ? ? ? ? ? ? ? ? //重啟Apache
[root@centos59 ~]# vim /var/www/html/index.php? ? ? ? ? ? ? //新建 index.php 文件,輸入以下內(nèi)容:
<?php
phpinfo();
?>
刷新瀏覽器,顯示如下頁(yè)面既安裝成功

四、安裝數(shù)據(jù)庫(kù)管理軟件phpMyadmin
下載phpMyadmin軟件,解壓后移動(dòng)到主頁(yè)目錄
[root@centos59 ~]# wget https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.zip? ? //下載
[root@centos59 ~]# unzip phpMyAdmin-4.9.0.1-all-languages.zip? ? ? //解壓
[root@centos59 ~]# mv phpMyAdmin-4.9.0.1-all-languages /var/www/html/phpmyadmin? ? ? ? //移動(dòng)
瀏覽器中打開(kāi) 服務(wù)器地址/phpmyadmin,登錄后創(chuàng)建用戶和數(shù)據(jù)庫(kù)

安裝osTicket工單系統(tǒng)
1、將osTicket工單系統(tǒng)文件上傳到服務(wù)器 /var/www/html 目錄,訪問(wèn)服務(wù)器地址,osTicket系統(tǒng)會(huì)檢測(cè)服務(wù)器環(huán)境是否滿足要求,顯示頁(yè)面如下:

根據(jù)提示安裝擴(kuò)展
問(wèn)題:在安裝擴(kuò)展的時(shí)候。無(wú)論輸入 " yum install -y php-gd* "來(lái)安裝任何擴(kuò)展。都會(huì)報(bào)錯(cuò):Error: php72w-common conflicts with php-common-5.4.16-43.el7_4.x86_64
解決辦法: 要指定PHP 版本來(lái)安裝,比如上邊報(bào)錯(cuò) 是72w 那么你來(lái)執(zhí)行
[root@centos59 ~]# yum install -y php72w-gd*
就會(huì)安裝成功
接下來(lái)填寫(xiě)信息進(jìn)行安裝

提示如下信息既安裝完成

要登錄后端系統(tǒng)(osTicket控制面板),請(qǐng)使用 域名/scp 地址訪問(wèn)即可:

如果出現(xiàn)錯(cuò)誤"Valid CSRF Token Required",請(qǐng)編輯:include/class.ostsession.php 文件
尋找:
catch(DoesNotExist $e) {
? ? $this->data =newSessionData(['session_id'=> $id]);
}
在 } 前面添加:
$this->data->session_data ="";
即:
catch(DoesNotExist $e) {
? ? $this->data =newSessionData(['session_id'=> $id]);
? ? $this->data->session_data ="";
}