Use nexus to build yum warehouse

Keywords: Linux CentOS RPM Docker nexus

Summary

nexus is a warehouse manager. In addition to the most commonly used function of creating maven warehouse, it can also build docker warehouse, yum source warehouse, npm pip ruby warehouse and so on. Today, we use this to create a Yum source warehouse

Install nexus

First, install nexus. I use the docker mode. First, the project under clone

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

Then enter the nexus directory and execute

docker-compose up -d

nexus installation complete

Build software source

First enter nexus browser and open ip:8081

After login, the default account password is admin admin123

Next, click Settings - > Repository - > create Repository - > Yum (proxy) to write the following key parameters

name: write casually
remote storage: I write the software source of University of science and technology of China. According to the principle, all the software sources can be listed in the same level directory https://mirrors.ustc.edu.cn/centos/

Click Save later

Set centos system software source

My approach is to put all the original software sources into the backup folder

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

Then create a file to write the following

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

The most important thing is to change the address in the baseurl. Mine and yours may be different. It depends on the situation

Then use

yum clean all

Clear all software source cache

yum makecache

Create a new software source cache

If it's OK, then your warehouse will be built successfully

Welcome to Bboysoul's blog www.bboysoul.com

Have Fun

Posted by btoles on Mon, 25 Nov 2019 14:02:03 -0800