nexus中怎么搭建一个yum仓库,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名注册、雅安服务器托管、营销软件、网站建设、东胜网站维护、网站推广。
1.创建一个本地的yum镜像存储空间(方便后续迁移到其他服务器)
2.创建yum仓库
3.下载依赖rpm包
[root@830bb90bd2b6 down]# ls
erlang-19.0.4-1.el7.centos.x86_64.rpm rabbitmq-server-3.6.6-1.el7.noarch.rpm wget-1.14-18.el7_6.1.x86_64.rpm
[root@830bb90bd2b6 down]# du -sh rabbitmq-server-3.6.6-1.el7.noarch.rpm
5.3M rabbitmq-server-3.6.6-1.el7.noarch.rpm
[root@830bb90bd2b6 down]# yum -y install rabbitmq-server-3.6.6-1.el7.noarch.rpm --downloadonly --downloaddir=/down
Loaded plugins: fastestmirror, ovl
Examining rabbitmq-server-3.6.6-1.el7.noarch.rpm: rabbitmq-server-3.6.6-1.el7.noarch
Marking rabbitmq-server-3.6.6-1.el7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package rabbitmq-server.noarch 0:3.6.6-1.el7 will be installed
--> Processing Dependency: logrotate for package: rabbitmq-server-3.6.6-1.el7.noarch
Loading mirror speeds from cached hostfile
--> Processing Dependency: socat for package: rabbitmq-server-3.6.6-1.el7.noarch
--> Running transaction check
---> Package logrotate.x86_64 0:3.8.6-17.el7 will be installed
---> Package socat.x86_64 0:1.7.3.2-2.el7 will be installed
--> Processing Dependency: libwrap.so.0()(64bit) for package: socat-1.7.3.2-2.el7.x86_64
--> Running transaction check
---> Package tcp_wrappers-libs.x86_64 0:7.6-77.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================== Package Arch Version Repository Size
========================================================================================================================Installing:
rabbitmq-server noarch 3.6.6-1.el7 /rabbitmq-server-3.6.6-1.el7.noarch 5.9 M
Installing for dependencies:
logrotate x86_64 3.8.6-17.el7 nexus 70 k
socat x86_64 1.7.3.2-2.el7 nexus 290 k
tcp_wrappers-libs x86_64 7.6-77.el7 nexus 66 k
Transaction Summary
========================================================================================================================Install 1 Package (+3 Dependent packages)
Total size: 6.3 M
Total download size: 426 k
Installed size: 7.2 M
Background downloading packages, then exiting:
(1/3): logrotate-3.8.6-17.el7.x86_64.rpm | 70 kB 00:00:01
(2/3): tcp_wrappers-libs-7.6-77.el7.x86_64.rpm | 66 kB 00:00:00
(3/3): socat-1.7.3.2-2.el7.x86_64.rpm | 290 kB 00:00:01
------------------------------------------------------------------------------------------------------------------------Total 260 kB/s | 426 kB 00:00:01
exiting because "Download Only" specified
[root@830bb90bd2b6 down]# ls
erlang-19.0.4-1.el7.centos.x86_64.rpm rabbitmq-server-3.6.6-1.el7.noarch.rpm tcp_wrappers-libs-7.6-77.el7.x86_64.rpm
logrotate-3.8.6-17.el7.x86_64.rpm socat-1.7.3.2-2.el7.x86_64.rpm wget-1.14-18.el7_6.1.x86_64.rpm
yum -y install rabbitmq-server-3.6.6-1.el7.noarch.rpm --downloadonly --downloaddir=/down
#下载rabbitmq-server-3.6.6-1.el7.noarch.rpm包的依赖包到/down目录下
4.编写批量上传脚本
[root@830bb90bd2b6 down]# ll
total 24508
-rw-r--r-- 1 root root 18580960 Aug 15 2016 erlang-19.0.4-1.el7.centos.x86_64.rpm
-rw-r--r-- 1 root root 71372 Nov 12 2018 logrotate-3.8.6-17.el7.x86_64.rpm
-rw-r--r-- 1 root root 46 Jul 21 09:53 lst.sh
-rw-r--r-- 1 root root 5487706 Nov 22 2016 rabbitmq-server-3.6.6-1.el7.noarch.rpm
-rw-r--r-- 1 root root 296632 Aug 10 2017 socat-1.7.3.2-2.el7.x86_64.rpm
-rw-r--r-- 1 root root 67868 Jul 4 2014 tcp_wrappers-libs-7.6-77.el7.x86_64.rpm
-rw-r--r-- 1 root root 560272 May 16 15:48 wget-1.14-18.el7_6.1.x86_64.rpm
[root@830bb90bd2b6 down]# find ./*.rpm
./erlang-19.0.4-1.el7.centos.x86_64.rpm
./logrotate-3.8.6-17.el7.x86_64.rpm
./rabbitmq-server-3.6.6-1.el7.noarch.rpm
./socat-1.7.3.2-2.el7.x86_64.rpm
./tcp_wrappers-libs-7.6-77.el7.x86_64.rpm
./wget-1.14-18.el7_6.1.x86_64.rpm
[root@830bb90bd2b6 down]# find ./*.rpm|awk -F "/" 'print{$2}'
awk: cmd. line:1: print{$2}
awk: cmd. line:1: ^ syntax error
[root@830bb90bd2b6 down]# find ./*.rpm|awk -F "/" '{print $2}'
erlang-19.0.4-1.el7.centos.x86_64.rpm
logrotate-3.8.6-17.el7.x86_64.rpm
rabbitmq-server-3.6.6-1.el7.noarch.rpm
socat-1.7.3.2-2.el7.x86_64.rpm
tcp_wrappers-libs-7.6-77.el7.x86_64.rpm
wget-1.14-18.el7_6.1.x86_64.rpm
[root@830bb90bd2b6 down]# clear
[root@830bb90bd2b6 down]# find ./*.rpm|awk -F "/" '{print $2}'
erlang-19.0.4-1.el7.centos.x86_64.rpm
logrotate-3.8.6-17.el7.x86_64.rpm
rabbitmq-server-3.6.6-1.el7.noarch.rpm
socat-1.7.3.2-2.el7.x86_64.rpm
tcp_wrappers-libs-7.6-77.el7.x86_64.rpm
wget-1.14-18.el7_6.1.x86_64.rpm
[root@830bb90bd2b6 down]# vi lst.sh
[root@830bb90bd2b6 down]# chmod +x lst.sh
[root@830bb90bd2b6 down]# ./lst.sh
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Date: Sun, 21 Jul 2019 10:24:05 GMT
< Server: Nexus/3.17.0-01 (OSS)
< X-Content-Type-Options: nosniff
< Content-Security-Policy: sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-top-navigation
< X-XSS-Protection: 1; mode=block
< Content-Length: 0
<
* Connection #0 to host 192.168.1.100 left intact
* About to connect() to 192.168.1.100 port 8089 (#0)
* Trying 192.168.1.100...
* Connected to 192.168.1.100 (192.168.1.100) port 8089 (#0)
* Server auth using Basic with user 'admin'
> PUT /repository/yum_local/libaio-0.3.109-13.el7.x86_64.rpm HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 192.168.1.100:8089
> Accept: */*
> Content-Length: 24744
> Expect: 100-continue
>
5.脚本内容
[root@830bb90bd2b6 down]# cat lst.sh
!#/bin/bash
file_rpm=`find ./*.rpm|awk -F "/" '{print $2}'`
for itm in ${file_rpm};do
curl -v --user 'admin:admin' --upload-file ./${itm} http://192.168.1.100:8089/repository/yum_local/${itm}
done
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。