从零开始搭建系统2.1——Nexus安装及配置
?
在安裝配置Nexus時,請先確定您已經(jīng)配置好jdk
1.創(chuàng)建目錄
2.下載安裝包
[root@localhost usr]# cd nexus
下載地址:https://www.sonatype.com/download-oss-sonatype
wget https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.9.0-01-unix.tar.gz
3.解壓安裝包
tar -zxvf nexus-3.9.0-01-unix.tar.gz
解壓之后生成兩個文件夾,分別為nexus-2.3.1-01、sonatype-work
?
4.啟動
進(jìn)入到bin目錄下,執(zhí)行./nexus start
解決上面的提示:
創(chuàng)建nexus用戶
groupadd nexus#創(chuàng)建組
useradd nexus?-g nexus#創(chuàng)建用戶并將用戶添加到組
?#修改文件所有者
chown -R nexus??/usr/nexus/
修改?nexus 腳本,指定啟動用戶
?
5.開啟8081端口
添加
firewall-cmd?--zone=public?--add-port=8081/tcp?--permanent ? ?(--permanent永久生效,沒有此參數(shù)重啟后失效) 重新載入 firewall-cmd?--reload 查看 firewall-cmd?--zone=?public?--query-port=8081/tcp 查看所有打開的端口 firewall-cmd --zone=public?--list-ports?5.驗證是否啟動成功
http://192.168.0.200:8081
?
出現(xiàn)上述頁面,說明配置nexus成功!
點擊右上角“Log in”, 輸入用戶名和密碼(默認(rèn)用戶名:admin ? ? ?密碼: admin123)登錄。
6.開機(jī)啟動sudo ln -s /usr/nexus/nexus-3.9.0-01/bin/nexus /etc/init.d/nexus
使用
service nexus status/start/stop
查看nexus服務(wù)狀態(tài)、啟動服務(wù)、停止服務(wù)等
使用
chkconfig nexus on/off
設(shè)置nexus服務(wù)開機(jī)自啟動或者開機(jī)不啟動
?
如果啟動不起來的話可以用下面方式啟動,通過啟動日志查找問題
service nexus start-launchd7.配置nexus
新建store
?
8.proxy私倉,使用的外部私倉是阿里的倉庫http://maven.aliyun.com/nexus/content/groups/public:
?
?9.release私倉
?
10.snapshot私倉
11.group私倉組
12.如何在項目中使用
settings.xml 配置
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:\.m2\repository</localRepository>
<pluginGroups>
<pluginGroup>org.sonatype.plugins</pluginGroup>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>Releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>Snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://192.168.0.200:8081/repository/nexus-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
項目pom配置
<distributionManagement>
<repository>
<id>Releases</id>
<name>Releases</name>
<url>http://192.168.0.200:8081/repository/nexus-releases</url>
</repository>
<snapshotRepository>
<id>Snapshots</id>
<name>Snapshots</name>
<url>http://192.168.0.200:8081/repository/nexus-snapshots</url>
</snapshotRepository>
</distributionManagement>
?
?
13.直接deploy即可
?
?14.設(shè)置可重復(fù)deploy
如果需要可重復(fù)deploy同一個版本的jar包,可進(jìn)行如下配置
?
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/provence666/p/8638558.html
總結(jié)
以上是生活随笔為你收集整理的从零开始搭建系统2.1——Nexus安装及配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 洛谷 P1019 单词接龙 (DFS)
- 下一篇: docker-machine为节点安装指