您现在的位置是:首页 > 文章详情

使用nexus搭建yum仓库

日期:2019-04-21点击:759

概述

nexus 是一个仓库管理器,除了最常用创建maven仓库的功能外,他还可以搭建docker仓库yum源仓库npm pip ruby仓库等等,今天我们用这个创建一个yum源仓库

安装nexus

首先安装nexus,我使用的是docker方式,首先clone下面这个项目

git clone https://github.com/bboysoulcn/awesome-dockercompose.git

之后进入nexus目录,执行

docker-compose up -d

nexus安装完成

搭建软件源

首先进入nexus 浏览器打开ip:8081

之后登陆,默认账号密码admin admin123

接着点设置->repository->create repository->yum(proxy)写入下面关键参数

name: 随便写
remote storage: 我写的是中科大软件源,按照道理所有的软件源同级目录都可以https://mirrors.ustc.edu.cn/centos/

之后点保存即可

设置centos系统软件源

我的做法是吧原先的软件源全部放入backup文件夹

cd /etc/yum.repos.d
mkdir backup
mv ./*.repo backup

之后创建一个文件写入下面内容

vim CentOS-Base.repo

# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra baseurl=http://docker.bboysoul.com:8083/repository/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra baseurl=http://docker.bboysoul.com:8083/repository/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra baseurl=http://docker.bboysoul.com:8083/repository/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra baseurl=http://docker.bboysoul.com:8083/repository/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

最主要就是修改baseurl中的地址,我的和你的可能不一样,看情况修改

接着使用

yum clean all

清除所有软件源缓存

yum makecache

创建新的软件源缓存

如果没问题,那么你的仓库就搭建成功了

欢迎关注Bboysoul的博客www.bboysoul.com

Have Fun

原文链接:https://yq.aliyun.com/articles/699275
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章