搭建网络仓库-----nginx

如果客户端需要通过共享的仓库安装nginx软件? 怎么办?

1.服务端需要提供zabbix软件相关的仓库 10.0.0.200

[root@oldboy ~]# mkdir  /var/ftp/nginx
[root@oldboy ~]# cd  /var/ftp/nginx

2.获取zabbix的软件包

[root@oldboy nginx]# curl http://mirrors.ustc.edu.cn/nginx/rhel/7/x86_64/RPMS/

[root@oldboy nginx]# curl http://mirrors.ustc.edu.cn/nginx/rhel/7/x86_64/RPMS/>3.txt

[root@oldboy nginx]# grep '4.txt

[root@oldboy nginx]# grep '4.txt

root@oldboy nginx]# chmod +x 4.txt
[root@oldboy nginx]# ./4.txt
--2019-08-18 19:20:21--  http://mirrors.ustc.edu.cn/nginx/rhel/7/x86_64/
Resolving mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)... 202.141.176.110, 2001:da8:d800:95::110
Connecting to mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)|202.141.176.110|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

    [ <=>                                                  ] 399         --.-K/s   in 0s      

2019-08-18 19:20:21 (19.2 MB/s) - ‘index.html’ saved [399]

--2019-08-18 19:20:21--  http://mirrors.ustc.edu.cn/nginx/rhel/7/x86_64/RPMS/nginx-1.10.0-1.el7.ngx.x86_64.rpm
Resolving mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)... 202.141.176.110, 2001:da8:d800:95::110
Connecting to mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)|202.141.176.110|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 655648 (640K) [application/x-redhat-package-manager]
Saving to: ‘nginx-1.10.0-1.el7.ngx.x86_64.rpm’

100%[=====================================================>] 655,648      781KB/s   in 0.8s   

[root@oldboy nginx]# createrepo /var/ftp/nginx/
Spawning worker 0 with 90 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@oldboy nginx]# systemctl start vsftpd        启动vsftpd
[root@oldboy nginx]# systemctl stop firewalld     关闭防火墙
[root@oldboy nginx]# setenforce 0                 关闭防火墙
[root@oldboy nginx]# ls

将zabbix目录生成为一个yum仓库

[root@oldboy ~]# createrepo /var/ftp/zabbix/

3.客户端新建一个repo文件指向服务端提供的zabbix仓库10.0.0.199

[root@kelongyi ~]# vim /etc/yum.repos.d/ftp-nginx.repo
[root@kelongyi ~]# cat /etc/yum.repos.d/ftp-nginx.repo
[ftp-nginx]
name = ftp share nginx repo
baseurl = ftp://10.0.0.200/nginx/
enable = 1
gpgcheck = 0

4.客户端测试zabbix仓库是否可用

[root@kelongyi ~]# yun install nginx-module-xslt
-bash: yun: command not found
[root@kelongyi ~]# yum install nginx-module-xslt
Loaded plugins: fastestmirror
Determining fastest mirrors
Zabbix                                                     | 2.9 kB  00:00:00     
ftp-centos7                                                | 2.9 kB  00:00:00     
ftp-nginx                                                  | 2.9 kB  00:00:00     
ftp-nginx/primary_db                                       |  31 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package nginx-module-xslt.x86_64 1:1.12.2-1.el7_4.ngx will be installed
--> Processing Dependency: nginx = 1:1.12.2-1.el7_4.ngx for package: 1:nginx-module-xslt-1.12.2-1.el7_4.ngx.x86_64
--> Running transaction check
---> Package nginx.x86_64 1:1.12.2-1.el7_4.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================
 Package               Arch       Version                     Repository     Size
==================================================================================
Installing:
 nginx-module-xslt     x86_64     1:1.12.2-1.el7_4.ngx        ftp-nginx      17 k
Installing for dependencies:
 nginx                 x86_64     1:1.12.2-1.el7_4.ngx        ftp-nginx     716 k

Transaction Summary
==================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 733 k
Installed size: 2.6 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): nginx-1.12.2-1.el7_4.ngx.x86_64.rpm                 | 716 kB  00:00:00     
(2/2): nginx-module-xslt-1.12.2-1.el7_4.ngx.x86_64.rpm     |  17 kB  00:00:00     
----------------------------------------------------------------------------------
Total                                                1.4 MB/s | 733 kB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:nginx-1.12.2-1.el7_4.ngx.x86_64                              1/2 
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* http://nginx.org/en/docs/

Please subscribe to nginx-announce mailing list to get
the most important news about nginx:
* http://nginx.org/en/support.html

Commercial subscriptions for nginx are available on:
* http://nginx.com/products/

----------------------------------------------------------------------
  Installing : 1:nginx-module-xslt-1.12.2-1.el7_4.ngx.x86_64                  2/2 
----------------------------------------------------------------------

The xslt dynamic module for nginx has been installed.
To enable this module, add the following to /etc/nginx/nginx.conf
and reload nginx:

    load_module modules/ngx_http_xslt_filter_module.so;

Please refer to the module documentation for further details:
http://nginx.org/en/docs/http/ngx_http_xslt_module.html

----------------------------------------------------------------------
  Verifying  : 1:nginx-module-xslt-1.12.2-1.el7_4.ngx.x86_64                  1/2 
  Verifying  : 1:nginx-1.12.2-1.el7_4.ngx.x86_64                              2/2 

Installed:
  nginx-module-xslt.x86_64 1:1.12.2-1.el7_4.ngx                                   

Dependency Installed:
  nginx.x86_64 1:1.12.2-1.el7_4.ngx                                               

Complete!
[root@kelongyi ~]# 

此源来自于中科大源,非常好用,建议使用。

科大源:http://mirrors.ustc.edu.cn/

你可能感兴趣的:(搭建网络仓库-----nginx)