准备条件
环境必须安装了jdk且设置了环境变量。
1.登录root用户创建nexus用户
[root@localhost ~]# useradd nexus
[root@localhost ~]# passwd nexus
更改用户 nexus 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@localhost ~]#
2.登录nexus用户安装
上传安装包:
nexus-2.12.0-01-bundle.zip
解压安装包:
unzip nexus-2.12.0-01-bundle.zip
创建软连接:
ln -s nexus-2.12.0-01 nexus
3.配置
编辑nexus文件,修改NEXUS_HOME为自己的安装地址,修改运行使用用户名称
# Set this to the root of the Nexus installation
#NEXUS_HOME=".."
NEXUS_HOME="/home/nexus/nexus-2.12.0-01"
# If specified, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write into the Nexus installation directory.
# NOTE - This will set the user which is used to run the Wrapper as well as
# the JVM and is not useful in situations where a privileged resource or
# port needs to be allocated prior to the user being changed.
#RUN_AS_USER=
RUN_AS_USER=nexus
# Application
APP_NAME="nexus"
APP_LONG_NAME="Nexus OSS"
在conf目录下nexus.properties文件中修改nexus对外端口以及对外主机地址
# Jetty section
application-port=9001
application-host=192.168.1.187
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus
application-port-ssl=8443
# Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF
修改文件 /bin/nexus,增加如下代码
RUN_AS_USER=nexus
启动nexus
bin/nexus start