最近在測試一些應用軟體時,由於有應用到PHP,此時才發現,現階段的CentOS 7,PHP只能更新到5.3 版,該軟體已經不支援,故找了 一下資料,順手把此安裝過程筆記一下,以便未來使用時,可以查閱一下。
現行系統及安裝步驟紀錄如下:
1. 作業系統: CentOS 7.6 (1810) 64 bit
2. 安裝Apache
#yum -y install httpd httpd-devel –> 利用YUM安裝Apache,會自動將需要的軟體一併安裝
#systemctl start httpd.service –> 啟動Apache
#systemctl enable httpd.service –> 開機時啟動Apache
3. 安裝Mariadb
#yum -y install mariadb mariadb-server mariadb-devel
#systemctl start mariadb.service –> 啟動MariaDB
#systemctl enable mariadb.service — 設定開機時啟動MariaDB
設定MariaDB root 密碼
#mysql -u root
MariaDB[none]>use mysql;
MariaDB[mysql]>update user set password=PASSWORD(“new password”) where User=’root’;
MariaDB[mysql]flush privileges;
MariaDB[mysql]>quit
4. 安裝PHP 7.3
#yum -y install epel-release –> 安裝EPEL 擴充套件庫
#yum -y install yum-utils –> 安裝管理YUM套件庫功能
#rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm –> 安裝remi 擴充套件庫
#yum-config-manager –enable remi-php73 –> 啟動remi 為YUM 安裝PHP使用的套件庫
#yum install php php-mcrypt php-cli php-gd php-curl php-mysqlnd php-ldap php-zip php-fileinfo –> 安裝php及相關模組
5. 檢視PHP
#php -v
以上即完成Apache, MariaDB 及 PHP 安裝。