centos7无网络下安装部署php7.1.33+mysql5.7.28+apache2.4.6

centos7无网络下安装部署php7.1.33+mysql5.7.28+apache2.4.6

一、

1、 先ping www.baidu.com,root账户下,如果未联网,创建目录,把提前下载好的rpm包拷贝到rpm目录下如图:(如果没有安装包请查看我的另一篇教程下载这些安装包)

mkdir /data/rpm -p

centos7无网络下安装部署php7.1.33+mysql5.7.28+apache2.4.6_第1张图片
3、 进入该目录

cd /data/rpm

5、 安装该目录下所有.rpm后缀的安装包

yum localinstall *.rpm -y

6、 安装完后开始启动服务
(1)安装好后将php-fpm设置为开机启动

systemctl enable php-fpm.service

(2)启动php 的服务

systemctl start php-fpm  #启动

下面是php启动关闭重启命令,这里执行启动:

systemctl start php-fpm  #启动
systemctl stop php-fpm  #关闭
systemctl restart php-fpm   #重启

(3)apache启动服务

systemctl start httpd.service

(4)apache开机自启

systemctl enable httpd.service

下面是apache的启动停止重启命令

# 启动apache
 systemctl start httpd.service
# 停止apache
 systemctl stop httpd.service 
# 重启apache
 systemctl restart httpd.service

(5)启动 MySQL 服务

systemctl start mysqld.service

(6) 开机启动 MySQL 服务

systemctl enable mysqld

7、 修改 MySQL 配置文件

vim /etc/my.cnf

进入如图界面后用i编辑,修改默认编码为 UTF-8,添加在 [mysqld] 后

character_set_server = utf8
init_connect = 'SET NAMES utf8'

然后按Esc推出并输入

:wq! 

保存退出。
如图:
centos7无网络下安装部署php7.1.33+mysql5.7.28+apache2.4.6_第2张图片
退出后如图:
centos7无网络下安装部署php7.1.33+mysql5.7.28+apache2.4.6_第3张图片
重新加载服务

systemctl daemon-reload

9、 搜索 MySQL 的 root 用户密码,systemctl start mysqld.service启动后会在 /var/log/mysqld.log 中给 root 生成密码,查看密码:

grep 'temporary password' /var/log/mysqld.log

查看密码后使用 root 用户登录

mysql -uroot -p

如图;
centos7无网络下安装部署php7.1.33+mysql5.7.28+apache2.4.6_第4张图片
10、 修改 MySQL 的 root 用户密码

set password for 'root'@'localhost' = password('新密码');

11、 注意使用mysql数据库,配置这一步

use mysql;

查看表

show tables;

修改表

update user set user.Host = '%' where user.User = 'root';

查看修改结果

select user.Host,user.User from user;

退出

quit;

12、 现在我们要查看一下防火墙的状态

systemctl list-unit-files|grep firewalld.service

13、 如果处于enabled状态,关闭防火墙:

systemctl stop firewalld.service

14、 禁止防火墙开机自启:

systemctl disable firewalld.service

15、 配置SELinux:

 vim /etc/selinux/config

i进行编辑,把找到SELINUX=enforcing将它改为

SELINUX=disabled

然后按Esc再按:再输入

:wq! 

保存退出,退出后一定执行

reboot

命令重启,否则会影响访问!
16、 我们还有最后一步,配置httpd.conf,先找到他的位置:

whereis httpd.conf

如图
在这里插入图片描述
这个/etc/httpd就是该文件存放的目录,我们进入该目录:

cd /etc/httpd

然后查看

ll

我们就能看到这个文件夹里的文件,如图:我们cd到conf这个文件夹

cd conf

centos7无网络下安装部署php7.1.33+mysql5.7.28+apache2.4.6_第5张图片
在这里插入图片描述
17、 最终到conf文件夹里编辑我们要编辑的httpd.conf文件ll
执行

vim httpd.conf

修改相应配置
关于httpd.conf我是直接用已经配置好的httpd.conf文件传输到该目录系下替换原来的配置
18、 修改完httpd.conf文件后记得重启该服务
在这里插入图片描述
19、 然后把php的源码压缩包放入,ll查看一下该目录的权限
centos7无网络下安装部署php7.1.33+mysql5.7.28+apache2.4.6_第6张图片
这里html目录的权限是root,我们把权限更改为apache权限

chown -R apache:apache html(项目文件夹名称)

在这里插入图片描述
20、 重启服务

systemctl restart httpd.service

21、 解压该目录的压缩包,注意解压后查看项目是否在html根目录下

tar -xvf 名称.tar

你可能感兴趣的:(Linux)