侧边栏壁纸
博主头像
fastjrun博主等级

前大厂工程师,长期从事 Java 开发,架构设计,容器化等相关工作,精通java,熟练使用maven、jenkins等devops相关工具链,擅长容器化方案规划、设计和落地。

  • 累计撰写 70 篇文章
  • 累计创建 47 个标签
  • 累计收到 1 条评论

目 录CONTENT

文章目录

Centos 7.8 离线安装nginx-1.20.1

fastjrun
2022-03-01 / 0 评论 / 0 点赞 / 1,044 阅读 / 1,158 字 / 正在检测是否收录...

安装离线安装nginx,先参考如下文章安装基本网络工具。

获取安装包及依赖

首先准备一个与目标系统相同的联网系统

安装必要依赖

yum install -y yum-utils

新增yum源ius

yum install -y https://repo.ius.io/ius-release-el7.rpm

经调研,安装ius源同时会安装epel源,epel有nginx的安装包,可用。

[root@localhost ~]# yum info nginx
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * epel: ftp.iij.ad.jp
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
可安装的软件包
名称    :nginx
架构    :x86_64
时期       :1
版本    :1.20.1
发布    :2.el7
大小    :586 k
源    :epel/x86_64
简介    : A high performance web server and reverse proxy server
网址    :https://nginx.org
协议    : BSD
描述    : Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
         : IMAP protocols, with a strong focus on high concurrency, performance and low
         : memory usage.

下载nginx安装包

yumdownloader --resolve nginx

打包依赖

tar czf nginx.offline.tar.gz *.rpm

此时在目录下生成一个文件,nginx.offline.ta.gz 就是离线安装nginx 所需的全部依赖和安装包

离线部署

将刚刚生成的nginx.offline.tar.gz 复制到离线部署的机器

安装nginx

tar -zxf nginx.offline.tar.gz 
rpm -ivh --replacefiles --replacepkgs *.rpm

启动nginx

访问之前需要关闭防火墙如下

[root@localhost opt]# systemctl start nginx

查看nginx启动服务情况

[root@localhost opt]# netstat -anpt|grep LISTEN|grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      53105/nginx: master 

启动nginx

访问之前需要关闭防火墙如下

[root@localhost opt]# systemctl stop firewalld

然后再用浏览器打开

0

评论区