2

I need help in installing nexus-oss on ubuntu18.04. I am not able to find any apt-get commands on internet.

I tried to search for nexus packages in "sudo apt-get search nexus", but could not get a proper nexus version package.

I have browsed over the net, where the commands are available for centos7 but not for Debian os.

In sonatype documentation, the steps are present to create repository manager on ubuntu, is it the same as installing nexus on ubuntu?

csvraju
  • 105
  • 1
  • 1
  • 6
  • 1
    Follow the Sonatype documentation https://help.sonatype.com/repomanager3/installation – gile Jul 14 '19 at 15:06

1 Answers1

18

Install Java

$ sudo apt-get update   
$ sudo  apt install openjdk-8-jre-headless -y

Download Nexus

$cd /opt 

$ sudo  wget https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.16.1-02-unix.tar.gz

$ sudo  tar -zxvf nexus-3.16.1-02-unix.tar.gz

$ sudo  mv /opt/nexus-3.16.1-02 /opt/nexus

As a good security practice, it is not advised to run nexus service as root. so create a new user called nexus and grant sudo access to manage nexus services.

$ sudo adduser nexus   

Set no password for nexus user and enter below command to edit sudo file

$sudo visudo 

Add the below line and Save.

nexus   ALL=(ALL)       NOPASSWD: ALL

Change file and owner permission for nexus files

$ sudo chown -R nexus:nexus /opt/nexus  
$ sudo chown -R nexus:nexus /opt/sonatype-work  

Add nexus as a service at boot time

Open /opt/nexus/bin/nexus.rc file, uncomment run_as_user parameter and set it as following.

$ sudo vim /opt/nexus/bin/nexus.rc  
   
 run_as_user="nexus" (file shold have only this line)

Add nexus as a service at boot time

$ sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus

Log in as a nexus user and start service

 $ su - nexus  
 $ /etc/init.d/nexus start  

Check the port is running or not using netstat command

$ sudo netstat -plnt

Allow the port 8081 and access the nexus http://:8081

Login as a min default username and password is admin/admin123

Quasar
  • 93
  • 2
  • 4
madhu
  • 1,083
  • 3
  • 12
  • 31
  • 3
    `su - nexus` didn't work for me as I couldn't provide a password to an account which doesn't take a password, so instead I used `sudo -u nexus /etc/init.d/nexus start` – mrswadge Oct 15 '19 at 22:10
  • Thanks for the trick above, I ran into the same issue. - Duncan – Duncan Krebs Jan 28 '20 at 21:37
  • 1
    To run as service follow this url https://help.sonatype.com/repomanager3/installation/run-as-a-service – sujith s Aug 24 '20 at 07:19