This is the 12th day of my participation in Gwen Challenge

Introduction to Nexus

In a production environment, not all servers are allowed to access the public network. Ideally, several servers function as access proxies and cache servers simultaneously. If the required package is available on the server, obtain it from the Intranet. If not, obtain it from the Internet and save it locally.

A common way to set up a private YUM source is for Createrepo to generate a local repository that other servers access via HTTP. The downside of this approach is that the installation will fail if the required package is not currently available in the repository, and the data will not be fetched from another source.

Nexus is a powerful warehouse manager that greatly simplifies the maintenance of its own internal warehouses and access to external warehouses.

Nexus 3. X Deployment (On Linux)

2.1 download the source code package

https://help.sonatype.com/repomanager3/download
Copy the code

2.2, decompression

$tar ZXF nexus- 3.23.0-03-UNIx.tar. gz $mv nexus-3.23.0-03 sonatype-work /data $echo 'NEXUS_HOME = "/ data/nexus - 3.23.0-03"' > > ~ /. Bashrc $echo 'run_as_user = "root" > > / data/nexus - 3.23.0-03 / bin/nexus. RcCopy the code

2.3. Service Configuration

$ vim /etc/systemd/system/nexus.service

[Unit]
Description=nexus service
After=network.target

[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/data/nexus-3.23.0-03/bin/nexus start
ExecStop=/data/nexus-3.23.0-03/bin/nexus stop
User=root
Restart=on-abort

[Install]
WantedBy=multi-user.target
Copy the code

2.4. Start the service

$systemctl start nexus # Please wait for netstat -tunlp to check port 8081 and continueCopy the code

2.5. Log into the Nexus

http://IP:8081/
Copy the code

View password

$ cat /data/sonatype-work/nexus3/admin.password
Copy the code

Nexus configuration proxy warehouse

3.1, yum!

Create a repository

https://mirrors.tuna.tsinghua.edu.cn/centos/
Copy the code

After the Repository is created, the Repository status is online-ready to connect

2. Configure the Yum file on the client

$ vim /etc/yun.repos.d/CentOS-Base.rpeo
[Anchnet-Base]
name=Anchnet Mirrors
baseurl=http://mirrors.anchnet.com/repository/centos/$releasever/os/$basearch/
enabled=1
gpgcheck=0
Copy the code

3, installation test

Clean and rebuild the YUM cache

[root@k8s-master ~]# yum clean all && yum makecache Loaded plugins: fastestmirror Cleaning repos: Anchnet - Base Cleaning up everything the Loaded plugins: fastestmirror Anchnet - Base | 2.2 kB 00:00:00 (1/4) : Anchnet - Base/seven/x86_64 / group_gz | 153 kB 00:00:00 (2/4) : Anchnet - Base/seven/x86_64 / primary | 2.9 MB 00:00:03 (3/4) : Anchnet - Base/seven/x86_64 / other | 1.6 MB 00:00:02 (4/4) : Anchnet - Base/seven/x86_64 / filelists | 7.1 MB 00:00:11 Determining fastest mirrors Anchnet - 10070/10070 Anchnet Base - Base 10070/10070 Anchnet-Base 10070/10070 Metadata Cache CreatedCopy the code

Install HTTPD package tests

$ yum install httpd -y
Copy the code

3.2, MySQL,

Create a repository

http://repo.mysql.com/yum/mysql-8.0-community/el/
Copy the code

After the Repository is created, the Repository status is online-ready to connect

2. Configure the Yum file on the client

$ vim /etc/yun.repos.d/mysql-8.rpeo [MySQL8] name=Mysql for RHEL/CentOS $releasever - $basearch baseurl=http://mirrors.anchnet.com/repository/MySQL8.0/$releasever/$basearch/ enabled = 1 gpgcheck = 0Copy the code

3, installation test

$yum install -y mysql-community-client-8.0.11 mysql-community-server-8.0.11Copy the code

3.3, NPM

Create a repository

https://registry.npm.taobao.org/
Copy the code

After the Repository is created, the Repository status is online-ready to connect

2. Set the NPM address on the client

$ npm config set registry http://mirrors.anchnet.com/repository/npm/
Copy the code

3, installation test

$ npm i eslint
Copy the code

3.4, pypi

Create a repository

https://mirrors.aliyun.com/pypi
Copy the code

After the Repository is created, the Repository status is online-ready to connect

2. Configure the pip.conf file on the client

$ vim .pip/pip.conf
[global]
trusted-host = mirrors.anchnet.com
index-url = http://mirrors.anchnet.com/repository/pypi/simple/
Copy the code

3, installation test

$ pip install django [root@k8s-master ~]# pip3 install django Collecting django Downloading http://mirrors.anchnet.com/repository/pypi/packages/django/3.1.1/Django-3.1.1-py3-none-any.whl (7.8 MB) 100% | █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ | 7.8 MB 1.4 MB/s Requirement already satisfied: Pytz in/usr/local/lib/python3.6 / site - packages (from the django) Requirement already satisfied: Asgiref ~ = 3.2.10 in/usr/local/lib/python3.6 / site - packages (from the django) Requirement already satisfied: Sqlparse > = 0.2.2 in/usr/local/lib/python3.6 / site - packages (from the django) Installing collected packages: Django Successfully installed django - 3.1.1Copy the code