环境准备
官方文档:https://help.sonatype.com/display/NXRM2/Repository+Manager+2
本文环境
- 系统:Centos7.3
- jdk:jdk-8u144-linux-x64.tar.gz
- maven:apache-maven-3.3.9-bin.tar.gz
- Tomcat:apache-tomcat-8.5.20.tar.gz
- nexus:nexus-webapp-2.14.5-02.war
新建nexus用户
# useradd nexus
![这里写图片描述](https://img-blog.csdn.net/20170915151336000?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSnl1U3Vu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
以nexus用户下继续操作
# su - nexus
$ cd ~ && pwd
![这里写图片描述](https://img-blog.csdn.net/20170915152856376?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSnl1U3Vu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
- 下载JDK
略 - 下载Maven
略 - 下载Tomcat
略 - 下载Nexus
通过Maven仓库中找到nexus的war包,并下载
$ wget http://central.maven.org/maven2/org/sonatype/nexus/nexus-webapp/2.14.5-02/nexus-webapp-2.14.5-02.war
下载完成之后查看
$ ls /home/nexus
$ mkdir java maven server
环境搭建配置
配置Oracle-JDK
$ mv jdk-8u144-linux-x64.tar.gz java/
$ cd java
$ tar -xzvf jdk-8u144-linux-x64.tar.gz
- 配置JDK环境变量
编辑/home/nexus/.bash_profile文件,并加入以下内容
$ vi .bash_profile
JAVA_HOME=$HOME/java/jdk1.8.0_144
JRE_HOME=$HOME/java/jdk1.8.0_144/jre
CLASSPATH=.:$JAVA_HOME/bin/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME JRE_HOME CLASSPATH PATH
$ source /home/nexus/.bash_profile
$ java -version
![这里写图片描述](https://img-blog.csdn.net/20170915155727062?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSnl1U3Vu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
配置Maven
$ mv apache-maven-3.3.9-bin.tar.gz maven/
$ cd maven
$ tar -xvzf apache-maven-3.3.9-bin.tar.gz
- 配置maven环境变量
编辑/home/nexus/.bash_profile文件,并加入以下内容
$ vi .bash_profile
MAVEN_HOME=$HOME/maven/apache-maven-3.3.9
PATH=$MAVEN_HOME/bin:$PATH
export MAVEN_HOME PATH
$ source /home/nexus/.bash_profile
$ mvn -version
![这里写图片描述](https://img-blog.csdn.net/20170915173805174?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSnl1U3Vu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
配置Tomcat
$ mv apache-tomcat-8.5.20.tar.gz server/
$ cd server
$ tar -xvzf apache-tomcat-8.5.20.tar.gz
$ vi /home/nexus/server/apache-tomcat-8.5.20/conf/server.xml
8080→8086
8009→8010
8005→8006
$ mv nexus-webapp-2.14.5-02.war nexus.war
$ cp nexus.war /home/nexus/server/apache-tomcat-8.5.20/webapps
$ ./home/nexus/server/apache-tomcat-8.5.20/startup.sh
http:
![这里写图片描述](https://img-blog.csdn.net/20170915180404988?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvSnl1U3Vu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)