c4rt1y

yum安装Lamp环境

0x00.介绍

centos7搭建yum下的lamp安装环境。

0x01. 换源

#1.1.备份原始源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
#1.2.下载163的源
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo  -O /etc/yum.repos.d/CentOS-Base.repo
#1.3.更新
yum update -y

0x02. apache

#2.1.安装
yum -y install httpd
#2.2.开启apache服务
systemctl start httpd.service
#2.3.设置apache服务开机启动
systemctl enable httpd.service
#2.4.允许http和https访问
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
#2.5.访问测试
curl 127.0.0.1

0x03. PHP

#3.1.安装
yum -y install php
#3.2.重启apache服务
systemctl restart httpd.service
#3.3.编写php脚本
echo '<?php phpinfo(); ?>' > /var/www/html/info.php
#3.4.访问测试
curl 127.0.0.1/info.php

0x04.Mysql

#4.1.安装
yum -y install mariadb-server mariadb
#4.2.开启MySQL服务
systemctl start mariadb.service
#4.3.设置开机启动MySQL服务
systemctl enable mariadb.service
#4.4.设置root帐户的密码
mysql_secure_installation

#上述mariadb存在一定问题,找不到mysql_config文件,所以也如下方法:
#4.1.安装mysql源
rpm -ivh  http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
#4.2.安装mysql
yum install mysql-community-server mysql-devel -y
#4.3.启动mysql
service mysqld start

0x05.PHP模块

5.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 php-mysql php-devel
5.2.重启apache服务
systemctl restart httpd.service
GoTop