一.centos换源
http://mirrors.aliyun.com/help/centos?spm=5176.bbsr150321.0.0.d6ykiD
1、备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3、之后运行yum makecache生成缓存
更新
yum update
二.安装php7
1.查看CentOS版本号
cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core)
2.需要先安装epel-release(第3步的前提)
yum -y install epel-release
3.rpm安装php7相应的yum源 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
4.安装php7
[[email protected] etc]# yum install php70w php70w-fpm php70w-mysql
5.查看php版本
php -v
三.安装nginx
1.yum源
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2. 安装nginx
yum install nginx
3. 启动nginx
service nginx start
成功显示:Redirecting to /bin/systemctl start nginx.service
四.安装mysql操作
注:甲骨文有可能将mysql进行收费,所以CentOS 7 版本将MySQL数据库软件从默认的程序列表中移除,用免费的mariadb代替了,用法和以前完全一样
1.安装
yum install mariadb-server -y 2.启动
systemctl start mariadb.service 3.设置开机启动
systemctl enable mariadb.service
4.设置mysql root密码
mysql_secure_installation