CentOS7上搭建Maven服务器

1. 安装Java

#yum install java

#java -version

 

2. 安装Maven

#yum install maven

# mvn -version
Apache Maven 3.0.5 (Red Hat 3.0.5-16)
Maven home: /usr/share/maven
java version: 1.7.0_101, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.101-2.6.6.1.el7_2.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-229.el7.x86_64", arch: "amd64", family: "unix"

3.安装NEXUS

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

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

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

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

#mv nexus-2.8.1-01 nexus

#chown nexadmin:nexadmin -R nexus

#chown nexadmin:nexadmin -R sonatype-work

这样就可以启动nexus

 

# su nexadmin

$/opt/nexus/bin/nexus start

Starting Nexus OSS...
Started Nexus OSS.
 

也可以 添加Nexus为系统服务

#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=nexadmin
Group=nexadmin


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
Created symlink from /etc/systemd/system/multi-user.target.wants/nexus.service to /usr/lib/systemd/system/nexus.service.

#systemctl start nexus.service

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

http://192.168.1.20:8081/nexus/#welcome

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

赞 (0) 评论 分享 ()