网站首页 > 技术教程 正文
公司场景需求:离线服务器上安装一个nginx服务
系统版本:CentOS 7.6
方法一:
使用tar包,二进制安装 略
方法二:
rpm方式
安装rpm包时,应该大家都遇到过缺少依赖包的问题,一个一个安装依赖文件,让人头疼。
这里给大家介绍一种很方便的安装方法
使用yumdownloader命令离线安装 nginx rpm服务包
1.首先找一个可以连接外网的服务器
可以ping通百度域名,确定可以上外网
[root@243-ceshi /]# ping www.baidu.com
PING www.baidu.com
icmp_seq=1 ttl=53 time=23.5 ms
icmp_seq=2 ttl=53 time=22.8 ms
icmp_seq=3 ttl=53 time=27.3 ms
123456
2.安装插件
[root@localhost ~]# yum install yum-utils
3.创建一个存放rpm包的目录
[root@localhost ~]# mkdir /rpm
4.下载nginx rpm相关文件
[root@localhost rpm]# yumdownloader --resolve --destdir=/rpm nginx
5.查看rpm目录下的文件
[root@243-ceshi rpm]# ls
centos-indexhtml-7-9.el7.centos.noarch.rpm nginx-mod-http-image-filter-1.16.1-3.el7.x86_64.rpm
gd-2.0.35-27.el7_9.x86_64.rpm nginx-mod-http-perl-1.16.1-3.el7.x86_64.rpm
gperftools-libs-2.6.1-1.el7.x86_64.rpm nginx-mod-http-xslt-filter-1.16.1-3.el7.x86_64.rpm
libXpm-3.5.12-1.el7.x86_64.rpm nginx-mod-mail-1.16.1-3.el7.x86_64.rpm
nginx-1.16.1-3.el7.x86_64.rpm nginx-mod-stream-1.16.1-3.el7.x86_64.rpm
nginx-all-modules-1.16.1-3.el7.noarch.rpm openssl11-libs-1.1.1g-2.el7.x86_64.rpm
nginx-filesystem-1.16.1-3.el7.noarch.rpm
12345678
nginx最新版本的相关依赖文件全在都rpm目录下了
6.把rpm目录下文件移到内网服务器的/rpm目录下
[root@243-ceshi /]# scp -r /rpm root@192.168.1.168:/rpm
root@192.168.1.168's password:
centos-indexhtml-7-9.el7.centos.noarch.rpm 100% 92KB 19.7MB/s 00:00
gd-2.0.35-27.el7_9.x86_64.rpm 100% 146KB 22.7MB/s 00:00
gperftools-libs-2.6.1-1.el7.x86_64.rpm 100% 272KB 26.2MB/s 00:00
libXpm-3.5.12-1.el7.x86_64.rpm 100% 55KB 17.6MB/s 00:00
nginx-1.16.1-3.el7.x86_64.rpm 100% 563KB 31.4MB/s 00:00
nginx-all-modules-1.16.1-3.el7.noarch.rpm 100% 20KB 8.2MB/s 00:00
nginx-filesystem-1.16.1-3.el7.noarch.rpm 100% 21KB 9.0MB/s 00:00
nginx-mod-http-image-filter-1.16.1-3.el7.x86_64.rpm 100% 30KB 12.0MB/s 00:00
nginx-mod-http-perl-1.16.1-3.el7.x86_64.rpm 100% 39KB 14.3MB/s 00:00
nginx-mod-http-xslt-filter-1.16.1-3.el7.x86_64.rpm 100% 29KB 11.9MB/s 00:00
nginx-mod-mail-1.16.1-3.el7.x86_64.rpm 100% 57KB 16.6MB/s 00:00
nginx-mod-stream-1.16.1-3.el7.x86_64.rpm 100% 85KB 18.1MB/s 00:00
openssl11-libs-1.1.1g-2.el7.x86_64.rpm 100% 1485KB 40.6MB/s 00:00
123456789101112131415
7.进入离线服务器安装
[root@localhost /]# cd /rpm
[root@localhost rpm]# rpm -ivh * --nodeps --force
警告:nginx-1.16.1-3.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:openssl11-libs-1:1.1.1g-2.el7 ################################# [ 8%]
2:nginx-filesystem-1:1.16.1-3.el7 ################################# [ 15%]
3:libXpm-3.5.12-1.el7 ################################# [ 23%]
4:gd-2.0.35-27.el7_9 ################################# [ 31%]
5:gperftools-libs-2.6.1-1.el7 ################################# [ 38%]
6:centos-indexhtml-7-9.el7.centos ################################# [ 46%]
7:nginx-mod-http-image-filter-1:1.1################################# [ 54%]
8:nginx-mod-http-perl-1:1.16.1-3.el################################# [ 62%]
9:nginx-mod-http-xslt-filter-1:1.16################################# [ 69%]
10:nginx-mod-mail-1:1.16.1-3.el7 ################################# [ 77%]
11:nginx-all-modules-1:1.16.1-3.el7 ################################# [ 85%]
12:nginx-1:1.16.1-3.el7 ################################# [ 92%]
13:nginx-mod-stream-1:1.16.1-3.el7 ################################# [100%]
12345678910111213141516171819
8.启动nginx服务
[root@localhost rpm]# systemctl start nginx
[root@localhost rpm]# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since 四 2021-01-21 15:24:46 CST; 5s ago
Process: 127308 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 127303 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 127300 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 127318 (nginx)
Tasks: 7
Memory: 7.8M
CGroup: /system.slice/nginx.service
├─127318 nginx: master process /usr/sbin/nginx
├─127319 nginx: worker process
├─127320 nginx: worker process
├─127322 nginx: worker process
├─127323 nginx: worker process
├─127324 nginx: worker process
└─127325 nginx: worker process
1月 21 15:24:46 vrgv systemd[1]: Starting The nginx HTTP and reverse proxy server...
1月 21 15:24:46 vrgv nginx[127303]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
1月 21 15:24:46 vrgv nginx[127303]: nginx: configuration file /etc/nginx/nginx.conf test is successful
1月 21 15:24:46 vrgv systemd[1]: Started The nginx HTTP and reverse proxy server.
完成
如果有帮助,点个关注吧,还有更多运维技巧分享给您~
猜你喜欢
- 2024-10-12 详解定制rpm包一键部署过程(rpm制作安装包)
- 2024-10-12 linux之yum下载rpm包离线安装(linux离线安装yum 源)
- 2024-10-12 你不知道的rpm别样用法(rpm格式是什么意思)
- 2024-10-12 CentOS下如何制作nginx RPM包(linux nginx rpm安装)
- 2024-09-22 CentOS 7.X 上 安装Nginx+php环境
- 2024-09-22 Linux centos 安装nginx(linux中nginx安装)
- 2024-09-22 19《Nginx 入门教程》Nginx综合实践
- 2024-09-22 linux下安装nginx(linux安装nginx详细教程)
- 2024-09-22 CentOS7 yum 安装 Nginx最新版本(centos7配置阿里云yum源)
- 2024-09-22 nginx配置使jsp页面转向tomcat处理
你 发表评论:
欢迎- 最近发表
-
- Win10 TH2正式版官方ESD映像转换ISO镜像方法详解
- 使用iso镜像升级到Windows 10的步骤
- macOS Ventura 13.2 (22D49) Boot ISO 原版可引导镜像
- 安利一个用ISO镜像文件制作引导U盘的的小工具RUFUS
- CentOS 7使用ISO镜像配置本地yum源
- 用于x86平台的安卓9.0 ISO镜像发布下载:通吃I/A/N、完全免费
- AlmaLinux 9.6发布:升级工具、初步支持IBM Power虚拟化技术
- Rufus写入工具简洁介绍与教程(写入模式)
- 新硬件也能安装使用了,Edge版Linux Mint 21.3镜像发布
- 开源工程师:Ubuntu应该抛弃32位ISO镜像
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)