1. Download nexus
https://help.sonatype.com/repomanager3/download
Select the corresponding operating system version
System Requirements:
- Install jdk 1.8 version
- The linux system needs to modify the maximum number of open files for nexus users:
- Modify /etc/security/limits.conf and add a line:,
nexus - nofile 65536
where nexus is the user who wants to run the nexus service. If you are using Ubuntu, it ignores the/etc/security/limits.conf
configuration. If the process is started by init.d, you can edit/etc/pam.d/common-session
and remove the comment on this line:# session required pam_limits.so
- If it is used,
systemd
you need to add aLimitNOFILE
configuration in the service configuration:
[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 # 这个用户请保持和实际要运行 nexus 的用户一致
Restart=on-abort
[Install]
WantedBy=multi-user.target
Second, department
1. Unzip the nexus software package:
tar -zxvf
nexus-3.26.1-02-unix.tar.gz
2. Add a common user group and user:
groupadd nexus
useradd -g nexus -s /sbin/nologin nexus
Be careful not to prohibit setting the user's home directory (-M parameter), otherwise an error will be reported when the service starts.
3. Grant user software directory permissions
chown -R nexus:nexus nexus-3.26.0-04
chown -R
nexus:nexus
sonatype-work/
4. Edit the user bin/nexus.rc that starts the service and add the following line:
run_as_user="nexus"
5. Edit and add system service /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 # 这个用户请保持和实际要运行 nexus 的用户一致
Restart=on-abort
[Install]
WantedBy=multi-user.target
6. Operation service:
sudo systemctl daemon-reload
sudo systemctl enable nexus.service
sudo systemctl start nexus.service
Three, verification
Author: Li Ling