简介:
maven仓库我们一般可以把中央仓库换为阿里云仓库,这样会快点加载。但是现在公司很多都是微服务,需要上传jar包到仓库里面提供给其他的项目作为依赖。这时搭建一个私服就有必要了。私服可以下载更快,比较是内网的。其次就是可以发布jar到私服里面。
1.下载nexus
https://www.sonatype.com/download-oss-sonatype
2.解压
新建一个文件夹nexus解压到里面.,解压到/usr/local/nexus
下
tar -zxvf nexus-2.12.0-01-bundle.tar.gz -C /usr/local/nexus
解压后会在同级目录中,出现两个文件夹:nexus-2.12.0-01和sonatype-work前者包含了nexus的运行环境和应用程序,后者包含了你自己的配置和数据。
3.配置环境变量
vim /etc/profile
4.启动
- 启动报错
WARNING - NOT RECOMMENDED TO RUN AS ROOT
If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.
- 环境变量增加
环境变量增加root权限用户:vi /etc/profile 加入export RUN_AS_USER=root
(永久)
启动成功访问地址,默认账号密码:admin/admin123
http://193.112.76.194:8081/nexus/
修改端口:
[root@VM_0_12_centos nexus-2.12.0-01]# vi conf/nexus.properties
5.设置可以从远程仓库下载。
下载的库jar包可以保存到私服里面。方便日后内网下载。
6.nexus重置密码
到: nexus\sonatype-work\nexus\conf 目录下面
停止nexus,然后
删除 security-configuration.xml security.xml
启动nexus 会重新生成两个配置文件。
登录名称还原为admin/admin123