在使用虚拟机virtualbox安装好centos7.6之后我们依次来安装nginx, PHP,mysql .
安装nginx,
yum claean all
yum install nginx 时会报错,因为centos7 需要依赖使用EPEL方式安装nginx,还有使用 命令:rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpml
来配置nginx依赖包,然后使用yum install nginx 安装: 可以看到nginx 版本是1.14.2
systemctl start nginx.service ,systemctl enable nginx.service 设置开机自启动。关闭防火墙 systemctl stop firewalld.service ,禁止开机启动防火墙 systemctl diable firewalld.service.
输入虚拟机ip可以看到nginx的界面代表nginx安装成功!第二部安装PHPyum -y install phpyum -y install php-fpm修改php.ini 里面的配置cgi.fix_pathinfo=1; 防范作用。 第三部:MySQL yum install mysql yum install mysql-devel报错 :Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock是、etc/my.cnf配置问题centos7 mysql数据支持需要mariable,或者官网下载mysql-server weget http://dev.mysql.com/get/mysql-coumunity-release-e17-5.noarch.rpm ,rpm -ivh mysql-cpmmunity-release-e17-5.noarch.rpm,yum insatll mysql-community-server依次输入命令即可。/etc/my.cnf 中添加 skip-grant-tables 进入然后 UPDATE mysql.user SET Password=PASSWORD(‘新密码‘) where USER=‘root‘;修改密码 flush privileges此时需要将虚拟机ip加入到 user表才可连接(https://www.cnblogs.com/lishanlei/p/9055344.html,https://blog.csdn.net/Love_XO/article/details/81502503)(参考即可)
原文地址:https://www.cnblogs.com/wangfenphph2/p/10263329.html
时间: 2024-10-09 23:43:24