0

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:

  1. Installing Java:

sudo apt-get update
sudo apt install openjdk-8-jdk openjdk-8-jre
  1. 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
  1. Creating Nexus User:

$ sudo adduser soumav
  1. 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
  1. Modify memory settings:

$ sudo vim /opt/nexus/bin/nexus.vmoptions
  1. 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
  1. Starting Nexus

$ sudo systemctl enable nexus
$ sudo systemctl start nexus
$ sudo systemctl status nexus

However, I am having issues with a couple of steps:

  1. 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.

  2. 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?

Soumav
  • 385
  • 1
  • 6
  • 25

1 Answers1

3

Your error is on step #2. Last command moves the compressed file and not the uncompressed folder to /opt/nexus. That's the reason of your error :

Jul 29 17:16:26 nexus systemd[5832]: nexus.service: Failed at step EXEC spawning /opt/nexus/bin/nexus: Not a directory

The correct commands for step #2 should look like this:

$ 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-3.32.0-03 /opt/nexus

Once you move the correct uncompressed folder to the right folder, you can follow the tutorial

Armando Cuevas
  • 817
  • 1
  • 8
  • 19