今天项目经理叫搭个nexus私服,记录一下
nexus下载比较慢,可在本地下载,然后用sftp上传到linux系统去,下载地址https://www.sonatype.com/download-oss-sonatype
1解压后(我解压到/usr/local/nexux下),进入nexus_home/bin,vi nexus,修改两处地方NEXUS_HOME,RUN_AS_USER
# Set this to the root of the Nexus installation NEXUS_HOME=/usr/local/nexus # 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=root
2修改NEXUS_HOME/bin/jsw/conf/wrapper.conf的java路径
# Set the JVM executable # (modify this to absolute path if you need a Java that is not on the OS path) wrapper.java.command=/usr/local/jdk8/bin/java#jdk安装路径
3复制/bin/nexus到/etc/init.d/nexusd,并加入服务和开机启动
cp /usr/local/nexus/bin/nexus /ect/init.d/nexusd chmod 755 /etc/init.d/nexusd chown root /etc/init.d/nexusd chkconfig --add nexusd chkconfig --levels 345 nexusd on service nexus start
4默认8081端口,如有防火墙,加入例外
firewall-cmd --zone=public --add-port=8081/tcp --permanent firewall-cmd --reload
5访问http://ip:8081/nexus
jar包会下载到sonatype-work/nexus/storage/central目录下,也可以把已有包上传到这个目录