1. 程式人生 > >CenOS下搭建LAMP建站環境

CenOS下搭建LAMP建站環境

安裝CentOS虛擬機器

在這裡插入圖片描述

安裝Apache

1、輸入yum-y install httpd安裝(使用root許可權) 在這裡插入圖片描述

2、開啟apache服務(執行systemctl start httpd.service命令) 3、設定開機啟動(執行 systemctl enable httpd.service命令) 4、在本機瀏覽器輸入虛擬機器ip地址(輸入ip addr 檢視),訪問不成功開啟防火牆 firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload 5、再次訪問,出現Testing 123… 安裝成功

安裝php

1、安裝(輸入yum -y install php) 2、重啟apache服務(輸入systemctl restart httpd) 3、驗證是否安裝成功(在apache的網站目錄建立test.php並訪問 <?php phpinfo(); ?>,出現php版本資訊,則安裝成功

安裝MYSQL

1、安裝(輸入yum install mariadb*) 2、開啟服務(輸入systemctl start mariadb.service) 3、設定開機啟動服務(輸入systemctl enable mariadb.service) 4、設定root帳戶的密碼(輸入myspl -secure-installation) 5、測試root密碼設定成功(輸入myspl-uroot-p)

關聯PHP和Mysql

輸入yum -y install php-mysql命令

安裝常用的php模組

1、安裝 yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel 2、輸入 systemctl restart httpd.service重啟apache服務 至此LAMP環境搭建成功

安裝wordpress

1、下載WordPress。解壓到安裝目錄 2、在瀏覽器輸入localhost或127.0.0.1.點選開始安裝,輸入資料庫名,使用者名稱,密碼 在這裡插入圖片描述

安裝成功!!!