Maven,yum,apt,nodejs
Nexus3 is a repository manager that greatly simplifies the maintenance of local internal repositories and the access to external repositories. Normally, we get maven repository resources from the official (or domestic mirror) of Maven, but if your production server does not have Internet access, At this point, it is necessary to set up a private warehouse on a server with Internet access permission on the LAN, so that other servers with Internet access permission can download and install Maven, APT, yum, Gradle, pypi, Docker and so on through the established private repository, just like downloading directly through the Internet.
Nexus support: Nexus in the remote warehouse while maintaining the local warehouse, to reduce the load of the central warehouse, save the bandwidth and time of the external network, Nexus private server can meet such needs. Nexus is an “out of the box” system that doesn’t need a database, but uses a file system plus Lucene to organize data. Nexus supports WebDAV and LDAP secure authentication. Nexus also offers powerful warehouse management, component search, reST-based, low memory footprint, and simple file systems instead of databases.
1. The JDK installation
Nexus3 is developed in Java and requires Jdk installation
Prepare the JDK-8u191-linux-x64.tar.gz ######## Decompress to the /usr/local directory: tar -xvf JDK-8u191-linux-x64.tar.gz -c /usr/local ######## Configure the JDK environment variable cat >> /etc/profile << EOFexport JAVA_HOME=/usr/local/jdk18.. 0_191 /export PATH=\$JAVA_HOME/bin:\$PATH
exportCLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar EOF ######## Run the environment variables to take effect source /etc/profile ######## View Java -versionCopy the code
2. Install the Nexus software
Take nexus-3.29 as an example. Prepare nexus-3.29.1-01-UNIX.tar. gz
######## decompress mkdir /usr/local/nexus3 tar -xvf nexus3.291.- 01-unix.tar.gz -C /usr/local/nexus3
Copy the code
Nexus-3.29.1-01 is the program and Sonatype -work is the data directory
[root@localhost nexus3]# cd /usr/local/nexus3/
[root@localhost nexus3]# ls -hl
total 0
drwxr-xr-x. 9 root root 163 Jun 28 10:47 nexus3.291.- 01
drwxr-xr-x. 3 root root 20 Jun 28 10:47 sonatype-work
Copy the code
3. Modify the configuration
The Jvm configuration is in /usr/local/nexus3/nexus-3.29.1-01/bin/nexus.vmoptions
- For example, if the memory is small, adjust VM parameters. The reference values are as follows
-Xms500M -Xmx500M -XX:MaxDirectMemorySize=800M
- The default storage directory is nexus-3.29.1-01 in the installation directory. For example, if you want to change this to another directory, you can change the values of karaf.data, karaf.log, java.io
-Dkaraf.data=.. /sonatype-work/nexus3 -Dkaraf.log=.. /sonatype-work/nexus3/log -Djava.io.tmpdir=.. /sonatype-work/nexus3/tmp
- /usr/local/nexus3/nexus-3.29.1-01/etc/nexus-default.properties /usr/local/nexus3/nexus-3.29.1-01
Port modification:
Sed -i ‘s/application – port = 8081 / application – port = 80 /’/usr/local/nexus3 / nexus – 3.29.1-01 / etc/nexus – default. The properties
Nexus – context – path changes
sed -i ‘s/nexus-context-path=//nexus-context-path=/nexus3/’ / usr/local/nexus3 / nexus – 3.29.1-01 / etc/nexus – default. The properties
4. Start, restart, and stop
/usr/local/nexus3/nexus3.291.- 01/bin/nexus start
/usr/local/nexus3/nexus3.291.- 01/bin/nexus restart
/usr/local/nexus3/nexus3.291.- 01/bin/nexus stop
Copy the code
5. Access tests
During the test, I changed /nexus-context-path to /nexus3, so the access address is as follows:http://192.168.56.101:8081/nexus3/ admin admin123
Maven,yum, APT, Docker, NPM private library construction
Maven private library:
Maven.aliyun.com/repository/… Maven.aliyun.com/repository/… Maven.aliyun.com/repository/… Maven.aliyun.com/repository/…
Yum private library:
New agent warehouse, on the nexus management agent, new tested agent is as follows: the Proxy Remote storage: docker – ce – > mirrors.aliyun.com/docker-ce/l… kubernetes —> mirrors.aliyun.com/kubernetes/ centos —> mirrors.aliyun.com/centos epel —–> download.fedoraproject.org/ docker –googlecontainer—>>> registry.aliyuncs.com/ nginx —–> nginx.org/ enterprise —–> rpms.remirepo.net/enterprise mysql ——> repo.mysql.com/ google-chrome ——> dl.google.com/
apt-proxy
Name: apt-proxy
Distribution: bionic
Remote Stroage: mirrors.aliyun.com/ubuntu/
Docker private library Settings
Containers docker –googlecontainer– >>> registry.aliyuncs.com/ customer index: registry-1.docker.io
##Realms– >>> Docker Bearer Token Realms moved to Active then saved
npm npm-repo-proxy
Name: npm-repo-proxy
Remote storage: registry.npmjs.org
3. Use of private libraries
Yum private library
Back up the old configuration, execute the new configuration, then yum Clean all to clear the cache, then do the normal yum install operation
cd /etc/yum.repos.d/
mkdir bak
mv *.repo bak
##################
cat > /etc/yum.repos.d/centos.repo << EOF
[centos_os]
name=centos_os
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/centos / / OS/x86_64/7
enabled=1
gpgcheck=0
[centos_extras]
name=centos_extras
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/centos / / extras/x86_64/7
enabled=1
gpgcheck=0
[centos_update]
name=centos_update
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/centos / / updates/x86_64/7
enabled=1
gpgcheck=0
[centos_centosplus]
name=centos_centosplus
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/centos / / centosplus/x86_64/7
enabled=1
gpgcheck=0
EOF
##################
cat > /etc/yum.repos.d/epel.repo << EOF
[epel]
name=epel
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/epel/pub/epel / / x86_64/7
enabled=1
gpgcheck=0
EOF
##################
cat > /etc/yum.repos.d/nginx.repo << EOF
[epel]
name=epel
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/nginx/packages/centos / / x86_64/7
enabled=1
gpgcheck=0
EOF
##################
cat > /etc/yum.repos.d/remi-safe.repo << EOF
[remi-safe]
name=Safe Remi's RPM repository for Enterprise Linux 7 - x86_64
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/enterprise / / safe/x86_64/7
enabled=1
gpgcheck=0
EOF
##################
cat > /etc/yum.repos.d/docker-ce.repo << EOF
[docker-ce-stable]
name=Docker CE Stable -
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/docker - 7 / x86_64 / ce/stable
enabled=1
gpgcheck=0
EOF
##################
cat > /etc/yum.repos.d/kubernetes.repo << EOF
[kubernets]
name=kubernets
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/kubernetes yum repos/kubernetes - el7 - x86_64 /
enabled=1
gpgcheck=0
EOF
##################Mysql57.
cat > /etc/yum.repos.d/mysql.repo << EOF
[mysql-connectors-community]
name=mysql-connectors-community
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/mysql/yum/mysql - connectors - community/el / / x86_64/7
enabled=1
gpgcheck=0
[mysql-tools-community]
name=mysql-tools-community
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/mysql/yum/mysql - tools - community/el / / x86_64/7
enabled=1
gpgcheck=0
[mysql57-community]
name=mysql57-community
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/mysql/yum/mysql - 5.7 - the community/el / / x86_64/7
enabled=1
gpgcheck=0
EOF
##################Google-chrome
cat > /etc/yum.repos.d/google-chrome.repo << EOF
[google-chrome]
name=google-chrome
baseurl=http:/ / 192.168.56.1:8081 / nexus3 / repository/Google chrome/Linux/chrome/RPM/stable/x86_64
enabled=1
gpgcheck=0
EOF
Copy the code
Apt the private library:
# # # # # # # # # # # # # # # # ## sudo mv /etc/apt/sources.list /etc/apt/sources.list.default
cat > /etc/apt/sources.list< < EOF deb http://192.168.56.1:8081/nexus3/repository/apt-proxy/ bionic main restricted universe multiverse deb http://192.168.56.1:8081/nexus3/repository/apt-proxy/ bionic ws-security main restricted universe multiverse deb http://192.168.56.1:8081/nexus3/repository/apt-proxy/ bionic - updates the main restricted universe multiverse deb http://192.168.56.1:8081/nexus3/repository/apt-proxy/ bionic - programs main restricted universe multiverse deb http://192.168.56.1:8081/nexus3/repository/apt-proxy/ bionic - backports main restricted universe multiverse EOF sudo apt Update #### is now availableCopy the code