-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnexus.sh
More file actions
33 lines (29 loc) · 1.55 KB
/
nexus.sh
File metadata and controls
33 lines (29 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
sudo apt update
sudo apt install openjdk-8-jdk -y
cd /opt/
sudo wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz
sudo tar -zxvf latest-unix.tar.gz
sudo mv /opt/nexus-* /opt/nexus
sudo adduser nexus
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work
sudo echo 'run_as_user="nexus"' > nexus/bin/nexus.rc
cd ~
cat <<EOT>> /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
Restart=on-abort
[Install]
WantedBy=multi-user.target
EOT
sudo systemctl daemon-reload
sudo systemctl start nexus
sudo systemctl enable nexus