java install
1 | [root@localhost app]# tar xzf jdk-8u111-linux-x64.tar.gz |
maven install
1 | [root@localhost app]# tar xzf apache-maven-3.3.9-bin.tar.gz |
nexus install
创建用户
1
2[root@localhost ~]# useradd nexus
[root@localhost ~]# echo 'cMaxj(^s7:do! | passwd --stdin nexusnexus 安装
1
2
3
4
5
6[root@localhost ~]# tar xzf nexus-3.1.0-04-unix.tar.gz
[root@localhost ~]# mv nexus-3.1.0-04 /mnt/app/nexus
[root@localhost ~]# echo 'export NEXUS_HOME=/mnt/app/nexus' | tee /etc/profile.d/nexus.sh
[root@localhost ~]# echo 'export NEXUS_BIN=${NEXUS_HOME}/bin' | tee -a /etc/profile.d/nexus.sh
[root@localhost ~]# echo 'export PATH=${NEXUS_BIN}:$PATH' | tee -a /etc/profile.d/nexus.sh
[root@localhost ~]# source /etc/profilenexus 修改配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31[root@localhost ~]# vim /mnt/app/nexus/etc/nexus-default.properties
# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/
# Nexus section
nexus-edition=nexus-pro-edition
nexus-features=\
nexus-pro-feature
[root@localhost ~]# vim /mnt/app/nexus/bin/nexus.rc
run_as_user="nexus"
[root@localhost ~]# vim /mnt/app/nexus/bin/nexus.vmoptions
-Xms1200M
-Xmx1200M
-XX:MaxDirectMemorySize=2G
-XX:+HeapDumpOnOutOfMemoryError
-XX:+UnlockDiagnosticVMOptions
-XX:+UnsyncloadClass
-XX:+LogVMOutput
-XX:LogFile=/mnt/log/nexus/nexus.log
-Djava.net.preferIPv4Stack=true
-Dkaraf.home=.
-Dkaraf.base=.
-Dkaraf.etc=etc/karaf
-Djava.util.logging.config.file=etc/karaf/java.util.logging.properties
-Dkaraf.data=/mnt/data/nexus
-Djava.io.tmpdir=/mnt/data/nexus/tmp
-Dkaraf.startLocalConsole=falsenexus 创建日志和数据目录,并修改文件属性
1
2
3[root@localhost ~]# mkdir -p /mnt/{data,log}/nexus
[root@localhost ~]# mkdir -p /mnt/data/nexus/tmp
[root@localhost ~]# chown -R nexus.nexus /mnt/{app,data,log}/nexusnexus 启动
1
2
3
4[root@localhost ~]# su - nexus
[nexus@localhost ~]$ /mnt/app/nexus/bin/nexus start
[nexus@localhost ~]$ /mnt/app/nexus/bin/nexus stop
[nexus@localhost ~]$ /mnt/app/nexus/bin/nexus statusnexus 加入开机启动项
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23方式一:
[root@localhost ~]# vim /etc/rc.local
su nexus -c "/mnt/app/nexus/bin/nexus start"
方式二:
[root@localhost ~]# vim /usr/lib/systemd/system/nexus.service
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
ExecStart=/mnt/app/nexus/bin/nexus start
ExecStop=/mnt/app/nexus/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl enable nexus
[root@localhost ~]# systemctl start nexus通过浏览器打开
1
2
3http://192.168.10.75:8081
默认密码: admin/admin123