【Linux】Centos6.9簡單搭建LAMP
關閉centos6.9防火牆
開啟centos6.9命令列輸入
service iptables stop
setenforce 0
安裝環境
1、 安裝vim命令列
yum install vim
2、安裝apache web伺服器軟體
yum install httpd
3、安裝資料庫mysql
yum install mysql mysql-server
4、安裝php網站開發語言
yum install php
5、安裝php模組
yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt
配置mysql
1、啟動mysql
service mysqld start
2、檢視電腦當前監聽的埠(3306:mysql埠 22:ssh連線 80:httpd)
netstat -antlo
3、配置
mysql_secure_installation
出現以下程式碼(初次執行直接回車)
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we’ll need the current
password for the root user. If you’ve just installed MySQL, 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):
出現以下程式碼(是否設定root使用者密碼,輸入y並回車或直接回車)
Set root password? [Y/n]
出現以下程式碼(設定root使用者的密碼)
New password:
出現以下程式碼(再輸入一次密碼)
Re-enter new password:
出現以下程式碼(成功)
Password updated successfully!
Reloading privilege tables..
… Success!
配置apache
vim /etc/httpd/conf/httpd.conf
這裡查詢DocumentRoot監聽的埠,設定“高亮”更方便查詢(監聽80埠)
grep -r -n “DocumentRoot” * –color
啟動httpd
service httpd start
重啟網路
service network restart
重啟服務
systemctl restart httpd.service