Installing maven and nexus in linux

Keywords: nexus Maven Apache Linux

Installing maven in linux

Download decompression

wget -c http://apache.claz.org/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
tar -zxvf apache-maven-3.5.4-bin.tar.gz

Import environment variables

Open file
vi /etc/profile

export MAVEN_HOME=/usr/local/apache-maven-3.5.4
export MAVEN_HOME
export PATH=$PATH:$MAVEN_HOME/bin

Verify maven installation success

mvn -version

Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00)
Maven home: /usr/local/apache-maven-3.5.4
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /usr/java/jdk1.8.0_181/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.4.0-105-generic", arch: "amd64", family: "unix"

Linux Installation nexus

Open the connection https://help.sonatype.com/repomanager3/download/download-archives---repository-manager-3
Download the tar.gz installation package and copy it to the server.
Decompression

tar -zxvf nexus-3.13.0-01-unix.tar.gz

Startup service

/usr/local/nexus/nexus-3.13.0-01/bin/nexus start

If you can't get up, you can use / usr/local/nexus/nexus-3.13.0-01/bin/nexus run to view the startup log. If you encounter the following error

WARNING: ************************************************************
WARNING: Detected execution as "root" user.  This is NOT recommended!
WARNING: ************************************************************
Starting nexus

It's nexus that doesn't let root start the service. Then switch users and report the following error

Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied

Warning:  Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
Warning:  Forcing option -XX:LogFile=/tmp/jvm.log
Unable to update instance pid: Unable to create directory /usr/local/nexus/sonatype-work/nexus3/instances
/usr/local/nexus/sonatype-work/nexus3/log/karaf.log (Permission denied)
Unable to update instance pid: Unable to create directory /usr/local/nexus/sonatype-work/nexus3/instances

It means that the switched user does not have permission to operate the sonatype work folder generated after nexus decompresses, so it is necessary to give the current user read and write permission under root.

chown menghb:menghb -R sonatype-work/

After that, open the main page of nexus, and the default login password is admin/admin123. If you want to change the password, you can change it on the interface. If you want to change the port, go to etc/nexus-default.properties to change the relevant parameters.

Posted by woolyg on Sat, 21 Dec 2019 13:07:22 -0800