Installing Nexus Repository Manager OSS 3 on Ubuntu 16.04 and Nginx

Nexus OSS is a repository manager which help you to make your internal repository, for instance you don’t have to use docker hub, instead upload your images into your internal docker host
Despite of their rich documentation this is a quick tutorial how to install OSS 3 for internal docker on Nginx .
first im goin to setup a server and pointing a subdomain to it . in this case its

OSS requires JRE to run so next step is to download JRE and set it up for OSS to start

now go to jre directory and check your version

Its highly recommended to not run OSS as root account
add another user with sudo privilege instead

after download and extracting OSS you should have something like this .
Any misconfiguration in permission will cause serious problem in future .

now go to nexus directory then bin directory then edit nexus executable file
Uncomment # INSTALL4J_JAVA_HOME_OVERRIDE= and set JRE path we downloaded before

After that just run nexus with

After successful run nexus will provide you with this message

and your Nexus repository Manager is accessible from http://YOURIP:8081
Default Credentials are admin:admin123 but dont forget to change them . i will show you how dangerous it is to leave them default
Now if we close the terminal it causes Nexus to stop . so we are going to add it as a Service
before start we have to edit /opt/nexus/bin/nexus.rc
and change

with your user created for nexus oss . in this case we created oss user before so its should be something like this

create a file called nexus.service in /etc/systemd/system
with you editor paste this in it

ExecStart= and ExecStart= path should be correct
and also User= should be your user created for it . Mine is oss
as you remember we run OSS with root to see if our oss work or not . that write some log files with root permission and that stops Nexus service to start
before starting nexus service dont forget to do this to have successful service start

after that start Nexus as a service

Now if your server reboots , Nexus repository manager will start automatically at boot

As you know docker only works with SSL and installing signed SSL with Nexus is pain in the ass so we install Nginx to proxy our Nexus OSS with valid certificate from letsencrypt.
to install certbot :

install nginx

lets login into Nexus and within administration change https connection to http for docker

now its time to configure Nginx

Now your Nexus repository i accessible from oss.cker.ir
and you can test your internal docker on port 443
to install docker

now to check if your private respository works

Why should i change default credentials ?
The chance exposing your repository with default credentials is pretty high

Happy Coding .
Be Safe .

Leave a Reply

Your email address will not be published. Required fields are marked *