跟着阿誠安裝centos7,步驟及講解

centos7之lamp環境搭建

※.首先了解linux中主要的目錄

# bin : 執行文件

# home : 用戶目錄

# etc : 配置文件

# dev : 訪問外部設備的端口

CentOS 7.0默認使用的是firewall作爲防火牆

1、關閉firewall:

[python] view plain copy
  1. systemctl stop firewalld.service #停止firewall  
  2. systemctl disable firewalld.service #禁止firewall開機啓動  

2、關閉SELINUX

[python] view plain copy
  1. vi /etc/selinux/config  
  2. #SELINUX=enforcing #註釋掉  
  3. SELINUX=disabled #增加  
  4. :wq! #保存退出  
  5. setenforce 0 #使配置立即生效  
3.安裝apache

[python] view plain copy
  1. yum install httpd #根據提示,輸入Y安裝即可成功安裝  
  2. systemctl start httpd.service #啓動apache  
  3. systemctl stop httpd.service #停止apache  
  4. systemctl restart httpd.service #重啓apache  
  5. systemctl enable httpd.service #設置apache開機啓動  
4.安裝mariadb(mysql)

[python] view plain copy
  1. yum install mariadb mariadb-server #詢問是否要安裝,輸入Y即可自動安裝,直到安裝完成  
  2. systemctl start mariadb.service #啓動MariaDB  
  3. systemctl stop mariadb.service #停止MariaDB  
  4. systemctl restart mariadb.service #重啓MariaDB  
  5. systemctl enable mariadb.service #設置開機啓動  
[python] view plain copy
  1. 修改mysql密碼:set password for 'root'@'localhost'=password('root');  
[python] view plain copy
  1. mysql授權遠程連接(navicat等): grant all on *.* to root identified by 'root';  

5、安裝PHP以及組件,使PHP支持 MariaDB

[python] view plain copy
  1. yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash  
  2. #這裏選擇以上安裝包進行安裝,根據提示輸入Y回車  
  3. systemctl restart mariadb.service #重啓MariaDB  
  4. systemctl restart httpd.service #重啓apache  


好啦,centos7就這樣簡單的完成啦!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章