一、准备
一些常用的镜像开源站
yum:
阿里开源镜像源:http://mirrors.aliyun.com/centos
网易开源镜像站:http://mirrors.163.com/
Centos社区镜像站:http://mirror.centos.org/centos/
中科大开源镜像站:http://centos.ustc.edu.cn/
清华开源软件镜像站:https://mirrors.tuna.tsinghua.edu.cn/
epel
阿里开源镜像源:http://mirrors.aliyun.com/epel
二、nexus 先创建一个Blob Stores.
三、创建Repositories
- 创建yum(proxy) 配置yum-ali-proxy
点击设置 - -> Repositories – > Create repository --> yum(proxy)进入到以下界面。
配置阿里 :http://mirrors.aliyun.com/centos
- 创建yum(hosts)配置yum-host
点击设置 - -> Repositories – > Create repository --> yum(hosted)进入到以下界面。
是否允许 updates 根据情况选择 Allow redeploy
- 创建yum(proxy) 配置epel-ali-proxy
点击设置 - -> Repositories – > Create repository --> yum(proxy)进入到以下界面。
配置阿里 :http://mirrors.aliyun.com/epel
- 创建yum(group)
点击设置 - -> Repositories – > Create repository --> yum(group)进入到以下界面。
将 yum-hosts、yum-ali-proxy epel-ali-proxy 代理都附加进来
6、创建成功
复制代理连接http://ip:端口/repository/yum-group/ 备用
四、目标机器上配置yum源
登录到机器
以下针对的是centos的操作系统
进入/etc/yum.repos.d/ 备份好*.repo的文件
cp CentOS-Base.repo CentOS-Base.repo.bak
vi CentOS-Base.repo
修改 CentOS-Base.repo 按照 http://mirrors.aliyun.com/repo/Centos-7.repo
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://ip:端口/repository/yum-group/$releasever/os/$basearch/
http://ip:端口/repository/yum-group/$releasever/os/$basearch/
http://ip:端口/repository/yum-group/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://ip:端口/repository/yum-group/$releasever/updates/$basearch/
http://ip:端口/repository/yum-group/$releasever/updates/$basearch/
http://ip:端口/repository/yum-group/$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 - mirrors.aliyun.com
failovermethod=priority
baseurl=http://ip:端口/repository/yum-group/$releasever/extras/$basearch/
http://ip:端口/repository/yum-group/$releasever/extras/$basearch/
http://ip:端口/repository/yum-group/$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 - mirrors.aliyun.com
failovermethod=priority
baseurl=http://ip:端口/repository/yum-group/$releasever/centosplus/$basearch/
http://ip:端口/repository/yum-group/$releasever/centosplus/$basearch/
http://ip:端口/repository/yum-group/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://ip:端口/repository/yum-group/$releasever/contrib/$basearch/
http://ip:端口/repository/yum-group/$releasever/contrib/$basearch/
http://ip:端口/repository/yum-group/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
进入/etc/yum.repos.d/ 备份好*.repo的文件
cp epel.repo epel.repo.bak
vi epel.repo
修改 epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://ip:端口/repository/yum-group/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://ip:端口/repository/yum-group/7/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://ip:端口/repository/yum-group/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
清理缓存
$ yum clean all
$ yum makecache
成功