centos7安装nexus3.x私服
1、安装配置jdk
可以自行下载,也可以在github上下载
https://github.com/openjdk/jdk
下载完后解压并将目录改名为java保存在/data/java
添加java环境变量
#vim /etc/profile
#文件末尾添加
export JAVA_HOME=/data/java
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
#添加完之后加载生效
source /etc/profile
java保存路径
[root@centos java]# pwd
/data/java
[root@centos java]# ls
bin javafx-src.zip legal man src.zip
COPYRIGHT jmc.txt lib README.html THIRDPARTYLICENSEREADME-JAVAFX.txt
include jre LICENSE release THIRDPARTYLICENSEREADME.txt
[root@centos java]# java -version
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)
[root@centos java]#
2、安装配置maven
下载地址
https://github.com/apache/maven
和java类似,解压后保存在/data/maven下面,同样还需要修改换几个变量
#vim /etc/profile
#文件末尾添加
export MAVEN_HOME=/data/maven
export PATH=$PATH:$MAVEN_HOME/bin
#添加完之后加载生效
source /etc/profile
maven保存路径
[root@centos maven]# pwd
/data/maven
[root@centos maven]# ls
bin boot conf lib LICENSE NOTICE README.txt
[root@centos java]# mvn -version
Apache Maven 3.9.3 (21122926829f1ead511c958d89bd2f672198ae9f)
Maven home: /data/maven
Java version: 1.8.0_271, vendor: Oracle Corporation, runtime: /data/java/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-957.el7.x86_64", arch: "amd64", family: "unix"
[root@centos maven]#
3、安装配置nexus
官方下载地址
github下载
https://github.com/sonatype/nexus-public
本例以nexus-3.37.2-02-unix.tar.gz版本为例
#解压后会得到2个目录
[root@centos dl]# tar -zxvf nexus-3.37.2-02-unix.tar.gz
nexus-3.37.2-02 nexus-3.37.2-02-unix.tar.gz sonatype-work
[root@centos dl]#
#将sonatype-work和nexus-3.37.2-02保存到/data/目录下,nexus-3.37.2-02改名为nexus
[root@centos dl]# mv nexus-3.37.2-02 /data/nexus
[root@centos dl]# mv sonatype-work /data/
修改端口
[root@centos etc]# pwd
/data/nexus/etc
[root@centos etc]# ls
fabric jetty karaf logback nexus-default.properties ssl
[root@centos etc]# vim nexus-default.properties
#修改下面这两个
application-port=8081
application-host=0.0.0.0
修改运行用户
[root@centos bin]# pwd
/data/nexus/bin
[root@centos bin]# ls
contrib nexus nexus.rc nexus.vmoptions nohup.out
[root@centos bin]# cat nexus.rc
run_as_user="yunwei"
[root@centos bin]#
修改数据保存路径
[root@centos bin]# pwd
/data/nexus/bin
[root@centos bin]# ls
contrib nexus nexus.rc nexus.vmoptions nohup.out
[root@centos bin]# vim nexus.vmoptions
#根据需要修改
#数据保存路径
-Dkaraf.data=../sonatype-work/nexus3
#日志保存路径
-Dkaraf.log=../sonatype-work/nexus3/log
4、启动nexus
[root@centos bin]# pwd
/data/nexus/bin
[root@centos bin]# ls
contrib nexus nexus.rc nexus.vmoptions nohup.out
#启动访问web页面
[root@centos bin]# ./nexus run &
#启动nexus
[root@centos bin]# ./nexus start
#查看nexus运行状态
[root@centos bin]# ./nexus status
用浏览器通过默认8081端口访问,默认的用户名:admin
默认密码:
[root@centos nexus3]# pwd
/data/sonatype-work/nexus3
[root@centos nexus3]# ls
admin.password blobs db etc instances karaf.pid lock orient restore-from-backup
cache elasticsearch generated-bundles kar keystores log port tmp
#查看默认密码
[root@centos nexus3]# cat admin.password
更改密码完成之后,admin.password文件自动删除