centos7.x部署php7.0、mysql

1.安装httpd

yum install httpd
systemctl start httpd.service #启动命令

systemctl stop httpd.service #停止命令

systemctl restart httpd.service #重启命令

systemctl enable httpd.service #开机自启动

2.安装mysql

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
systemctl start mysqld.service #启动命令

systemctl stop mysqld.service #停止命令

systemctl restart mysqld.service #重启命令

systemctl enable mysqld.service #开机自启动命令

 

设置密码(默认是没密码)

mysql -u root 
#设置密码
set password for 'root'@'localhost' =password('123456');
#远程连接设置,所有以root账号连接的远程用户,设其密码为 123456
grant all privileges on *.* to root@'%'identified by '123456';
#更新权限
flush privileges;

3.安装php7.0

安装epel-release

yum -y install epel-release

安装php7.0源

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

成功获取php7.0源之后

yum install php70w

然后安装一些依赖、扩展(这些很重要的,不安装有的程序跑不动)

yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-redis php70w-pecl-memcached php70w-devel

然后就好了...的样子~输入命令行看PHP版本咯

php -v

 

你可能感兴趣的:(centos7.x部署php7.0、mysql)