安装离线安装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
然后再用浏览器打开
评论区