[root@MiWiFi-R3-srv ~]# rpm -qa | grep java
[root@MiWiFi-R3-srv ~]# rpm -e –nodeps
用scp命令:scp file_name 用戶@用戶Ip:/usr/local,而後解壓tar -xvf jdk1.8java
vim /etc/profilenode
在/etc/profile文件的末尾加上如下配置:linux
JAVA_HOME=/usr/local/java/jdk1.8.0_144 JRE_HOME=/usr/local/java/jdk1.8.0_144/jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export JAVA_HOME JRE_HOME PATH CLASSPATH
使修改後的/etc/profile文件當即生效:apache
[root@MiWiFi-R3-srv java]# source /etc/profile
[root@MiWiFi-R3-srv java]# java -version java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) [root@MiWiFi-R3-srv java]#
[root@MiWiFi-R3-srv ~]# mkdir /usr/local/maven
[root@MiWiFi-R3-srv ~]# vim /etc/profile
在/etc/profile末端添加以下兩行:vim
export M2_HOME=/usr/local/maven/apache-maven-3.3.9 #具體看你本身下載的路徑多少 export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$M2_HOME/bin:$PATH
執行source /etc/profile命令,使其當即生效bash
[root@MiWiFi-R3-srv ~]# source /etc/profile
[root@MiWiFi-R3-srv ~]# mvn -v Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00) Maven home: /usr/local/maven/apache-maven-3.5.0 Java version: 1.8.0_144, vendor: Oracle Corporation Java home: /usr/local/java/jdk1.8.0_144/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-327.el7.x86_64", arch: "amd64", family: "unix"
[root@MiWiFi-R3-srv ~]# tar -zxvf nexus-3.6.0-02-unix.tar.gz -C /usr/local/
[root@MiWiFi-R3-srv ~]# cd /usr/local/nexus-3.6.0-02/bin/ [root@MiWiFi-R3-srv ~]# ./nexus run &
當出現如下日誌的時候表示啓動成功!app
------------------------------------------------- Started Sonatype Nexus OSS 3.6.0-02 -------------------------------------------------
[root@MiWiFi-R3-srv bin]# firewall-cmd --zone=public --add-port=8081/tcp --permanent [root@MiWiFi-R3-srv bin]# firewall-cmd --reload
默認用戶名以及密碼:admin/admin123jvm
建立服務maven
[root@MiWiFi-R3-srv ~]# vim /usr/lib/systemd/system/nexus.service
填入相關內容tcp
[Unit] Description=nexus service [Service] Type=forking LimitNOFILE=65536 #警告處理 ExecStart=/usr/local/nexus/nexus-3.7.1-02/bin/nexus start ExecReload=/usr/local/nexus/nexus-3.7.1-02/bin/nexus restart ExecStop=/usr/local/nexus/nexus-3.7.1-02/bin/nexus stop Restart=on-failure [Install] WantedBy=multi-user.target
將服務加入開機啓動
[root@MiWiFi-R3-srv ~]# systemctl enable nexus.service
從新加載配置文件
[root@MiWiFi-R3-srv ~]# systemctl daemon-reload
[root@MiWiFi-R3-srv bin]# vim /usr/local/nexus/bin/nexus.rc
run_as_user="root"
[root@MiWiFi-R3-srv bin]# vim /usr/local/nexus/bin/nexus
INSTALL4J_JAVA_HOME_OVERRIDE=/usr/local/java/jdk1.8.0_144
[root@MiWiFi-R3-srv etc]# cd /usr/local/nexus-3.6.0-02/etc/ [root@MiWiFi-R3-srv etc]# vim nexus-default.properties
application-port=8081
[root@MiWiFi-R3-srv bin]# cd /usr/local/nexus-3.6.0-02/bin/ [root@MiWiFi-R3-srv bin]# vim nexus.vmoptions
-XX:LogFile=./sonatype-work/nexus3/log/jvm.log -Dkaraf.data=./sonatype-work/nexus3 -Djava.io.tmpdir=./sonatype-work/nexus3/tmp
<mirrors> <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://192.168.1.11:8081/repository/maven-public/</url> </mirror> </mirrors>