1. Install JDK
1.1 Download the JDK1.7 installation package jdk-7u80-linux-x64.tar.gz from the Java official website;
1.2 Create a jdk folder under /usr/local and upload jdk-7u80-linux-x64.tar.gz to /usr/local/jdk
$: cd /usr/local
$: mkdir jdk
1.3 Unzip jdk-7u80-linux-x64.tar.gz
$: cd /usr/local/jdk
$: tar -zxvf jdk-7u80-linux-x64.tar.gz -C /usr/local/jdk
1.4 Configure java environment variables
$: vi /etc/profile
// 在文件的最后添加如下内容
export JAVA_HOME=/usr/local/jdk/jdk1.7.0_80
export PATH=${JAVA_HOME}/bin:$PATH
$: source /etc/profile
1.5 Check whether the jdk installation is successful
$: java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
2. Install Nexus
2.1 Download Nexus, official website download address: http://www.sonatype.org/nexus/go/
This article is downloaded directly in Linux:
$: mkdir /usr/local/nexus
$: cd /usr/local/nexus
$: wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.11.2-03-bundle.tar.gz
$: tar -zxvf nexus-2.11.2-03-bundle.tar.gz -C /usr/local/nexus/
2.2 Edit Nexus nexus file
$: vi /usr/local/nexus/nexus-2.11.2-03/bin/nexus
// 修改如下参数
NEXUS_HOME="/usr/local/nexus/nexus-2.11.2-03"
RUN_AS_USER=root # 把RUN_AS_USER前面的#号删除
2.3 Open port 8081
$: vi /etc/sysconfig/iptables
// 添加如下参数
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT
$: service iptables restart
$: service iptables stop
$: chkconfig iptables off # 禁用掉防火墙
2.4 Start Nexus
$: cd /usr/local/nexus/nexus-2.11.2-03/bin
$: ./nexus start
If you want to close and restart nexus, first find nexus, kill the process, and open nexus again.
$: ps -ef | grep nexus
找到nexus的id号
$: kill -9 47692 # 47692是nexus的id
$: ./nexus start
2.5 Open the browser and log in to Nexus
URL: The URL is the host IP+8081 port+nexus where Nexus is installed, such as http://192.168.1.XXX:8081/nexus
Default username: admin, default password: admin123