nexus创建内网apt yum epel pypi

服务端配置

安装jdk1.8.0_161

tail -10 /etc/profile
JAVA_HOME=/usr/local/java/jdk1.8.0_161
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH

useradd nexus,用于安装启动nexus-3.26.1-02-unix.tar.gz

cd /home/nexus/nexus-3.26.1-02/bin && ./nexus start
./nexus status
nexus is running.

访问 http://ip:8081,admin初始密码在/home/nexus/sonatype-work/nexus3
nexus创建内网apt yum epel pypi_第1张图片创建仓库:选择相应apt、yum、pypi等类型,host为离线储存模式,proxy为在线代理模式,group为组模式,用于整合仓库资源
nexus创建内网apt yum epel pypi_第2张图片

创建yum源:
https://mirrors.tuna.tsinghua.edu.cn/centos/
创建apt源:
https://mirrors.tuna.tsinghua.edu.cn/ubuntu/
#bionic,focal抓取ubuntu18.04、ubuntu20.04
创建epel源:
http://mirrors.aliyun.com/epel
创建centos6 yum源:
http://mirrors.aliyun.com/centos-vault/6.10

客户端配置

Centos

cat /etc/yum.repos.d/CentOS-Base.repo

[base]
name=base
baseurl=http://ip:8081/repository/tsinghua-yum/$releasever/os/$basearch/
enabled=1
gpgcheck=0

[updates]
name=updates
baseurl=http://ip:8081/repository/tsinghua-yum/$releasever/updates/$basearch/
enabled=1
gpgcheck=0

[extras]
name=extras
baseurl=http://ip:8081/repository/tsinghua-yum/$releasever/extras/$basearch/
enabled=1
gpgcheck=0

[plus]
name=plus
baseurl=http://ip:8081/repository/tsinghua-yum/$releasever/centosplus/$basearch/
enabled=1
gpgcheck=0

Ubuntu

cat /etc/apt/sources.list

deb http://ip:8081/repository/tsinghua-ubuntu/ bionic main restricted universe multiverse
deb http://ip:8081/repository/tsinghua-ubuntu/ bionic-updates main restricted universe multiverse
deb http://ip:8081/repository/tsinghua-ubuntu/ bionic-backports main restricted universe multiverse
deb http://ip:8081/repository/tsinghua-ubuntu/ bionic-security main restricted universe multiverse
pypi

cat /root/.pip/pip.conf

[global]
index-url = http://ip:8081/repository/tsinghua-pypi/simple/
trusted-host = ip
epel

cat /etc/yum.repos.d/CentOS-Base.repo

[epel]
name=epel
baseurl=http://ip:8081/repository/ali-epel/7/$basearch
enabled=1
gpgcheck=0

[epel-debuginfo]
name=epel-debuginfo
baseurl=http://ip:8081/repository/ali-epel/7/$basearch/debug
enabled=0
gpgcheck=0

[epel-source]
name=epel-source
baseurl=http://ip:8081/repository/ali-epel/7/SRPMS
enabled=0
gpgcheck=0
centos6

cat /etc/yum.repos.d/CentOS-Base.repo

[base]
name=Base
failovermethod=priority
baseurl=http://172.29.8.103:8081/repository/vault-yum/os/$basearch/
gpgcheck=0

[updates]
name=Updates
failovermethod=priority
baseurl=http://172.29.8.103:8081/repository/vault-yum/updates/$basearch/
gpgcheck=0
 
 
[extras]
name=Extras
failovermethod=priority
baseurl=http://172.29.8.103:8081/repository/vault-yum/extras/$basearch/
gpgcheck=0

[centosplus]
name=Plus
failovermethod=priority
baseurl=http://172.29.8.103:8081/repository/vault-yum/centosplus/$basearch/
gpgcheck=0
enabled=0
  
[contrib]
name= Contrib
failovermethod=priority
baseurl=http://172.29.8.103:8081/repository/vault-yum/contrib/$basearch/
gpgcheck=0
enabled=0

开机自启动

vi /etc/rc.d/init.d/nexusstart.sh

#!/bin/bash
#chkconfig: 2345 90 10
#description: auto start nexus when system on
su - nexus -c "sh /home/nexus/nexus-3.26.1-02/bin/nexus start"

chkconfig --add nexusstart.sh

你可能感兴趣的:(yum,apt)