Nexus 安裝
/opt
目錄下創(chuàng)建一個目錄 setups
用來存放各種軟件安裝包;在 /usr
目錄下創(chuàng)建一個 program
用來存放各種解壓后的軟件包,下面的講解也都是基于此習慣EPEL、RepoForge
,如果你出現(xiàn) yum install XXXXX
安裝不成功的話,很有可能就是你沒有相關源,請查看我對源設置的文章wget http://download.sonatype.com/nexus/oss/nexus-2.12.0-01-bundle.tar.gz
如果地址下載不了,那是因為你需要開 VPN,你也可以選擇降低要求下載 2.11.4-01 版本:http://pan.baidu.com/s/1mgSNJtA
tar zxvf nexus-2.11.4-01-bundle.tar.gz
nexus-2.11.4-01
sonatype-work
mv nexus-2.11.4-01/ /usr/program/
cd /usr/program/
mv nexus-2.11.4-01/ nexus2.11.4/
vim /etc/profile
在文件的尾巴增加下面內(nèi)容:
# Nexus
NEXUS_HOME=/usr/program/nexus2.11.4
export NEXUS_HOME
RUN_AS_USER=root
export RUN_AS_USER
source /etc/profile
sonatype-work
以后是做倉庫用的,會存儲很多 jar,所以這個目錄一定要放在磁盤空間大的區(qū)內(nèi),目前我們還沒第一次啟動 Nexus,所以這里還是空文件
/opt
下,所以你要特別注意,下面有內(nèi)容對這個文件夾進行操作的都是基于 opt 目錄的:mv /opt/setup/sonatype-work/ /opt/
vim /usr/program/nexus2.11.4/conf/nexus.properties
nexus-work=${bundleBasedir}/../sonatype-work/nexus
nexus-work=/opt/sonatype-work/nexus
vim /usr/program/nexus2.11.4/bin/jsw/conf/wrapper.conf
sudo iptables -I INPUT -p tcp -m tcp --dport 8081 -j ACCEPT
sudo /etc/rc.d/init.d/iptables save
sudo service iptables restart
/usr/program/nexus2.11.4/bin/nexus start
tail -200f /usr/program/nexus2.11.4/logs/wrapper.log
/usr/program/nexus2.11.4/bin/nexus stop
vim /usr/program/nexus2.11.4/conf/nexus.properties
,修改該值:application-port=8081False
改為 True
<repositories>
<repository>
<id>Nexus</id>
<name>虛擬機-192.168.0.110-Nexus</name>
<url>http://192.168.0.110:8081/nexus/content/groups/public/</url>
</repository>
</repositories>
<mirrors>
<mirror>
<id>YouMeekNexus</id>
<name>YouMeek Nexus</name>
<mirrorOf>*</mirrorOf>
<url>http://192.168.0.110:8081/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<!--設置私庫認證信息,用戶名和密碼我就用默認的,如果你們有權限控制的需求可以創(chuàng)建對應的一些賬號-->
<servers>
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<!-- nexus-releases nexus-snapshots 與 Maven 的配置文件 settings.xml 中 server 下的 id 對應 -->
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Releases Repository</name>
<url>http://192.168.0.110:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshots Repository</name>
<url>http://192.168.0.110:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
/usr/program/nexus2.11.4/bin/nexus stop
cd /opt/sonatype-work/nexus/indexer/central-ctx
rm -rf *
wget http://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.gz
wget http://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.properties
wget https://repo1.maven.org/maven2/org/apache/maven/indexer/indexer-cli/5.1.1/indexer-cli-5.1.1.jar
java -jar indexer-cli-5.1.0.jar -u nexus-maven-repository-index.gz -d ./
rm -rf indexer-cli-5.1.0.jar nexus-maven-repository-index.gz nexus-maven-repository-index.properties
/usr/program/nexus2.11.4/bin/nexus start