一、安装环境
操作系统:CentOS7.1 Minimal
IP:192168.1.101
java:jdk-8u131
nexus: nexus-3.5.0-02
相关软件包:
https://help.sonatype.com/repomanager3/download/download-archives---repository-manager-3
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
关闭防火墙
# systemctl stop firewalld
# systemctl disable firewalld
# iptables -F
二、安装nexus
# rpm -e --nodeps $(rpm -qa | grep -i openjdk)
# wget https://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-3.5.0-02-unix.tar.gz
# tar zxvf nexus-3.5.0-02-unix.tar.gz -C /opt
# tar zxvf jdk-8u131-linux-x64.tar.gz -C /opt
# ls /opt/
nexus-3.5.0-02 sonatype-work jdk8u_131
# groupadd -g 2018 nexus
# useradd -u 2018 -g 2018 nexus
# echo "JAVA_HOME=/opt/jdk1.8.0_131" >> /etc/profile.d/jdk.sh
# source /etc/profile.d/jdk.sh
# echo "export PATH=$JAVA_HOME/bin:$PATH" >> /etc/profile.d/jdk.sh
# source /etc/profile.d/jdk.sh
# java -version
# vim /opt/nexus-3.5.0-02/bin/nexus.rc
run_as_user="nexus"
# vim /opt/nexus-3.5.0-02/bin/nexus
INSTALL4J_JAVA_HOME="/opt/jdk1.8.0_131"
# vim /etc/systemd/system/nexus.service
########################
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus-3.5.0-02/bin/nexus start
ExecStop=/opt/nexus-3.5.0-02/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
#################################
# chown -R nexus:nexus /opt/nexus-3.5.0-02
# chown -R nexus:nexus /opt/sonatype-work
# systemctl daemon-reload
# systemctl start nexus.service
# ss -tan | grep 8081
# keytool \
-genkeypair \
-keystore /opt/nexus-3.5.0-02/etc/ssl/keystore.jks \
-alias nexus \
-keypass nexus@123 \
-storepass nexus@123 \
-keyalg RSA \
-keysize 2048 \
-validity 5000 \
-dname "CN=*.test.com,OU=TEST,O=TEST,L=Shenzhen,ST=Guangdong,C=CN" \
-ext "SAN=IP:192.168.1.101" \
-ext "BC=ca:true"
# chown -R nexus:nexus /opt/nexus-3.5.0-02
# chown -R nexus:nexus /opt/sonatype-work
# vim /opt/sonatype-work/nexus3/etc/nexus.properties
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml,${jetty.etc}/jetty-https.xml
application-port-ssl=8443
# vim /opt/nexus-3.5.0-02/etc/jetty/jetty-https.xml
# systemctl restart nexus
# systemctl status nexus
# systemctl enable nexus
# ss -tan | grep 8081
# ss -tan | grep 8443
三、测试
浏览器访问 http://192.168.1.101:8081
浏览器访问 https://192.168.1.101:8443
默认登录用户密码:admin/admin123
四、参考
https://www.sonatype.org
https://help.sonatype.com/repomanager3/installation
http://www.eclipse.org/jetty/documentation/9.3.x/configuring-ssl.html
https://docs.docker.com/engine/reference/commandline/login
https://docs.docker.com/engine/reference/commandline/login/#parent-command
https://github.com/codeclou/docker-sonatype-nexus-repository-oss
http://blog.codecp.org/2016/05/23/Nexus%20oss%203.0%20%E6%9E%84%E5%BB%BAdocker%E4%BB%93%E5%BA%93
https://docs.docker.com/registry/insecure/#docker-still-complains-about-the-certificate-when-using-authentication