centos7之lamp環境搭建
※.首先了解linux中主要的目錄
# bin : 執行文件
# home : 用戶目錄
# etc : 配置文件
# dev : 訪問外部設備的端口
CentOS 7.0默認使用的是firewall作爲防火牆
1、關閉firewall:
- systemctl stop firewalld.service #停止firewall
- systemctl disable firewalld.service #禁止firewall開機啓動
2、關閉SELINUX
- vi /etc/selinux/config
- #SELINUX=enforcing #註釋掉
- SELINUX=disabled #增加
- :wq! #保存退出
- setenforce 0 #使配置立即生效
- yum install httpd #根據提示,輸入Y安裝即可成功安裝
- systemctl start httpd.service #啓動apache
- systemctl stop httpd.service #停止apache
- systemctl restart httpd.service #重啓apache
- systemctl enable httpd.service #設置apache開機啓動
- yum install mariadb mariadb-server #詢問是否要安裝,輸入Y即可自動安裝,直到安裝完成
- systemctl start mariadb.service #啓動MariaDB
- systemctl stop mariadb.service #停止MariaDB
- systemctl restart mariadb.service #重啓MariaDB
- systemctl enable mariadb.service #設置開機啓動
- 修改mysql密碼:set password for 'root'@'localhost'=password('root');
- mysql授權遠程連接(navicat等): grant all on *.* to root identified by 'root';
5、安裝PHP以及組件,使PHP支持 MariaDB
- yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
- #這裏選擇以上安裝包進行安裝,根據提示輸入Y回車
- systemctl restart mariadb.service #重啓MariaDB
- systemctl restart httpd.service #重啓apache
好啦,centos7就這樣簡單的完成啦!