1. Install JDK
1.1 Download the JDK1.8 installation package jdk-8u121-linux-x64.tar.gz from the Java official website;
1.2 Create a jdk folder under /usr/local and upload jdk-8u121-linux-x64.tar.gz to /usr/local/jdk
$: cd /usr/local
$: mkdir jdk
1.3 Unzip jdk-8u121-linux-x64.tar.gz
$: cd /usr/local/jdk
$: tar -zxvf jdk-8u121-linux-x64.tar.gz -C /usr/local/jdk
1.4 Configure java environment variables
$: vi /etc/profile
// 在文件的最后添加如下内容
export JAVA_HOME=/usr/local/jdk/jdk1.8.0_121
export PATH=${JAVA_HOME}/bin:$PATH
$: source /etc/profile
1.5 Check whether the jdk installation is successful
$: java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
2. Install Nexus
2.1 Download Nexus, official website download address: http://www.sonatype.org/nexus/go/
This article uses the 3.x version: nexus-3.6.2-01-unix.tar.gz
Upload the installation package to /usr/local/src/nexus
$: cd /usr/local/src/nexus
$: tar -zxvf nexus-3.6.2-01-unix.tar.gz
2.2 Modify nexus.rc
$: cd /usr/local/src/nexus/nexus-3.6.2-01/bin
$: vi nexus.rc
// 修改参数如下
run_as_user="root" # 把前面的#删除
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 # 禁用掉防火墙
as the picture shows:
2.4 Modify the number of file handles
$: vi /etc/security/limits.conf
//在文件末尾添加如下参数
* - nofile 65536
// 重启服务器
$: reboot
Add the number of handles as shown in the figure:
2.5 Start Nexus
$: cd /usr/local/src/nexus/nexus-3.6.2-01/bin
$: ./nexus start
Related commands:
$: cd /usr/local/src/nexus/nexus-3.6.2-01/bin
$: ./nexus start # 启动Nexus
$: ./nexus stop # 关闭Nexus
$: ./nexus restart # 重启Nexus
$: ./nexus status # 查看Nexus状态
2.6 Open the browser and log in to Nexus
URL: http://192.168.1.XXX:8081/
Default username: admin, default password: admin123