yum install wget -y
yum install -y java-1.8.0-openjdk.x86_64
2. 下載nexus並解壓縮
wget -O nexus.tar.gz https://download.sonatype.com/nexus/3/latest-unix.tar.gz
tar -xvf nexus.tar.gz -C /opt
mv /opt/nexus-3* /opt/nexus
3. 建立使用者nexus
sudo adduser nexus
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work
4. 修改檔案
vi /opt/nexus/bin/nexus.rc
run_as_user="nexus"
vi /etc/security/limits.conf
nexus - nofile 65536
以下依情況調整
vi /opt/nexus/bin/nexus.vmoptions
5. 設定nexus服務
vi /etc/systemd/system/nexus.service
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Group=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
6. 啟動服務
sudo systemctl daemon-reload
sudo systemctl enable nexus
sudo systemctl start nexus
7. 確認服務,稍微要等一下服務啟動
sudo systemctl status nexus
ss -ntlp
8. 連線 http:/nexus_ip:8081/
密碼在 cat /opt/sonatype-work/nexus3/admin.password