centos6.5下架设maven仓库

分类:CentOS运维 阅读:75032 次

安装说明

安装方式:自下压缩包

附上我自己的安装包地址:

链接: http://pan.baidu.com/s/1c0ucQuG 密码: 3ssh

压缩包:apache-maven-3.3.3-bin.tar.gz,nexus-2.11.1-01-bundle.tar.gz

1.先安装java环境,如已安装直接跳过

[root@localhost opt]# yum list installed |grep java

[root@localhost opt]# yum -y remove java-1.7.0-openjdk*

[root@localhost opt]# yum -y remove tzdata-java.noarch

上面是 先检测是否有安装java环境包,然后卸载掉 重新安装

[root@localhost opt]# yum -y list java*

[root@localhost opt]# yum -y install java-1.7.0-openjdk*===>开始安装

[root@localhost opt]# java -version===>查询是否安装好
java version "1.7.0_85"
OpenJDK Runtime Environment (rhel-2.6.1.3.el6_7-x86_64 u85-b01)
OpenJDK 64-Bit Server VM (build 24.85-b03, mixed mode)

2.下载apache-maven-3.3.3-bin.tar.gz,nexus-2.11.1-01-bundle.tar.gz

[root@localhost opt]# cd /opt/

[root@localhost opt]# ls
apache-maven-3.3.3-bin.tar.gz nexus-2.11.1-01-bundle.tar.gz

[root@localhost opt]# tar zxvf apache-maven-3.3.3-bin.tar.gz

[root@localhost opt]# tar zxvf nexus-2.11.1-01-bundle.tar.gz

3.配置环境变量,编辑/etc/profile文件,

[root@localhost opt]# vi /etc/profile

添加如下代码:

MAVEN_HOME=/opt/apache-maven-3.3.3
export MAVEN_HOME
export PATH=${PATH}:${MAVEN_HOME}/bin

4.验证maven安装配置是否成功,首先加载环境变量的配置。执行maven命令查看版本信息。如果查看成功,那么maven的安装已经成功,剩下来只需要搭建maven仓库了。

[root@localhost ~]# source /etc/profile ===>加完后更新一下

[root@localhost ~]# mvn -v ===>安装成功
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T07:57:37-04:00)
Maven home: /opt/apache-maven-3.3.3
Java version: 1.7.0_85, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"

5.启动nexus

[root@localhost bin]# cd /opt/nexus-2.11.1-01/bin/ ===>进入/opt/nexus-2.11.1-01/bin/目录下

[root@localhost bin]# vi nexus ===>修改下配置

找到#RUN_AS_USER= ,把#去掉,后面添加你的账户 root

[root@localhost bin]# ./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.

service iptables stop===>停止防火墙

6.打开nexus进去配置

打开浏览器输入:http://host_address:8081/nexus。默认的用户名/密码:admin/admin123

如果有开启防火墙 则要去配置一下,我这边已经关闭了