如何在 ubuntu-18.04 上安装 nexus [英] How to install nexus on ubuntu-18.04
问题描述
我需要帮助在 ubuntu18.04 上安装 nexus-oss.我在互联网上找不到任何 apt-get 命令.
I need help in installing nexus-oss on ubuntu18.04. I am not able to find any apt-get commands on internet.
我试图在sudo apt-get search nexus"中搜索 nexus 包,但无法获得合适的 nexus 版本包.
I tried to search for nexus packages in "sudo apt-get search nexus", but could not get a proper nexus version package.
我浏览了网络,那里的命令可用于 centos7 但不适用于 Debian os.
I have browsed over the net, where the commands are available for centos7 but not for Debian os.
在 sonatype 文档中,提供了在 ubuntu 上创建存储库管理器的步骤,是否与在 ubuntu 上安装 nexus 相同?
In sonatype documentation, the steps are present to create repository manager on ubuntu, is it the same as installing nexus on ubuntu?
推荐答案
安装 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 服务.
As a good security practice, it is not advised to run nexus service as root. so create a new user called nexus and grant sudo access to manage nexus services.
$ sudo adduser nexus
为nexus用户设置无密码并输入以下命令编辑sudo文件
Set no password for nexus user and enter below command to edit sudo file
$sudo visudo
添加以下行并保存.
nexus ALL=(ALL) NOPASSWD: ALL
更改 nexus 文件的文件和所有者权限
Change file and owner permission for nexus files
$ sudo chown -R nexus:nexus /opt/nexus
$ sudo chown -R nexus:nexus /opt/sonatype-work
在启动时将 nexus 添加为服务
Add nexus as a service at boot time
打开/opt/nexus/bin/nexus.rc文件,取消run_as_user参数的注释,设置如下.
Open /opt/nexus/bin/nexus.rc file, uncomment run_as_user parameter and set it as following.
$ sudo vim /opt/nexus/bin/nexus.rc
run_as_user="nexus" (file shold have only this line)
在启动时将 nexus 添加为服务
Add nexus as a service at boot time
$ sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus
以 nexus 用户身份登录并启动服务
Log in as a nexus user and start service
$ su - nexus
$ /etc/init.d/nexus start
使用 netstat 命令检查端口是否正在运行
Check the port is running or not using netstat command
$ sudo netstat -plnt
允许8081端口访问nexus http://:8081
Allow the port 8081 and access the nexus http://:8081
以最小默认用户名和密码登录 admin/admin123
Login as a min default username and password is admin/admin123
这篇关于如何在 ubuntu-18.04 上安装 nexus的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!