How to Install Nexus on CentOS?

How to Install Nexus on CentOS?

Installation Steps for Nexus:

Step-1: First Set the hostname with the following command.

$ hostnamectl set-hostname nexus

Step-2: Update your system.

$ sudo yum update -y

Step-3: We need to install java.

$ sudo yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel

Step-4: Check the java version.

$ java --version

Step-5: Create a directory named app and cd into the directory.

$ sudo mkdir app $ cd app

Step-6: Now download the repository with wget command.

$ sudo wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz

Step-7: Untar the repo.

$ tar -xvzf latest-unix.tar.gz

Step-8: Next, create a new user named nexus to run the nexus service.

$ sudo adduser nexus

Step-9: Set the ownership for nexus files and nexusdata.

$ sudo chown -R nexus:nexus /app/nexus $ sudo chown -R nexus:nexus /app/sonatype-work

Step-10: Configure nexus.rc.

$ vim /opt/nexus/bin/nexus.rc Uncomment run_as_user? parameter and add new value. run_as_user="nexus"

Step-11: Change Nexus configuration and set the custom data directory.

$ vim /app/nexus/bin/nexus.vmoptions

In the above file enter the following steps.

-Xms2703m

-Xmx2703m

-XX:MaxDirectMemorySize=2703m

-XX:+UnlockDiagnosticVMOptions

-XX:+UnsyncloadClass

-XX:+LogVMOutput

-XX:LogFile=../sonatype-work/nexus3/log/jvm.log

-XX:-OmitStackTraceInFastThrow

-Djava.net.preferIPv4Stack=true

-Dkaraf.home=.

-Dkaraf.base=.

-Dkaraf.etc=etc/karaf

- -

Djava.util.logging.config.file=etc/karaf/java.util.logging.properties

-Dkaraf.data=/nexus/nexus-data

-Djava.io.tmpdir=../sonatype-work/nexus3/tmp

-Dkaraf.startLocalConsole=false

Step-12: sudo vi /etc/systemd/system/nexus.service.

$ [Unit]

Description=nexus service

After=network.target

[Service]

Type=forking

LimitNOFILE=65536

User=nexus

Group=nexus

ExecStart=/app/nexus/bin/nexus start

ExecStop=/app/nexus/bin/nexus stop

User=nexus

Restart=on-abort

[Install]

WantedBy=multi-user.target

Step-13: Enable service on system boot.

$ sudo systemctl daemon-reload

Step-14: Start service.

$ systemctl start nexus.service

Step-15: Check the status is nexus active or not.

$ systemctl status nexus.service

Step-16: Nexus is active and running

Check ip and port on browser and localhost:8081


Thanks to our interns who participated in this initiative.


Thank you for reading this article. We are happy to prepare articles as per your request. Please comment on which tool you want installation process. Also please comment in any issues with above installation.

要查看或添加评论,请登录

AIMaster.live的更多文章

社区洞察