Search code examples
ubuntu-18.04nexus3

How to install nexus on ubuntu-18.04


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?


Solution

  • 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