I am trying to install Nexus on a Ubuntu VM instance in GCP.
I am fairly new to both GCP and Ubuntu and was following this tutorial to achieve the same:
- Installing Java:
sudo apt-get update
sudo apt install openjdk-8-jdk openjdk-8-jre
- Downloading, Extracting and Installing Nexus:
$ cd /opt
$ sudo wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz
$ sudo tar -zxvf latest-unix.tar.gz
$ sudo mv /opt/latest-unix.tar.gz /opt/nexus
- Creating Nexus User:
$ sudo adduser soumav
- Giving Permission to Nexus User (soumav)
$ sudo chown -R soumav:soumav /opt/nexus
$ sudo chown -R soumav:soumav /opt/sonatype-work
$ sudo vim /opt/nexus/bin/nexus.rc
- Modify memory settings:
$ sudo vim /opt/nexus/bin/nexus.vmoptions
- Configuring Nexus to run as a service
sudo vim /etc/systemd/system/nexus.service
and copying the below content:
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
User=soumav
Group=soumav
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=soumav
Restart=on-abort
[Install]
WantedBy=multi-user.target
- Starting Nexus
$ sudo systemctl enable nexus
$ sudo systemctl start nexus
$ sudo systemctl status nexus
However, I am having issues with a couple of steps:
In step '4' while executing this command :
$ sudo vim /opt/nexus/bin/nexus.rc
, I get a /opt/nexus/bin/nexus.rc" [Permission Denied]. I am able to get past this and able to edit the nexus.rc file as well as nexus.vmoptions by cd-ing to the bin directory.In step '6' when I do a
$ sudo systemctl enable nexus
and post that, try to start the service:$ sudo systemctl start nexus
, I get a ($ tail -f /opt/sonatype-work/nexus3/log/nexus.log
):Jul 29 17:16:26 nexus systemd[5832]: nexus.service: Failed to execute command: Not a directory Jul 29 17:16:26 nexus systemd[5832]: nexus.service: Failed at step EXEC spawning /opt/nexus/bin/nexus: Not a directory
Where am I going wrong?