-
-
Save codenpk/27569e7a45842b7bdf59f7748690444e to your computer and use it in GitHub Desktop.
Script for installing Nexus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# configure HTTP proxy. REPLACE rhe-proxy.prod.lan with your domain name | |
export http_proxy=http://rhe-proxy.prod.lan:8080 | |
# persistent environment variable. REPLACE rhe-proxy.prod.lan with your domain name | |
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 | |
#[OPTIONAL] allow port. In case of AWS/GCloud ignore this step and add localhost:8081 as reverse proxy in nginx or apache | |
#/sbin/iptables -I INPUT 5 -p tcp -m state --state NEW --dport 8081 -j ACCEPT; /etc/init.d/iptables save | |
#[OPTIONAL] IF USING CHKCONFIG | |
#/sbin/chkconfig --add nexus | |
#/sbin/chkconfig --levels 345 nexus on | |
#/sbin/service nexus start | |
#ELSE standalone | |
cd /etc/init.d | |
sudo update-rc.d nexus defaults | |
sudo service nexus start | |
#Access the server on http://localhost:8081/nexus. Default credentials admin/admin123 | |
#REF1 Running behind a reverse proxy - https://help.sonatype.com/repomanager2/installing-and-running/running-behind-a-reverse-proxy | |
#REF2 Other https://www.build-business-websites.co.uk/install-nexus-on-ubuntu-16-04/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment