linux设置nexus开机自启动_linux安装nexus(支持jdk1.7)并设置开机启动
版本:nexus-2.6.4-02-bundle
這個(gè)版本jdk需要1.7或以上
注:nexus 2.6版本之后不再支持jdk1.6
nexus 2.5.x nexus最后一個(gè)支持jdk1.6版本的
1創(chuàng)建安裝目錄
[root@xiniu maven]# mkdir -p /usr/java/nexus
2上傳文件
3解壓縮
[root@xiniu nexus]# ls
nexus-2.6.4-02-bundle.zip
[root@xiniu nexus]# unzip nexus-2.6.4-02-bundle.zip
4為了方便更新和切換版本,創(chuàng)建鏈接,更新或者切換版本只需更新鏈接即可:
[root@xiniu nexus]# ln -s nexus-2.6.4-02 nexus
5 修改配置文件
[root@xiniu bin]# cd /usr/java/nexus/nexus/conf
[root@xiniu conf]# ls
examples jetty.xml logback.xml nexus.properties
[root@xiniu conf]# vi nexus.properties
修改內(nèi)容
#Jetty section
application-port=8081 ##修改Jetty端口號
# nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
6 配置用戶
[root@xiniu conf]# vi /usr/java/nexus/nexus/bin/nexus
使用/查詢字符串 ,使用n查詢下一個(gè)
修改內(nèi)容
#RUN_AS_USER=
RUN_AS_USER=root
7若有設(shè)置防火墻,需前往修改防火墻配置并重啟防火墻
centos7.3關(guān)閉防火墻
關(guān)閉firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開機(jī)啟動(dòng)
firewall-cmd --state #查看默認(rèn)防火墻狀態(tài)(關(guān)閉后顯示notrunning,開啟后顯示running)
[root@xiniu ~]# systemctl stop firewalld.service
[root@xiniu ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@xiniu ~]# firewall-cmd --state
not running
8 啟動(dòng)nexus
[root@xiniu /]# cd /usr/java/nexus/nexus/bin
[root@xiniu bin]# ./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.
9在瀏覽器打開:http://ip:8081/nexus,登錄:用戶名admin 默認(rèn)密碼:admin123
10
11
12
設(shè)置開機(jī)啟動(dòng)
1、
進(jìn)入到/etc/init.d目錄下,新建一個(gè)nexus腳本
cd /etc/init.d
vi nexus
內(nèi)容
#!/bin/bash
#chkconfig:2345 20 90
#description:nexus
#processname:nexus
export JAVA_HOME=/usr/java/jdk1.7.0_79
case $1 in
start) su root /usr/java/nexus/nexus/bin/nexus start;;
stop) su root /usr/java/nexus/nexus/bin/nexus stop;;
status) su root /usr/java/nexus/nexus/bin/nexus status;;
restart) su root /usr/java/nexus/nexus/bin/nexus restart;;
dump ) su root /usr/java/nexus/nexus/bin/nexus dump ;;
console ) su root /usr/java/nexus/nexus/bin/nexus console ;;
*) echo "require console | start | stop | restart | status | dump " ;;
esac
2
給腳本添加執(zhí)行權(quán)限
chmod +x nexus
3 添加系統(tǒng)服務(wù)
#chkconfig --add nexus
#chkconfig --levels 345 nexus on
4.查看開機(jī)自啟的服務(wù)中是否已經(jīng)有我們的nexus
[root@localhost init.d]# chkconfig --list nexus
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
nexus 0:off 1:off 2:on 3:on 4:on 5:on 6:off
與50位技術(shù)專家面對面20年技術(shù)見證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的linux设置nexus开机自启动_linux安装nexus(支持jdk1.7)并设置开机启动的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 狄利克雷卷积_一些狄利克雷卷积性质的证明
- 下一篇: linux 其他常用命令