Nexus【部署 02】最新版本 nexus-3

Java™ SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot™ 64-Bit Server VM (build 25.251-b08, mixed mode)


## 2. 安装、配置、启动


### 2.1 安装



解压安装文件

tar -zxvf nexus-3.35.0-02-unix.tar.gz

将解压出来的两个文件夹 移动到 /usr/local/ 下【位置随意】

mv ./nexus-3.35.0-02/ /usr/local/nexus/
mv ./sonatype-work/ /usr/local/sonatype-work/


### 2.2 配置


1️⃣ 配置环境变量的方法比较多,这里统一将环境变量放在 /etc/profile.d/my\_env.sh 内:



配置环境变量:

vim /etc/profile.d/my_env.sh

添加 NEXUS_HOME 及 bin

export NEXUS_HOME=/usr/local/nexus
export PATH= P A T H : PATH: PATH:NEXUS_HOME/bin

使得配置的环境变量立即生效:

# 首先是要赋权限【只操作一次就行】
chmod +x /etc/profile.d/my_env.sh

source /etc/profile.d/my_env.sh


2️⃣ 修改 $NEXUS\_HOME/bin/nexus.rc 文件,将 run\_as\_user 配置放开,Nexus 跟很多 Linux 应用一样不推荐使用 root 用户,我们可以暂用:



释放并修改 run_as_user

vim /usr/local/nexus/bin/nexus.rc
run_as_user=“root”


3️⃣ 修改 $NEXUS\_HOME/etc/nexus-default.properties 的 IP 和端口:



修改 nexus-default.properties 的 host 和 port

vim /usr/local/nexus/etc/nexus-default.properties
# Jetty section
application-port=8087
application-host=tcloud


4️⃣ 添加到系统服务:



ln -s $NEXUS_HOME/bin/nexus /etc/init.d/nexus


### 2.3 启动



后台启动【不能看日志】

[root@tcloud ~]# service nexus start

使用前台启动

[root@tcloud ~]# service nexus run
WARNING: ************************************************************
WARNING: Detected execution as “root” user. This is NOT recommended!
WARNING: ************************************************************
Java HotSpot™ 64-Bit Server VM warning:
INFO: os::commit_memory(0x000000074f550000, 1890254848, 0) failed;
error=‘Cannot allocate memory’ (errno=12)

There is insufficient memory for the Java Runtime Environment to continue.

Native memory allocation (mmap) failed to map 1890254848 bytes for committing reserved memory.

An error report file with more information is saved as:

/usr/local/nexus/hs_err_pid1301.log


【Nexus 日志注意❗️❗️❗️】



> 
> 启动成功 后的运行日志文件为 /sonatype-work/nexus3/log/nexus.log  
>  启动失败 的日志文件为 $NEXUS\_HOME/hs\_err\_pidxxxx.log
> 
> 
> 


### 2.4 调整虚拟机设置


以上报错是内存不足【需要1.76G】,由于我的云服务器是1核2G的,刚启动的服务器也就剩下1.4G的可用内存,这里需要通过调整 $NEXUS\_HOME/bin/nexus.vmoptions 文件:



vim /usr/local/nexus/bin/nexus.vmoptions
# 修改了4个与内存相关的参数
-Xms1024m
-Xmx1024m
-XX:MaxDirectMemorySize=1024m
-Djdk.tls.ephemeralDHKeySize=512


### 2.5 重启



[root@tcloud ~]# service nexus run

其他日志略【这样就是启动成功了】


Started Sonatype Nexus OSS 3.35.0-02




![img](https://img-blog.csdnimg.cn/img_convert/80574e186687478a805a747317049b8f.png)
![img](https://img-blog.csdnimg.cn/img_convert/655f5fda518c5100e50e7807b8a5fe6e.png)
![img](https://img-blog.csdnimg.cn/img_convert/0a5036ed80235c4eebee9e88c7851d91.png)

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上软件测试知识点,真正体系化!**


https://bbs.csdn.net/forums/4304bb5a486d4c3ab8389e65ecb71ac0
5775102540)]

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上软件测试知识点,真正体系化!**


https://bbs.csdn.net/forums/4304bb5a486d4c3ab8389e65ecb71ac0
  • 9
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值