1、添加Maven源,以后如果报错的话,虚拟机里有拷贝一份,360云盘也有

wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo

yum -y install apache-maven

mvn -version   检查是否安装完成

还需要安装java 没有安装的话,看前面文档

2、安装NEXUS

下载地址: http://www.sonatype.org/downloads

#tar zxvf  nexus-latest-bundle.tar.gz

解压后会出现2个目录nexus-2.8.1-01和 sonatype-work

因为NEXUS不推荐使用root用户来启动,所以新建用户sonata,并把生成的2个目录的用户和组都改为sonata。

#mv nexus-2.8.1-01 nexus

#chown sonata:sonata -R nexus

#chown sonata:sonata -R sonatype-work

这样就可以启动nexus(手动方式)

# su sonata

$/opt/nexus/bin/nexus start

Starting Nexus OSS...
Started Nexus OSS.

3、配置开机启动

#vi /usr/lib/systemd/system/nexus.service


[Unit]
Description=Nexus
Documentation=http://www.sonatype.org/nexus/resources/resources-book-links-and-downloads/
after=network.target
After=syslog.target

[Service]

User=sonata
Group=sonata


Type=forking
ExecStart=/opt/nexus/bin/nexus start    ----实际路径为准
ExecReload=/opt/nexus/bin/nexus restart ----实际路径为准
ExecStop==/opt/nexus/bin/nexus stop ----实际路径为准
PrivateTmp=true

[Install]
WantedBy=multi-user.target

-------------------------------------------------------

# chmod 644 nexus.service
# systemctl enable nexus.service

#systemctl start nexus.service

4、现在就可以从客户端访问nexus

http://192.135.9.23:8081/nexus/#welcome

登陆用户名和密码为:admin/admin123