nexus 是一個倉庫管理器,除了最經常使用建立maven倉庫的功能外,他還能夠搭建docker倉庫yum源倉庫npm pip ruby倉庫等等,今天咱們用這個建立一個yum源倉庫git
首先安裝nexus,我使用的是docker方式,首先clone下面這個項目github
git clone https://github.com/bboysoulcn/awesome-dockercompose.git
docker
以後進入nexus目錄,執行npm
docker-compose up -d
vim
nexus安裝完成centos
首先進入nexus 瀏覽器打開ip:8081瀏覽器
以後登錄,默認帳號密碼admin admin123緩存
接着點設置->repository->create repository->yum(proxy)寫入下面關鍵參數ruby
name: 隨便寫 remote storage: 我寫的是中科大軟件源,按照道理全部的軟件源同級目錄均可以https://mirrors.ustc.edu.cn/centos/bash
以後點保存便可
個人作法是吧原先的軟件源所有放入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