【问题标题】:How to install nexus on ubuntu-18.04如何在 ubuntu-18.04 上安装 nexus
【发布时间】:2020-07-10 00:39:05
【问题描述】:

我需要在 ubuntu18.04 上安装 nexus-oss 的帮助。我在互联网上找不到任何 apt-get 命令。

我尝试在“sudo apt-get search nexus”中搜索 nexus 包,但无法获得正确的 nexus 版本包。

我在网上浏览过,这里的命令可用于 centos7 但不适用于 Debian os。

在 sonatype 文档中,提供了在 ubuntu 上创建存储库管理器的步骤,是否与在 ubuntu 上安装 nexus 相同?

【问题讨论】:

标签: ubuntu-18.04 nexus3


【解决方案1】:

安装 Java

$ sudo apt-get update   
$ sudo  apt install openjdk-8-jre-headless -y

下载 Nexus

$cd /opt 

$ sudo  wget https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.16.1-02-unix.tar.gz

$ sudo  tar -zxvf nexus-3.16.1-02-unix.tar.gz

$ sudo  mv /opt/nexus-3.16.1-02 /opt/nexus

作为一种良好的安全实践,不建议以 root 身份运行 nexus 服务。因此创建一个名为 nexus 的新用户并授予 sudo 访问权限以管理 nexus 服务。

$ sudo adduser nexus   

为nexus用户设置无密码并输入以下命令编辑sudo文件

$sudo visudo 

添加以下行并保存。

nexus   ALL=(ALL)       NOPASSWD: ALL

更改关联文件的文件和所有者权限

$ sudo chown -R nexus:nexus /opt/nexus  
$ sudo chown -R nexus:nexus /opt/sonatype-work  

在启动时将 nexus 添加为服务

打开/opt/nexus/bin/nexus.rc文件,取消run_as_user参数的注释,设置如下。

$ sudo vim /opt/nexus/bin/nexus.rc  
   
 run_as_user="nexus" (file shold have only this line)

在启动时将 nexus 添加为服务

$ sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus

以nexus用户登录并启动服务

 $ su - nexus  
 $ /etc/init.d/nexus start  

使用 netstat 命令检查端口是否正在运行

$ sudo netstat -plnt

允许8081端口并访问nexus http://:8081

以最低默认用户名和密码登录,admin/admin123

【讨论】:

  • su - nexus 对我不起作用,因为我无法为没有密码的帐户提供密码,所以我使用了sudo -u nexus /etc/init.d/nexus start
  • 感谢上述技巧,我遇到了同样的问题。 - 邓肯
  • 要作为服务运行,请按照此 url help.sonatype.com/repomanager3/installation/run-as-a-service
猜你喜欢
  • 2020-06-26
  • 2020-01-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-01
  • 2019-04-03
  • 2019-10-20
相关资源
最近更新 更多