阿里云服务器使用nexus搭建maven私服

安装前提(直奔主题,nexus搭建maven私服详细介绍网上资料很多)

在搭建Maven私服之前,对我们的安装环境是有要求的,需要我们先安装 JDK 和 Maven,自行安装,不做赘述。 

下载安装


nexus下载地址:https://help.sonatype.com/repomanager2/download/download-archives---repository-manager-oss

阿里云服务器使用nexus搭建maven私服_第1张图片

下载成功然后解压

1、tar -xvf nexus-2.14.5-02-bundle.tar.gz(解压目录可自行指定)

2、解压成功,会有两个文件夹,如下图:

3、 进入目录 nexus-2.14.14-01/bin,执行以下命令,启动我们的nexus(默认的端口是8081):./nexus start

4、启动后会出现如下图错误(需要在vi /etc/profile 文件末尾里添加export RUN_AS_USER=root  授权 ):

5、授权成功后,重启nexus.

阿里云服务器使用nexus搭建maven私服_第2张图片

6、访问nexus首页( http://ip:8081/nexus ),访问不到,会有两种原因:

(1)进入阿里云服务器控制台查看安全规则是否有端口8081的安全规则,没有添加即可。

阿里云服务器使用nexus搭建maven私服_第3张图片

(2)centos从7开始默认用的是firewalld,这个是基于iptables的,虽然有iptables的核心,但是iptables的服务是没安装的。安装iptables服务:
sudo yum install iptables-services
sudo systemctl enable iptables && sudo systemctl enable ip6tables
sudo systemctl start iptables && sudo systemctl start ip6tables

安装成功后修改服务器防火墙访问配置:vi etc/sysconfig/iptables

在 iptables 文件中加入以下命令: 

-A INPUT -p tcp -m state --state NEW -m tcp --dport 8081 -j ACCEPT

如果保存不成功,需要修改 iptables 文件读写权限 :chmod 777 iptables

(3)如果2步骤不可行可以尝试关闭firewalld服务,但云服务器安全规则还是要配置(待验证):
sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service

7、完成后,重启下防火墙:service iptables restart

8、再访问 http://ip:8081/nexus这个地址,这个时候你会发现,访问成功了! 

阿里云服务器使用nexus搭建maven私服_第4张图片

你可能感兴趣的:(阿里云服务器使用nexus搭建maven私服)