centos搭建nexus 原创

2017-09-14 20:35

一、环境

本文环境: 阿里云centos6.5,JDK1.7

使用版本:maven 3.3.9    nexus 2.1.2

二、安装MAVEN

2.1 下载

root用户下:

root>mkdir /opt/downloads

root>cd /opt/dowloads

root>wget https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz


2.2 解压安装包

root>tar -zxvf /opt/downlowds/apache-maven-3.3.9-bin.tar.gz -C /usr/local
 
 
 2.3 配置环境变量
1. 编辑/etc/profile,在末尾添加如下: 

export M2_HOME=/usr/local/apache-maven-3.3.9

export PATH=$PATH:$M2_HOME/bin

#保存退出,执行以下命令使生效:
root>source /etc/profile

#查看是否生效

root>mvn -version

blob.png


3 安装Nexus


3.1 下载

root用户下:

root>mkdir /opt/downloads

root>cd /opt/dowloads

root>wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.1.2-bundle.tar.gz

  

3.2 解压安装包

root>tar -zxvf /opt/downlowds/nexus-2.1.2-bundle.tar.gz -C /usr/local

#nexus安装在/usr/local目录下。 
可以编辑$NEXUS_HOME/conf/nexus.properties设置参数如端口号。

3.3.创建用户

root>su -l

root>adduser nexus

#更改用户密码 

root>passwd nexus
新的 密码:
无效的密码: 密码未通过字典检查 - 过于简单化/系统化
重新输入新的 密码:nexus123:所有的身份验证令牌已经成功更新。

3.4 设置nexus为Linux系统的服务,并开机自动启动

1.复制$NEXUS_HOME/bin/jsw/linux-x86-64/nexus 到/etc/init.d/nexus

root>cp /usr/local/nexus-2.1.2/bin/jsw/linux-x86-64/nexus /etc/init.d/nexus

2. 授于nexus脚本有可执行的权限:

root>chmod 755 /etc/init.d/nexus

3.授予文件读写权限

root>chmod -R o+w {nexus-home}/ 

root>chmod -R o+w /usr/local/sonartype-work/

3.5 修改nexus文件,配置以下参数:

NEXUS_HOME="/usr/local/nexus-2.1.2"

RUN_AS_USER=nexus(或其它用户,前提是创建了此用户,但不建议root用户。)

PLATFORM=linux--x86-64

PLATFORM_DIR="${NEXUS_HOME}/bin/jsw/${PLATFORM}"

WRAPPER_CMD="${PLATFORM_DIR}/wrapper"

WRAPPER_CONF="${PLATFORM_DIR}/../conf/wrapper.conf"

PIDDIR="${NEXUS_HOME}"


3.6. Red Hat, Fedora,  CentOS增加nexus服务:

root>cd /etc/init.d

root>chkconfig --add nexus

root>chkconfig --levels 345 nexus on

root>service nexus start

root>vi /usr/local/nexus-2.1.2/logs/wrapper.log


附:

Ubuntu,Debian增加nexus服务

root>cd /etc/init.d

root>update-rc.d nexus defaults

root>chkconfig --levels 345 nexus on

root>service nexus start

root>vi /usr/local/nexus-2.1.2/logs/wrapper.log



3.7直接启动

root>su nexus

nexus>cd /usr/local/nexus-2.1.2/bin

nexus>./nexus start

 启动完成后,访问: http://localhost:8081/nexus(localhost为你的服务器地址),进入系统进行设置

默认管理账号:admin 密码:admin123

blob.png



 版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出处、作者信息和本声明,否则将追究法律责任。https://m.blog.kokojia.com/yyls/b-451.html

阅读 11945 / 评论 0

 相关视频教程更多课程