Skip to content

Instantly share code, notes, and snippets.

@jmettes
Last active January 10, 2019 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jmettes/f0a11df3bf076d94230c to your computer and use it in GitHub Desktop.
Save jmettes/f0a11df3bf076d94230c to your computer and use it in GitHub Desktop.
Script for installing Nexus
# configure HTTP proxy
export http_proxy=http://rhe-proxy.prod.lan:8080
# persistent environment variable
echo "export http_proxy=http://rhe-proxy.prod.lan:8080" > /etc/profile.d/nexus.sh
# create nexus system account
/usr/sbin/adduser -r nexus
# install nexus as per http://books.sonatype.com/nexus-book/reference/install-sect-service.html
wget http://www.sonatype.org/downloads/nexus-2.9.0-bundle.tar.gz
tar xvf nexus-2.9.0-bundle.tar.gz
chown -R nexus:nexus nexus-2.9.0-04
chown -R nexus:nexus sonatype-work
mv nexus-2.9.0-04 /usr/local/
mv sonatype-work /usr/local/
# PID file
mkdir /usr/local/nexus-2.9.0-04/run
chmod 755 /usr/local/nexus-2.9.0-04/run
chown nexus:nexus /usr/local/nexus-2.9.0-04/run
# service
cp /usr/local/nexus-2.9.0-04/bin/nexus /etc/init.d/nexus
# settings
sed -i "s/NEXUS_HOME=\"..\"/NEXUS_HOME=\"\/usr\/local\/nexus-2.9.0-04\"/g" /etc/init.d/nexus
sed -i "s/#PIDDIR=\".\"/PIDDIR=\"\/usr\/local\/nexus-2.9.0-04\/run\"/g" /etc/init.d/nexus
sed -i "s/#RUN_AS_USER=/RUN_AS_USER=\"nexus\"/g" /etc/init.d/nexus
# allow port
/sbin/iptables -I INPUT 5 -p tcp -m state --state NEW --dport 8081 -j ACCEPT; /etc/init.d/iptables save
/sbin/chkconfig --add nexus
/sbin/chkconfig --levels 345 nexus on
/sbin/service nexus start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment