Day to Day Java Java and related Topics

4Mar/103

Nexus, simple installation on Linux

Some weeks ago I got tired seeing Maven connecting to all those repositories online to check for new versions of dependencies. Not just that, but also the hassle of installing all those "not in any maven repository" dependencies. This had to be done each time I wanted a Hudson build to have it's repository, which is a good idea if you want to run simultaneous builds using different profiles.

I decided to install Nexus.

This was quite exiting for me, because it was the first time I actually was about to setup an app all by myself on our local Dev server. But this exercise just proved that it was really simple.

This is what i did:

# While logged in to our dev server
cd /tmp
 
# Get nexus
wget http://nexus.sonatype.org/downloads/nexus-webapp-1.4.1-bundle.tar.gz
 
# Unpack
tar xvzf nexus-webapp-1.4.1-bundle.tar.gz
 
# Move it to wanted install dir
mv nexus-webapp-1.4.1 /usr/local/
cd /usr/local
 
# Create symb link to nexus
ln -s nexus-webapp-1.4.1 nexus
 
# Add path to nexus in global profile
emacs /etc/profile
 
# Make nexus executable
cd /usr/local/nexus/
chmod -R a+x bin

First step done, nexus is downloaded an in a wanted directory on your server. Now a few steps more is needed to get it running:

# Make nexus run as service
cd /usr/local/nexus/bin/jsw
 
# Copy wanted linux version to the init dir to create a restartable instance of Nexus
cp linux-x86-32/nexus /etc/init.d/nexus
chmod 755 /etc/init.d/nexus
update-rc.d nexus defaults
 
emacs /etc/init.d/nexus
 
#Change nexus parameters:
APP_NAME="nexus"
APP_LONG_NAME="Sonatype Nexus Repository Manager"
 
NEXUS_HOME=/usr/local/nexus
PLATFORM=linux-x86-32
 
# Set local path to Java
JAVA_HOME=/usr/local/java
PATH=$PATH:$JAVA_HOME/bin
 
# Wrapper
WRAPPER_CMD=$NEXUS_HOME/bin/jsw/$PLATFORM/wrapper
WRAPPER_CONF=$NEXUS_HOME/conf/wrapper.conf
 
# Priority at which to run the wrapper.  See "man nice" for valid priorities.
#  nice is only used if a priority is specified.
PRIORITY=
 
# Location of the pid file.
PIDDIR="/var/run"
 
# Start service
service nexus start
 
# Configuration may have to be done, check the reference: http://www.sonatype.com/books/nexus-book/reference/

Now Nexus is good to go, the only thing remaining is to open Nexus and start integrating it with Maven and installing those jars...

Related posts:

  1. Sonar, simple installation on Linux
Comments (3) Trackbacks (1)
  1. Didn’t know you had this up and running yet. Very cool!

  2. This is a fantastic page to learn installing nexus on a linux machine. Thank you.

    A small suggestion, the latest nexus version does not have “wrapper.conf” file. So, please advice the readers to comment the following line in nexus file

    WRAPPER_CONF=$NEXUS_HOME/conf/wrapper.conf

    Else, you will get the below error

    service nexus start
    Starting Sonatype Nexus Repository Manager…
    FATAL | wrapper | Unable to resolve the full path of the configuration file, /usr/local/nexus/conf/wrapper.conf: No such file or directory
    Failed to start Sonatype Nexus Repository Manager.

  3. Thanks for your comment, I’m soon about to update the running version of Nexus, and will post an entry on the changes I meet. I’m also about to post a short howto on installing Jenkins and Jira, so stay posted.


Leave a comment

(required)