Centos 7 搭建PHP7+Apache2.0+MYSQL

安装Apache
Apache在默认的CentOS仓库中可用,安装非常简单。
打开终端(Terminal):yum install httpd。以root用户权限运行命令:sudo yum install httpd
查看Apache的版本号:sudo httpd -v
运行Apache服务:sudo systemctl start httpd
关闭Apache服务:sudo systemctl stop httpd
运行Apache服务,在浏览器输入localhost出现以下画面则表示安装成功:


屏幕快照 2018-10-08 11.44.50.png

安装PHP
安装epel-release :sudo yum -y install epel-release
接着输入命令:sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
完成后可输入:sudo yum install php70w 安装PHP7
查看版本号:php -v

屏幕快照 2018-10-08 12.06.07.png

安装MySQL
下载并安装MySQL官方的 Yum Repository:sudo wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum安装MySQL:sudo yum -y install mysql57-community-release-el7-10.noarch.rpm
安装MySQL服务:sudo yum -y install mysql-community-server
启动MySQL服务:sudo systemctl start mysqld.service
查看MySQL的默认密码:sudo grep "password" /var/log/mysqld.log
登陆MySQL:mysql -uroot -p
修改MySQL的密码:ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

你可能感兴趣的:(Centos 7 搭建PHP7+Apache2.0+MYSQL)