一、下载 Nexus:
cd /usr/local/src
wget http://download.sonatype.com/nexus/oss/nexus-xxxx-bundle.tar.gz
二、安装配置授权
cd /var/app/
sudo cp nexus-xxxx-bundle.tar.gz /var/app/
cd /var/app/
sudo tar xvzf nexus-xxxx-bundle.tar.gz
ln -s nexus-xxxx nexus
cp nexus/bin/nexus /etc/init.d/nexus
cd /etc/init.d
chmod 755 /etc/init.d/nexus
三、配置/etc/init.d/nexus:
vi /etc/init.d/nexus (修改如下变量)
示例:
# Set this to the root of the Nexus installation
NEXUS_HOME="/var/app/nexus-XXX"(不配置使用默认也可以)
# 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=nexus (指定一个系统普通用户、启动使用普通用户启动)
示例:
配置/usr/local/nexus/conf/nexus.properties
vi /usr/local/nexus/conf/nexus.properties
示例:
# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/
# Nexus section
nexus-work=${bundleBasedir}/sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF
示例:
配置/var/app/nexus-xxxx权限
chown -R nexus:nexus /usr/local/nexus
备份仓库:将sonatype-work文件夹整体备份即可,也可以选择只备份最重要的两个文件夹索引(indexer)和仓库(storage)
还原仓库:将备份好的sonatype-work文件拷贝到新的服务器中。然后修改nexus/conf/nexus.properties配置文件,重新指定仓库的目录。