Skip to content

Commit

Permalink
Create install-redhat28.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
legah2045 authored Jun 24, 2022
1 parent 27ff9ee commit 28708da
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions nexus-installation/install-redhat28.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# Install and start nexus as a service
# This script works on RHEL 7 & 8 OS
# Your server must have atleast 4GB of RAM
# become the root / admin user via: sudo su -
#1. Create nexus user to manage the nexus
# As a good security practice, Nexus is not advised to run nexus service as a root user, so create a new user called nexus and grant sudo access to manage nexus services as follows.
useradd nexus
#4 Give sudo access to nexus user
sudo echo "nexus ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/nexus
sudo su - nexus
cd /opt


# 1.Install prerequisit: JAVA, git, unzip
sudo yum install wget git nano unzip -y
sudo yum install java-11-openjdk-devel java-1.8.0-openjdk-devel -y
# 2. Download nexus software and extract it (unzip)
# sudo wget http://download.sonatype.com/nexus/3/nexus-3.15.2-01-unix.tar.gz
sudo wget -O nexus.tar.gz https://download.sonatype.com/nexus/3/latest-unix.tar.gz
sudo tar -xvf nexus.tar.gz
mv /opt/nexus-3* /opt/nexus
#5 Change the owner and group permissions to /opt/nexus and /opt/sonatype-work directories.
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work
sudo chmod -R 775 /opt/nexus
sudo chmod -R 775 /opt/sonatype-work
#6 Open /opt/nexus/bin/nexus.rc file and uncomment run_as_user parameter and set as nexus user.
#vi /opt/nexus/bin/nexus.rc
echo run_as_user="nexus" > /opt/nexus/bin/nexus.rc
#vi /opt/nexus/bin/nexus.rc
#run_as_user="nexus"
#7 CONFIGURE NEXUS TO RUN AS A SERVICE
sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus
#9 Enable and start the nexus services
sudo systemctl enable nexus
sudo systemctl start nexus
sudo systemctl status nexus
echo "end of nexus installation"

0 comments on commit 28708da

Please sign in to comment.