一、搭建測試環境
軟件環境:(PHP項目)
PHP5.4+Apache(httpd2.4)+mysql5.7
二、安裝
①掛載:
1.把iso的鏡像文件放到虛擬機linux的CD/ROM
(在右下角(網絡適配器/橋接模式)旁有個光盤,點擊連接,之后頁面出現一個光盤)
2.使用掛載命令,把CD/ROM設備里面的文件掛載到/mnt目錄: mount /dev/cdrom /mnt
(出現mounting read-only說明安裝成功)
3.進入/mnt/Packages目錄: (這里的P是大寫的)
cd /mnt/Packages
安裝Apache(http2.4)
①安裝apache的httpd的包(一般前面是版本號的才是所要安裝的安裝包,是英文的一般是依賴包)
如輸入:rpm -ivh httpd (按兩下Tab鍵)
看到:
httpd-2.4.6-67.el7.centos.x86_64.rpm (要下載的)
httpcomponents-core-4.2.4-6.el7.noarch.rpm(不是這個)
httpcomponents-client-4.2.5-5.el7_0.noarch.rpm (不是這個)
②輸入安裝:
rpm -ivh httpd-2.4.6-67.el7.centos.x86_64.rpm
發現需要四個依賴包(一般前面有lib的,后面才是包名,如:libaprutil(aprutil才是包名))
(一般看到不認識或者不知道的包百度一下)
1.安裝依賴包1:
rpm -ivh mailcap-2.1.41-2.el7.noarch.rpm
2.安裝依賴包2:
rpm -ivh apr-1.4.8-3.el7.x86_64.rpm
3.安裝依賴包3:
rpm -ivh apr-util-1.5.2-6.el7.x86_64.rpm
4.安裝依賴包4:
rpm -ivh httpd-tools-2.4.6-67.el7.centos.x86_64.rpm
5.再次安裝apache的httpd的包:
rpm -ivh httpd-2.4.6-67.el7.centos.x86_64.rpm
③啟動apache的服務:
systemctl start httpd.service
(apache默認的項目路徑是:/var/www/html)
④關閉防火牆:
Systemctl stop firewalld.service
⑤apache默認的端口號是:80 (在訪問時可省略)
⑥在網頁中輸入:http://192.168.1.167或192.168.1.167
安裝PHP5.4的包
①輸入安裝:rpm -ivh php-5.4.16-42.el7.x86_64.rpm
發現需要兩個依賴包
1.安裝依賴包1:
rpm -ivh php-common-5.4.16-42.el7.x86_64.rpm
發現要先安裝libzip包:
rpm -ivh libzip-0.10.1-8.el7.x86_64.rpm
再安裝依賴包1:
rpm -ivh php-common-5.4.16-42.el7.x86_64.rpm
2.安裝依賴包2:
rpm -ivh php-cli-5.4.16-42.el7.x86_64.rpm
②再安裝php5.4的包:
rpm -ivh php-5.4.16-42.el7.x86_64.rpm
安裝mysql(已裝,在前一章)
配置PHP的項目
①上傳testlink項目包到/var/www/html
②解壓並重命名(在/var/www/html路徑下)
解壓:unzip testlink1913.zip
重命名:mv testlink1913.zip testlink
③啟動apache、mysql的服務、關閉防火牆
- 啟動apache: systemctl start httpd.service
- mysql的服務: systemctl start mysqld.service
- 關閉防火牆: systemctl stop firewalld.service
④重啟apache: systemctl restart httpd.service
在瀏覽器中訪問項目:http://192.168.1.167:80/testlink
1.點擊New installation
2.勾住>點擊Continue
3.這幾處應是OK才成功
⑤錯誤處
處理錯誤處:
把testlink包的權限設置成777(在/var/www/html目錄下的testlink)
chmod -R 777 testlink
⑥錯誤處
處理錯誤處:
1.在/var目錄下新建testlink文件夾
mkdir testlink
2.並在testlink文件夾下新建logs和upload_area文件夾
mkdir logs upload_area
3.並給testlink文件夾賦予777權限
chmod -R 777 testlink
⑦禁用linux的安裝子系統selinux
1.輸入:vi /etc/sysconfig/selinux
把SELINUX=enforcing 改成SELINUX=disabled
2.重啟linux :reboot
重啟后再次啟動apache、mysql的服務、關閉防火牆
啟動apache: systemctl start httpd.service
mysql的服務: systemctl start mysqld.service
關閉防火牆: systemctl stop firewalld.service
⑧錯誤處
處理錯誤處:
1.重啟后要重新掛載:mount /dev/cdrom /mnt
2.進入/mnt/Packages目錄,查看: ll
3.安裝php-mysql的擴展包
rpm -ivh php-mysql-5.4.16-42.el7.x86_64.rpm
發現需要兩個依賴包
1.安裝依賴包1:(在/mnt/Packages目錄下):
rpm -ivh php-pdo-5.4.16-42.el7.x86_64.rpm
2.安裝依賴包2:(在/opt/soft目錄下):
rpm-ivh mysql-community-libs-compat-5.7.27-1.el7.x86_64.rpm
3.再安裝php-mysql擴展包:(要在/mnt/Packages目錄下)
⑨重啟apache和mysql的服務
1.重啟apache: systemctl restart httpd.service
2.重啟mysql的服務: systemctl restart mysqld.service
⑩錯誤處
處理錯誤處:
1.輸入后點擊Process Testlink Setup
(在第一處填虛擬機里的mysql用戶和密碼、在第二處填設置遠程連接的mysql用戶和密碼)
2.看到錯誤
3.解決
需要替換掉默認的兩個 .sql文件
(路徑:在/var/www/html/testlink/install/sql/mysql)
⑪刷新,繼續安裝
⑫輸入用戶名: admin
輸入密碼: admin
登錄成功