利用Nexus做Ubuntu私有源 1、创建独立存储 1.1、创建目录 登录进来后首先先创建一个独立的目录在服务器上用于存放apt相关的缓存
1 2 3 root @k8s-master01:~# mkdir /data/nexus/apt -proot @k8s-master01:~# ll /data/nexus/drwxr -xr-x 4 root root 4096 Oct 3 19 :58 apt
1.2、设置路径 所用到的目录创建好后在Nexus控制台上配置出目录名称 配置目录
1.3、配置代理仓库 Hosted:本地仓库,通常我们会部署自己的构件到这一类型的仓库,比如公司的第三方库 Proxy:代理仓库,它们被用来代理远程的公共仓库,如maven 中央仓库(官方仓库)。 Group:仓库组,用来合并多个hosted/proxy仓库,当你的项目希望在多个repository使用资源时就不需要多次引用了,只需要引用一个group即可。 选择apt-proxy模式 配置相关参数 完成设置
1.4、验证 配置完后找一台ubuntu的机器来修改apt源的走向
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 root@k8s -master-12 :~ root@k8s -master-12 :/etc/apt deb http: //repo.huaweicloud.com/ubuntu focal main restricted deb http: //repo.huaweicloud.com/ubuntu focal-updates main restricted ... root@k8s -master-12 :/etc/apt root@k8s -master-12 :/etc/apt deb http: //172.20.21.11:8081/repository /ubuntu-focal/ focal main restricted deb http: //172.20.21.11:8081/repository /ubuntu-focal/ focal-updates main restricted ...
修改好源后使用apt update更新下源
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 root@k8s-master-12 :/etc/ apt Get:1 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal InRelease [265 kB] Get:2 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates InRelease [128 kB] Get:3 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-backports InRelease [128 kB] Get:4 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-security InRelease [128 kB] Get:5 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/main amd64 Packages [970 kB] Get:6 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/main Translation-en [506 kB] Get:7 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/main amd64 c-n-f Metadata [29.5 kB] Get:8 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/restricted amd64 Packages [22.0 kB] Get:9 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/restricted Translation-en [6 ,212 B] Get:10 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/restricted amd64 c-n-f Metadata [392 B] Get:11 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/universe amd64 Packages [8 ,628 kB] Get:12 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/universe Translation-en [5 ,124 kB] Get:13 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/universe amd64 c-n-f Metadata [265 kB] Get:14 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/multiverse amd64 Packages [144 kB] Get:15 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/multiverse Translation-en [104 kB] Get:16 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/multiverse amd64 c-n-f Metadata [9 ,136 B] Get:17 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 Packages [3 ,605 kB] Get:18 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main Translation-en [555 kB] Get:19 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 c-n-f Metadata [17.8 kB] Get:20 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/restricted amd64 Packages [3 ,287 kB] Get:21 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/restricted Translation-en [461 kB] Fetched 34.7 MB in 22 s (1 ,594 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done281 packages can be upgraded. Run 'apt list --upgradable' to see them.
安装nginx服务看信息是不是走的咱们配置的地址源安装的
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 root@k8s-master-12 :/etc/ apt Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libtiff5 libwebp6 libxpm4 nginx-common nginx-core Suggested packages: libgd-tools fcgiwrap nginx-doc ssl-cert The following NEW packages will be installed: fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libtiff5 libwebp6 libxpm4 nginx nginx-common nginx-core0 upgraded, 17 newly installed, 0 to remove and 281 not upgraded. Need to get 2 ,437 kB of archives. After this operation, 7 ,925 kB of additional disk space will be used. Get:1 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/main amd64 fonts-dejavu-core all 2.37 -1 [1 ,041 kB] Get:2 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/main amd64 fontconfig-config all 2.13 .1 -2 ubuntu3 [28.8 kB] Get:3 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/main amd64 libfontconfig1 amd64 2.13 .1 -2 ubuntu3 [114 kB] Get:4 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 libjpeg-turbo8 amd64 2.0 .3 -0 ubuntu1.20.04 .3 [118 kB] Get:5 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal/main amd64 libjpeg8 amd64 8 c-2 ubuntu8 [2 ,194 B] Get:6 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 libjbig0 amd64 2.1 -3.1 ubuntu0.20.04 .1 [27.3 kB] Get:7 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 libwebp6 amd64 0.6 .1 -2 ubuntu0.20.04 .3 [185 kB] Get:8 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 libtiff5 amd64 4.1 .0 +git191117-2 ubuntu0.20.04 .14 [164 kB] Get:9 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 libxpm4 amd64 1 :3.5 .12 -1 ubuntu0.20.04 .2 [34.9 kB] Get:10 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 libgd3 amd64 2.2 .5 -5.2 ubuntu2.1 [118 kB] Get:11 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 nginx-common all 1.18 .0 -0 ubuntu1.6 [37.7 kB] Get:12 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 libnginx-mod-http-image-filter amd64 1.18 .0 -0 ubuntu1.6 [14.8 kB] Get:13 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 libnginx-mod-http-xslt-filter amd64 1.18 .0 -0 ubuntu1.6 [13.0 kB] Get:14 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 libnginx-mod-mail amd64 1.18 .0 -0 ubuntu1.6 [42.8 kB] Get:15 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 libnginx-mod-stream amd64 1.18 .0 -0 ubuntu1.6 [67.2 kB] Get:16 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 nginx-core amd64 1.18 .0 -0 ubuntu1.6 [425 kB] Get:17 http:// 172.20 .21.11 :8081 /repository/u buntu-focal focal-updates/main amd64 nginx all 1.18 .0 -0 ubuntu1.6 [3 ,616 B] Fetched 2 ,437 kB in 3 s (930 kB/s) Preconfiguring packages ... ........ Preparing to unpack .../09 -libgd3_2.2.5 -5.2 ubuntu2.1 _amd64.deb ... Unpacking libgd3:amd64 (2.2 .5 -5.2 ubuntu2.1 ) ... Selecting previously unselected package nginx-common. Preparing to unpack .../10 -nginx-common_1.18.0 -0 ubuntu1.6 _all.deb ... Setting up nginx-core (1.18 .0 -0 ubuntu1.6 ) ... Setting up nginx (1.18 .0 -0 ubuntu1.6 ) ... Processing triggers for ufw (0.36 -6 ) ... Processing triggers for systemd (245.4 -4 ubuntu3.4 ) ... Processing triggers for man-db (2.9 .1 -1 ) ... Processing triggers for libc-bin (2.31 -0 ubuntu9.2 ) ... root@k8s-master-12 :/etc/ apt
至此在Nexus下配置Ubuntu私有源结束。Nexus还可以配置其他的源。其他的就不一一去验证了。