1.安裝JDKjava
1.1 在Java官網下載JDK1.7安裝包jdk-7u80-linux-x64.tar.gz;linux
1.2 在/usr/local下建立jdk文件夾,將jdk-7u80-linux-x64.tar.gz上傳至/usr/local/jdk瀏覽器
$: cd /usr/local $: mkdir jdk
1.3 解壓jdk-7u80-linux-x64.tar.gztcp
$: cd /usr/local/jdk $: tar -zxvf jdk-7u80-linux-x64.tar.gz -C /usr/local/jdk
1.4 配置java環境變量ui
$: vi /etc/profile // 在文件的最後添加以下內容 export JAVA_HOME=/usr/local/jdk/jdk1.7.0_80 export PATH=${JAVA_HOME}/bin:$PATH $: source /etc/profile
1.5 檢查jdk安裝是否成功.net
$: 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.安裝Nexusrest
2.1 下載Nexus,官網下載地址:http://www.sonatype.org/nexus/go/code
本文是在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 編輯 Nexus 的 nexus 文件ip
$: 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 打開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 啓動Nexus
$: cd /usr/local/nexus/nexus-2.11.2-03/bin $: ./nexus start
若是要關閉重啓nexus,先找到nexus,在殺死進程,再次開啓nexus便可
$: ps -ef | grep nexus 找到nexus的id號 $: kill -9 47692 # 47692是nexus的id $: ./nexus start
2.5 打開瀏覽器登陸Nexus
網址:網址爲安裝Nexus的主機IP+8081端口+nexus,如http://192.168.1.XXX:8081/nexus
默認用戶名:admin,默認密碼:admin123