您好,登錄后才能下訂單哦!
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
看完上述內容是否對您有幫助呢?如果還想對相關知識有進一步的了解或閱讀更多相關文章,請關注億速云行業資訊頻道,感謝您對億速云的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。