Nexus 下载:https://www.sonatype.com/download-oss-sonatype
文档:https://help.sonatype.com/repomanager3
运行环境(需要 Java 8):https://help.sonatype.com/repomanager3/installation/java-runtime-environment
CentOS 1905 配置 Nexus 3.17.0-01(Maven 私库)
- Nexus 安装配置参见:
CentOS 1905 配置 Nexus 3.17.0-01(Maven 私库)
- 新建 Yum 代理仓库,如图所示进行点击:
- 点击 yum (proxy):
- 填写相关配置:
http://mirrors.aliyun.com/centos/
- 新建 yum 公共仓库组:
- 下载 阿里云yum源配置文件:
http://mirrors.aliyun.com/repo/Centos-7.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 - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/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://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
- 修改 阿里云yum源 文件如下:
# 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 - mirrors.aliyun.com failovermethod=priority baseurl=http://192.168.8.129:8081/repository/yum-public/$releasever/os/$basearch/ gpgcheck=0 #released updates [updates] name=CentOS-$releasever - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://192.168.8.129:8081/repository/yum-public/$releasever/updates/$basearch/ gpgcheck=0 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://192.168.8.129:8081/repository/yum-public/$releasever/extras/$basearch/ gpgcheck=0 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://192.168.8.129:8081/repository/yum-public/$releasever/centosplus/$basearch/ gpgcheck=0 enabled=0 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://192.168.8.129:8081/repository/yum-public/$releasever/contrib/$basearch/ gpgcheck=0 enabled=0
- 备份原有yum源:
[root@192 ~]# cd /etc/yum.repos.d/ [root@192 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@192 yum.repos.d]# mkdir bak [root@192 yum.repos.d]# mv CentOS-* bak/ [root@192 yum.repos.d]# ls bak [root@192 yum.repos.d]#
- 新建 Nexus yum 源:
内容如上面第7步:[root@192 yum.repos.d]# vim CentOS-Base.repo
- 开启匿名访问:
- 清理缓存并重新生成缓存:
结果如下所示:yum clean all && yum makecache
[root@192 yum.repos.d]# yum clean all && yum makecache Loaded plugins: fastestmirror, langpacks Cleaning repos: base extras updates Cleaning up list of fastest mirrors Loaded plugins: fastestmirror, langpacks Determining fastest mirrors base | 1.8 kB 00:00:00 extras | 1.4 kB 00:00:00 updates | 1.5 kB 00:00:00 (1/10): base/7/x86_64/group_gz | 167 kB 00:00:00 (2/10): base/7/x86_64/primary | 2.9 MB 00:00:00 (3/10): base/7/x86_64/filelists | 7.6 MB 00:00:00 (4/10): base/7/x86_64/other | 1.6 MB 00:00:00 (5/10): extras/7/x86_64/filelists | 184 kB 00:00:00 (6/10): extras/7/x86_64/other | 76 kB 00:00:00 (7/10): extras/7/x86_64/primary | 78 kB 00:00:00 (8/10): updates/7/x86_64/filelists | 4.1 MB 00:00:00 (9/10): updates/7/x86_64/primary | 3.6 MB 00:00:00 (10/10): updates/7/x86_64/other | 310 kB 00:00:00 base 10097/10097 base 10097/10097 base 10097/10097 extras 307/307 extras 307/307 extras 307/307 updates 1063/1063 updates 1063/1063 updates 1063/1063 Metadata Cache Created [root@192 yum.repos.d]#
- 查看仓库,如图所示:
- 安装 gcc:
[root@192 yum.repos.d]# yum -y install gcc Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package gcc.x86_64 0:4.8.5-39.el7 will be installed --> Processing Dependency: cpp = 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64 --> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.5-39.el7.x86_64 --> Running transaction check ---> Package cpp.x86_64 0:4.8.5-39.el7 will be installed ---> Package glibc-devel.x86_64 0:2.17-292.el7 will be installed --> Processing Dependency: glibc-headers = 2.17-292.el7 for package: glibc-devel-2.17-292.el7.x86_64 --> Processing Dependency: glibc-headers for package: glibc-devel-2.17-292.el7.x86_64 --> Running transaction check ---> Package glibc-headers.x86_64 0:2.17-292.el7 will be installed --> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.17-292.el7.x86_64 --> Processing Dependency: kernel-headers for package: glibc-headers-2.17-292.el7.x86_64 --> Running transaction check ---> Package kernel-headers.x86_64 0:3.10.0-1062.9.1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================================================= Package Arch Version Repository Size ================================================================================================================================================================================= Installing: gcc x86_64 4.8.5-39.el7 base 16 M Installing for dependencies: cpp x86_64 4.8.5-39.el7 base 5.9 M glibc-devel x86_64 2.17-292.el7 base 1.1 M glibc-headers x86_64 2.17-292.el7 base 687 k kernel-headers x86_64 3.10.0-1062.9.1.el7 updates 8.7 M Transaction Summary ================================================================================================================================================================================= Install 1 Package (+4 Dependent packages) Total download size: 33 M Installed size: 59 M Downloading packages: (1/5): cpp-4.8.5-39.el7.x86_64.rpm | 5.9 MB 00:00:01 (2/5): glibc-devel-2.17-292.el7.x86_64.rpm | 1.1 MB 00:00:00 (3/5): glibc-headers-2.17-292.el7.x86_64.rpm | 687 kB 00:00:00 (4/5): gcc-4.8.5-39.el7.x86_64.rpm | 16 MB 00:00:02 (5/5): kernel-headers-3.10.0-1062.9.1.el7.x86_64.rpm | 8.7 MB 00:00:01 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 8.8 MB/s | 33 MB 00:00:03 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : cpp-4.8.5-39.el7.x86_64 1/5 Installing : kernel-headers-3.10.0-1062.9.1.el7.x86_64 2/5 Installing : glibc-headers-2.17-292.el7.x86_64 3/5 Installing : glibc-devel-2.17-292.el7.x86_64 4/5 Installing : gcc-4.8.5-39.el7.x86_64 5/5 Verifying : glibc-devel-2.17-292.el7.x86_64 1/5 Verifying : gcc-4.8.5-39.el7.x86_64 2/5 Verifying : kernel-headers-3.10.0-1062.9.1.el7.x86_64 3/5 Verifying : glibc-headers-2.17-292.el7.x86_64 4/5 Verifying : cpp-4.8.5-39.el7.x86_64 5/5 Installed: gcc.x86_64 0:4.8.5-39.el7 Dependency Installed: cpp.x86_64 0:4.8.5-39.el7 glibc-devel.x86_64 0:2.17-292.el7 glibc-headers.x86_64 0:2.17-292.el7 kernel-headers.x86_64 0:3.10.0-1062.9.1.el7 Complete! [root@192 yum.repos.d]#
- 查看版本库,如下所示: