<六>企业级开源仓库nexus3实战应用–使用nexus3配置yum私有仓库
直到偶然一个契机,在网上看到一篇介绍nexus3.x的文章,文章写得也比较清晰,我也有兴致细读下去,就这样,开启了我的nexus3私服之旅。
开始我以为这个只是针对maven私服而存在的工具,后来才发现它所支持的,竟然将运维日常所面临的各种私服都包括了,这就极大的引发了我的钻研兴致,从maven私服的研究开始,一发不可收拾的,就又写出了一个nexus3系列教程,涵盖了安装,配置,maven私服,maven私服从2.x到3.x的迁移,docker私服,npm私服,yum私服,纵观全网络,大概也找不到一个人如此这般的,倾尽所有的,知无不言的,言无不尽的将nexus3作为一个系列写成文章的了。而现在,如果再有人与我说起私服的事情,至少我不会跑了,或许更想停下来了,,,哈哈。这就是付出学习所给人带来的心境上的转化!
前言啰嗦几句,愿您在这个小系列中,学习愉快!
想要查看本系列其他文章:请点此处跳转。
希望正在读这段话的你能够在这个小系列中获得自信以及喜悦!
yum相较于rpm,能够更好地解决安装软件时的依赖包问题,使用yum安装更简单更方便。搭建本地YUM源服务器,可以避免升级安装软件时占用公网带宽;有了本地YUM源服务器,可以解决无法连接Internet的其他YUM客户端的软件升级和安装。
与其他私服一样的,yum私服同样有三种类型:
hosted: 本地存储,即同 yum 官方仓库一样提供本地私服功能proxy: 提供代理其他仓库的类型,如我们常用的163仓库group: 组类型,实质作用是组合多个仓库为一个地址,相当于一个透明代理。
那么就来一个一个创建。
1,创建blob存储。
为其创建一个单独的存储空间,命名为yum-hub。

2,创建hosted类型的yum库。
后来才发现,其实每次创建的这个hosted类型的,并没有什么用。不过照例创建一波吧。
Name::定义一个名称local-yumStorage:Blob store,我们下拉选择前面创建好的专用blob:yum-hub。Hosted:开发环境,我们运行重复发布,因此Delpoyment policy 我们选择Allow redeploy。这个很重要!
整体配置截图如下:

3,创建一个proxy类型的yum仓库。
Name: proxy-163-yumProxy:Remote Storage: 远程仓库地址,这里填写: http://mirrors.163.com/centos/Storage: yum-hub
其他的均是默认。
这里就先创建一个代理163的仓库,其实还可以多创建几个,诸如阿里云的,搜狐的,等等,这个根据个人需求来定义。
整体配置截图如下:

4,创建一个group类型的yum仓库。
Name:group-yumStorage:选择专用的blob存储yum-hub。group: 将左边可选的2个仓库,添加到右边的members下。
整体配置截图如下:

这些配置完成之后,就可以使用了。
5,构建缓存。
新建一台环境干净的主机,此时需要保证这台主机能够上网,因为私服当中还没有进行初始化。
先简单配置一下,将yum源指向到私服中来。
1,将原有的移走。
- [root@7-3 ~]$cd /etc/yum.repos.d/
- [root@7-3 yum.repos.d]$ls
- CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo
- [root@7-3 yum.repos.d]$mkdir bak
- [root@7-3 yum.repos.d]$mv * bak
- mv: cannot move ‘bak’ to a subdirectory of itself, ‘bak/bak’
- [root@7-3 yum.repos.d]$ls
- bak
2,创建一个新的源。
- [root@7-3 yum.repos.d]$vim nexus.repo
添加如下内容:
其中的url就是私服当中创建的group的对外地址,后面的$releasever/os/$basearch/不要漏掉了。
- [nexus]
- name=Nexus Repository
- baseurl=http://192.168.106.65:8081/repository/group-yum/$releasever/os/$basearch/
- enabled=1
- gpgcheck=0
因此,这里还应该将163的源配置添加进来。
完整内容应该如下:
- [root@7-3 yum.repos.d]$cat nexus.repo
- [nexus]
- name=Nexus Repository
- baseurl=http://192.168.106.65:8081/repository/group-yum/$releasever/os/$basearch/
- enabled=1
- gpgcheck=0
- #released updates
- [updates]
- name=CentOS-$releasever-Updates-163.com
- #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
- baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
- #additional packages that may be useful
- [extras]
- name=CentOS-$releasever-Extras-163.com
- #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
- baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
- gpgcheck=1
- gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
- #additional packages that extend functionality of existing packages
- [centosplus]
- name=CentOS-$releasever-Plus-163.com
- baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
- gpgcheck=1
- enabled=0
- gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
3,构建缓存。
现在,就可以通过makecache将远程的包拉到内部私服当中了。
操作之前,就像古代变戏法一般的,依旧先去私服看一眼group-yum当中是否有包存在,这是一个固定流程哈。

可以看到空空如也,那么通过如下三步操作创建缓存。
- [root@7-3 yum.repos.d]$yum clean all
- Loaded plugins: fastestmirror
- Cleaning repos: extras nexus updates
- Cleaning up everything
- Cleaning up list of fastest mirrors
- [root@7-3 yum.repos.d]$yum makecache
- Loaded plugins: fastestmirror
- extras | 3.4 kB 00:00:00
- nexus | 1.8 kB 00:00:00
- updates | 3.4 kB 00:00:00
- (1/12): extras/7/x86_64/prestodelta | 100 kB 00:00:00
- (2/12): extras/7/x86_64/primary_db | 204 kB 00:00:00
- (3/12): extras/7/x86_64/other_db | 126 kB 00:00:00
- (4/12): extras/7/x86_64/filelists_db | 604 kB 00:00:00
- (5/12): nexus/7/x86_64/group_gz | 167 kB 00:00:00
- (6/12): nexus/7/x86_64/primary | 2.9 MB 00:00:00
- (7/12): nexus/7/x86_64/other | 1.6 MB 00:00:00
- (8/12): nexus/7/x86_64/filelists | 7.1 MB 00:00:00
- (9/12): updates/7/x86_64/prestodelta | 679 kB 00:00:00
- (10/12): updates/7/x86_64/filelists_db | 3.4 MB 00:00:00
- (11/12): updates/7/x86_64/other_db | 578 kB 00:00:00
- (12/12): updates/7/x86_64/primary_db | 6.0 MB 00:00:01
- Determining fastest mirrors
- nexus 9911/9911
- nexus 9911/9911
- nexus 9911/9911
- Metadata Cache Created
- [root@7-3 yum.repos.d]$yum update -y #这个过程比较长,内容比较多,不完全复制了。
当上边的第三步执行完成之后,此时我们可以回到刚刚那个空白的页面,看看内容是否上来了。

就是这么神奇。
6,验证一下效果。
验证的方式其实也很简单,找一台不能上网但是可以与刚刚私服通信的主机,将其yum源指向的配置好的私服,看看安装软件什么的是否可以so easy。
或者是将其他的源都切断,然后yum源仅仅指向私服,看看安装是否顺利。
这里采用第二种方式简单试验一下。
1,将原有的移走。
- [root@7-2 ~]$cd /etc/yum.repos.d/
- [root@7-2 yum.repos.d]$ls
- CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo
- [root@7-2 yum.repos.d]$mkdir bak
- [root@7-2 yum.repos.d]$mv * bak
- mv: cannot move ‘bak’ to a subdirectory of itself, ‘bak/bak’
- [root@7-2 yum.repos.d]$ls
- bak
此时尝试一下安装。
- [root@7-2 yum.repos.d]$yum -y install httpd
- Loaded plugins: fastestmirror
- Determining fastest mirrors
- There are no enabled repos.
- Run "yum repolist all" to see the repos you have.
- To enable Red Hat Subscription Management repositories:
- subscription-manager repos --enable <repo>
- To enable custom repositories:
- yum-config-manager --enable <repo>
2,创建一个新的源。
- [root@7-2 yum.repos.d]$cat nexus.repo
- [nexus]
- name=Nexus Repository
- baseurl=http://192.168.106.65:8081/repository/group-yum/$releasever/os/$basearch/
- enabled=1
- gpgcheck=0
再尝试安装:
- [root@7-2 yum.repos.d]$yum -y install httpd
- Loaded plugins: fastestmirror
- nexus | 1.8 kB 00:00:00
- (1/2): nexus/7/x86_64/group_gz | 167 kB 00:00:00
- (2/2): nexus/7/x86_64/primary | 2.9 MB 00:00:00
- Loading mirror speeds from cached hostfile
- nexus 9911/9911
- Resolving Dependencies
- --> Running transaction check
- ---> Package httpd.x86_64 0:2.4.6-80.el7.centos will be installed
- --> Processing Dependency: httpd-tools = 2.4.6-80.el7.centos for package: httpd-2.4.6-80.el7.centos.x86_64
- --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-80.el7.centos.x86_64
- --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-80.el7.centos.x86_64
- --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-80.el7.centos.x86_64
- --> Running transaction check
- ---> Package apr.x86_64 0:1.4.8-3.el7_4.1 will be installed
- ---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
- ---> Package httpd-tools.x86_64 0:2.4.6-80.el7.centos will be installed
- ---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
- --> Finished Dependency Resolution
- Dependencies Resolved
- ==========================================================================================================================================================================================
- Package Arch Version Repository Size
- ==========================================================================================================================================================================================
- Installing:
- httpd x86_64 2.4.6-80.el7.centos nexus 2.7 M
- Installing for dependencies:
- apr x86_64 1.4.8-3.el7_4.1 nexus 103 k
- apr-util x86_64 1.5.2-6.el7 nexus 92 k
- httpd-tools x86_64 2.4.6-80.el7.centos nexus 89 k
- mailcap noarch 2.1.41-2.el7 nexus 31 k
- Transaction Summary
- ==========================================================================================================================================================================================
- Install 1 Package (+4 Dependent packages)
- Total download size: 3.0 M
- Installed size: 10 M
- Downloading packages:
- (1/5): apr-1.4.8-3.el7_4.1.x86_64.rpm | 103 kB 00:00:00
- (2/5): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00:00
- (3/5): httpd-tools-2.4.6-80.el7.centos.x86_64.rpm | 89 kB 00:00:00
- (4/5): mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:00
- (5/5): httpd-2.4.6-80.el7.centos.x86_64.rpm | 2.7 MB 00:00:03
- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Total 880 kB/s | 3.0 MB 00:00:03
- Running transaction check
- Running transaction test
- Transaction test succeeded
- Running transaction
- Installing : apr-1.4.8-3.el7_4.1.x86_64 1/5
- Installing : apr-util-1.5.2-6.el7.x86_64 2/5
- Installing : httpd-tools-2.4.6-80.el7.centos.x86_64 3/5
- Installing : mailcap-2.1.41-2.el7.noarch 4/5
- Installing : httpd-2.4.6-80.el7.centos.x86_64 5/5
- Verifying : httpd-tools-2.4.6-80.el7.centos.x86_64 1/5
- Verifying : apr-1.4.8-3.el7_4.1.x86_64 2/5
- Verifying : mailcap-2.1.41-2.el7.noarch 3/5
- Verifying : httpd-2.4.6-80.el7.centos.x86_64 4/5
- Verifying : apr-util-1.5.2-6.el7.x86_64 5/5
- Installed:
- httpd.x86_64 0:2.4.6-80.el7.centos
- Dependency Installed:
- apr.x86_64 0:1.4.8-3.el7_4.1 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-80.el7.centos mailcap.noarch 0:2.1.41-2.el7
- Complete!
就是这个feel,爽爽爽。
到此地,关于nexus3所支持的私服类型,基本上生产中常用的,都一一介绍过了,到目前为止,我也没有在网上看到过任何一个写,针对nexus写一个系列的教程并分享出来的,啥也不说了,乡亲们呐,我心情激动,我骄傲!
<六>企业级开源仓库nexus3实战应用–使用nexus3配置yum私有仓库的更多相关文章
- 6.使用nexus3配置yum私有仓库
yum相较于rpm,能够更好地解决安装软件时的依赖包问题,使用yum安装更简单更方便.搭建本地YUM源服务器,可以避免升级安装软件时占用公网带宽:有了本地YUM源服务器,可以解决无法连接Interne ...
- 实战maven私有仓库三部曲之三:Docker下搭建maven私有仓库
本章是<实战maven私有仓库>系列的第三篇,在前两章中,我们先在linux搭建maven私有仓库,然后在开发环境使用此仓库,本章我们在docker下快速搭建maven私有仓库,然后像前面 ...
- 使用Nexus配置Maven私有仓库
使用Nexus配置Maven私有仓库 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.安装配置Nexus 1>.下载nexus 下载地址:https://www.sonat ...
- 系统基础优化( 创建yum私有仓库最详细操作及解释 )
目录 系统基础优化 一.Linux中安装软件的方式 安装方式 三种安装方式的区别 二.RPM安装☆ 1.安装及其他命令 2.手动下载软件包,可将其拖入shell中自动传入 1).手动网页下载软件包 2 ...
- 软件包管理-yum私有仓库
Linux软件安装 包的依赖关系: 软件包之间可能存在依赖关系,甚至循环依赖,即:A包依赖B包,B包依赖C包,C包依赖A包 安装软件包时,会因为缺少依赖的包,而导致安装包失败. 解决依赖包管理工具: ...
- Linux学习Day5:Vim编辑器、配置网卡、配置Yum软件仓库
今天首先学习Vim编辑器的使用,通过它可以对Linux系统的文件进行编写和修改.在Linux系统中一切都是文件,所以熟练掌握Vim编辑器的使用十分重要.最后通过配置主机网卡的实验,来加深Vim编辑器中 ...
- 8、Linux基础--rpm、yum、yum私有仓库、系统优化
笔记 1.晨考 1.文件的三种时间属性,每一种时间属性在什么情况下改变 atime : 访问时间 mtime :修改时间 ctime :修改属性时间 2.权限的类型 可读(r, 4) 可写(w, 2) ...
- <二>企业级开源仓库nexus3实战应用–使用nexus3配置docker私有仓库
1,安装nexus3. 这个地方略了,安装部署可以参考:nexus3安装配置. 2,配置走起. 1,创建blob存储. 登陆之后,先创建一个用于存储镜像的空间. 定义一个name,下边的内容会自动补全 ...
- <五>企业级开源仓库nexus3实战应用–使用nexus3配置npm私有仓库
一两个星期之前,你如果在我跟前说起私服的事情,我大概会绕着你走,因为我对这个东西真的一窍不通.事实上也正如此,开发同学曾不止一次的跟我说公司的私服版本太旧了,许多新的依赖编译之后不会从远程仓库自动缓存 ...
随机推荐
- MongoDB在已有账号的实例下还原数据库报错的分析(error applying oplog)
一. 背景 今天在MongoDB 4.0.4版本下,在还原恢复数据库时报错. 主要错误为: Failed: restore error: error applying oplog: applyOps: ...
- 从0开始的Python学习004小的总结与补充
没有时间?快速阅读: Python确实是一种十分精彩又强大的语言. Python是程序.脚本或者软件 python helloworld.py运行你的Python help()帮助你的Python 命 ...
- Web开发人员学习路线图
http://www.runoob.com/w3cnote/2018-web-developer.html
- iOS 防止离屏渲染为 image 添加圆角
// image 分类 - (UIImage *)circleImage{ // NO 代表透明 UIGraphicsBeginImageContextWithOptions(self.siz ...
- Windows server2008R2 企业内部搭建虚拟专用网络服务
VPN英文全称是“Virtual Private Network”,就是“虚拟专用网络”.可以远程帮助用户.分公司.商业伙伴及供应商同公司的内部网建立可信的安全连接,用于经济有效地连接到商业伙伴和用户 ...
- python_库学习_02_微信自动回复机器人
一.python发展的趋势日益庞大,微信也有对应的库itchat.这次的实例做做成可在任意电脑运行的微信自动回复机器人exe.文件. 二.完成这个小应用我们需要装一些库,, itchat:这个东东不出 ...
- (转载)最完整的自动化测试流程:Python编写执行测试用例及定时自动发送最新测试报告邮件
今天笔者就要归纳总结下一整套测试流程,从无到有,实现零突破,包括如何编写测试用例,定时执行测试用例,查找最新生成的测试报告文件,自动发送最新测试报告邮件,一整套完整的测试流程.以后各位只要着重如何编写 ...
- css_属性
老师的博客:https://www.cnblogs.com/liwenzhou/p/7999532.htm css的属性 整体属性的:作用于全局 width:表示宽 height:表示长 color: ...
- Ambari——大数据平台的搭建利器之进阶篇
前言 本文适合已经初步了解 Ambari 的读者.对 Ambari 的基础知识,以及 Ambari 的安装步骤还不清楚的读者,可以先阅读基础篇文章<Ambari——大数据平台的搭建利器>. ...
- ERROR in static/js/0.5d7325513eec31f1e291.js from UglifyJs
今天把vue项目打包是遇到这个问题.这是在服务器上打包时报的错误,本地打包不报错!很头疼!上网查了很多,发现有很多人和我遇到类似的问题,但是都没有解决我的问题!后来灵机一动,解决问题,这就跟大家说一下 ...