阿里云2核2g安装nexus

阿里云2核2g安装nexus

java 复制代码
# 安装 JDK 1.8
sudo yum install -y java-1.8.0-openjdk-devel

# 验证安装
java -version

创建运行用户

java 复制代码
cd /opt
sudo wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz
sudo tar -xzf latest-unix.tar.gz
sudo mv nexus-3* nexus

``sudo useradd -r -m -U -d /opt/nexus -s /bin/bash nexus
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work

``
创建 systemd 服务文件:
sudo vi /etc/systemd/system/nexus.service
写入以下内容:
[Unit]
Description=Nexus Service
After=network.target

[Service]
Type=forking
LimitNOFILE=65536
User=nexus
Group=nexus
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
Restart=on-abort

[Install]
WantedBy=multi-user.target
加载并启动服务
```java
sudo systemctl daemon-reload
sudo systemctl start nexus
sudo systemctl enable nexus

推荐修改为如下内容(适用于 2GB 内存服务器):

java 复制代码
vim /opt/nexus/bin/nexus.vmoptions
java 复制代码
-Xms256M
-Xmx512M
-XX:MaxDirectMemorySize=512M
-XX:+UnlockDiagnosticVMOptions
-XX:+LogVMOutput
-XX:LogFile=../sonatype-work/nexus3/log/jvm.log
-XX:-OmitStackTraceInFastThrow
-Djava.net.preferIPv4Stack=true
-Dkaraf.home=.
-Dkaraf.base=.
-Dkaraf.etc=etc/karaf
-Djava.util.logging.config.file=etc/karaf/logging.properties
-Dorg.ops4j.pax.url.mvn.localRepository=file:../sonatype-work/nexus3/cache
java 复制代码
sudo -u nexus /opt/nexus/bin/nexus run
相关推荐
Johny_Zhao1 小时前
Docker + CentOS 部署 Zookeeper 集群 + Kubernetes Operator 自动化运维方案
linux·网络安全·docker·信息安全·zookeeper·kubernetes·云计算·系统运维
鸭鸭鸭进京赶烤2 小时前
大学专业科普 | 云计算、大数据
大数据·云计算
SH11HF6 小时前
小菜狗的云计算之旅,学习了解rsync+sersync实现数据实时同步(详细操作步骤)
学习·云计算
搞笑的秀儿9 小时前
信息新技术
大数据·人工智能·物联网·云计算·区块链
泊浮目17 小时前
未来数据库硬件-网络篇
数据库·架构·云计算
Imagine Miracle19 小时前
Ubuntu for ARM 更换为阿里云镜像源
arm开发·ubuntu·阿里云
draymond71071 天前
阿里云-云效自动部署spring boot项目
阿里云
UI设计和前端开发从业者1 天前
UI前端大数据处理策略优化:基于云计算的数据存储与计算
前端·ui·云计算
我是小bā吖2 天前
阿里云服务网格ASM实践
网络·阿里云·云计算·服务发现
lxsy2 天前
spring-ai-alibaba 1.0.0.2 学习(七)——集成阿里云百炼平台知识库
学习·spring·阿里云·spring-ai·ai-alibaba