maven及nexus私服安装

Maven的功能是通过pom.xml解决Java项目的依赖关系。
nexus是一个强大的maven仓库管理器,它极大的简化了本地内部仓库的维护和外部仓库的访问。

maven、nexus都需要Java环境,故须先安装jdk
JDK安装参考

安装maven

wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
tar xf apache-maven-3.5.4-bin.tar.gz -C /usr/local/
mv /usr/local/apache-maven-3.5.4 /usr/local/maven

#添加环境变量
vim /etc/profile    

export JAVA_HOME=/usr/local/jdk1.8.0_201
export JRE_HOME=/usr/local/jdk1.8.0_201/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export M2_HOME=/usr/local/maven
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$M2_HOME/bin:$PATH

#加载编辑后的环境变量
source /etc/profile

#检查
$ mvn -version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00)
Maven home: /usr/local/maven
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_201/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-862.11.6.el7.x86_64", arch: "amd64", family: "unix"

安装nexus

#下载并安装nexus 
wget https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.7.0-04-unix.tar.gz
tar xf nexus-3.7.0-04-unix.tar.gz -C /opt/

#调整内存
vim /opt/nexus-3.7.0-04/bin/nexus.vmoptions
将
-Xms1200M
-Xmx1200M
-XX:MaxDirectMemorySize=2G
改为
-Xms256M
-Xmx512M
-XX:MaxDirectMemorySize=1G

#启动nexus
/opt/nexus-3.7.0-04/bin/nexus start

nexus私服迁移

cd /opt
tar zcf nexus.tar.gz nexus-3.7.0-04 sonatype-work
scp nexus.tar.gz 10.211.55.12:/opt
#新服务器安装jdk环境并解压nexus.tar.gz 到/opt/目录下 并启动即可

原文链接

你可能感兴趣的:(maven及nexus私服安装)