First, preparatory work
1. Download and install centos7.2, configure the network environment to ensure that CentOS can access the Internet, you can get to Yum source.
centos7.2 Download Address: http://pan.baidu.com/s/1eRTjats Password: Wnby
centos7.2 Network configuration:
vim/etc/sysconfig/network-scripts/ifcfg-eno16777736
Refer to the following network configuration:
Type=ethernet
bootproto=static
defroute=yes
peerdns=yes
peerroutes=yes
ipv4_failure_fatal= No
ipv6init=yes
ipv6_autoconf=yes
ipv6_defroute=yes
ipv6_peerdns=yes
ipv6_peerroutes= Yes
ipv6_failure_fatal=no
name=eno16777736
uuid=a90b6241-89da-450a-9742-d5b186a17084
device=eno16777736
onboot=yes
ipaddr0=192.168.0.228
prefixo0=24
gateway0=192.168.0.1
dns1=192.168.0.1
Once configured, use Systemctl restart Network.service to restart the network and ping www.baidu.com to test for smooth network connectivity.
2. Configure the firewall, open 80, 3306 ports. CentOS 7.0 uses firewall as a firewall by default, and this is iptables firewall instead.
#停止firewall服务
systemctl Stop firewalld.service
#禁止firewall开机启动
systemctl Disable Firewalld.service
#安装
yum install iptables-services
#编辑防火墙配置文件
vi/etc/sysconfig/iptables
Add red two lines of code, please note that the position must correspond.
# Firewall configuration written by System-config-firewall
# Manual Customization to this file is not recommended.
*filter
: INPUT ACCEPT [0:0]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [0:0]
-A input-m State--state Establi Shed,related-j ACCEPT
-a input-p icmp-j ACCEPT-a
input-i lo-j ACCEPT
-a input-m state--state new-m TC P-p TCP--dport 22-j ACCEPT
-a input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
-a input-m state --state new-m tcp-p tcp--dport 3306-j ACCEPT
-a input-j REJECT---reject-with icmp-host-prohibited
-a Forwa Rd-j REJECT--reject-with icmp-host-prohibited
COMMIT
: wq! #保存退出
#最后重启防火墙使配置生效
systemctl Restart Iptables.service
#设置防火墙开机启动
systemctl enable Iptables.service
3. Close Seinux
#修改配置文件
vi/etc/selinux/config
#SELINUX =enforcing #注释掉
#SELINUXTYPE =targeted #注释掉
selinux= Disabled #增加
: wq! #保存退出
#使配置立即生效
setenforce 0
Second, the installation of lamp environment.
1. Install Apahce
May be used:
Systemctl start Httpd.service #启动apache
systemctl stop httpd.service #停止apache
systemctl Restart Httpd.service #重启apache
systemctl Enable Httpd.service #设置apache开机启动
Restart Service, Systemctl restart Httpd.service
Input localhost
After the appearance of the Representative has been installed up.
2. Install MySQL.
Because there is no mysql-server on the Yum source. Therefore must go to the official website to download, here we use the wget command, obtains directly.
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# RPM-IVH mysql-community-release-el7-5.noarch.rpm
# yum Install Mysql-community-server
Restart MySQL after Setup completes, Systemctl Restarat Mysqld.service
Initial install root user does not have password:
[Root@yl-web yl]# mysql-u root
#设置msyql密码为 123456
mysql> Set password for ' root ' @ ' localhost ' =password (' 123456 ');
#远程连接设置, all remote users connected with the root account are provided with their password 123456
mysql> grant all privileges on *.* to root@ '% ' identified by ' 123456 ';
#更新权限
Mysql>flush privileges;
3. Install PHP
Yum install PHP
#安装PHP组件 to enable PHP to support MySQL yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear to Php-xml
PHP -xmlrpc php-mbstring php-bcmath php-mhash
#重启对应服务
systemctl restart Mysqld.service systemctl Restart
Httpd.service
The above installation apahce, MySQL, PHP installation completed.
To view the installation Environment version: cd/var/www/html, new index.php file, enter:
Final view as: PHP version:
Reference Link: http://www.centoscn.com/CentosServer/www/2016/0331/6964.html
The above is a small set to introduce the centos7.2 system on the Yum installation lamp environment, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!