1、準備一臺Linux主機 html
IP:192.168.1.165 java
一、開SSH linux
systemctl enable sshd web
二、關閉SELINUX 瀏覽器
vi /etc/sysconfig/selinux 緩存
修改下邊紅字部分 服務器
# This file controls the state of SELinux on the system. oracle
# SELINUX= can take one of these three values: app
# enforcing - SELinux security policy is enforced. ssh
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
三、安裝rz
yum -y install lrzsz
以後上傳文件必定要用-be參數(其中-b是--binary用二進制的方式上傳,-e是--escape強制escape全部控制字符),不然上傳的文件不完整
rz –be
四、安裝wget
yum -y install wget
五、更換yum源,用於提速yum
(1)備份yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
(2)下載新的CentOS-Base.repo 到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
清理緩存
yum clean all
從新生成緩存
yum makecache
六、用firewalld開80端口
firewall-cmd --permanent --add-service=http
systemctl reload firewalld
2、安裝Nexus
一、安裝JDK1.8
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
下載rpm包傳到服務器上,用rpm命令安裝
rpm -ivh jdk-8u191-linux-x64.rpm
增長Java環境變量
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_191-amd64
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export RUN_AS_USER=root
使環境變量生效
source /etc/profile
查看java版本
java -version
二、下載並安裝Nexus
官網下載地址:https://www.sonatype.com/download-oss-sonatype
解壓nexus-3.14.0-04-unix.tar.gz
tar -zxvf nexus-3.14.0-04-unix.tar.gz
將nexus-3.14.0-04更名nexus,且將nexus和sonatype-work目錄移動到/usr/local/目錄下
mv nexus-3.14.0-04 nexus
mv nexus /usr/local/
mv sonatype-work /usr/local/
編輯nexus.rc,修改運行nexus3所使用的用戶
cd /usr/local/nexus/bin
vi nexus.rc
修改成
run_as_user="root"
編輯nexus,修改nexus3啓動時要使用的jdk版本
vi nexus
修改成
INSTALL4J_JAVA_HOME_OVERRIDE=/usr/java/jdk1.8.0_191-amd64
修改nexus-default.properties
cd /usr/local/nexus/etc
vi nexus-default.properties
修改nexus3默認端口
application-port=80
關閉佔用80端口的httpd服務
systemctl stop httpd
systemctl disable httpd
nexus3數據以及相關日誌的存儲位置能夠修改bin目錄下的nexus.vmoptions
把nexus3加入到系統服務,使之可以開機自啓動:
ln -s /usr/local/nexus/bin/nexus /etc/init.d/nexus
cd /etc/init.d
chkconfig --add nexus
chkconfig --levels 345 nexus on
systemctl start nexus
systemctl status nexus
內置啓動和中止方法:
/usr/local/nexus/bin/nexus start
/usr/local/nexus/bin/nexus stop
3、配置Nexus
一、在瀏覽器輸入http://192.168.1.165
PS:nexus服務啓動成功後,須要稍等一段時間,端口才起來
默認帳號和密碼:admin admin123
能夠在右上角查看帳戶登陸狀態
二、配置LDAP(略)
三、新建普通用戶規則
點擊左側Security-Roles按鈕
點擊"Create role-Nexus role"按鈕
Role ID:nx-user
Role name:nx-user
Rrivlieges:nx-repository-view-*-*-*、nx-search-read #容許私服倉庫任何操做
建立成功
以後能夠在Users中爲LDAP帳號賦予對應的權限
四、添加公司內部倉庫
點擊左側Repositories按鈕
說明:
(1)name列
maven-central:maven中央庫,默認從https://repo1.maven.org/maven2/拉取jar
maven-releases:私庫發行版jar
maven-snapshots:私庫快照(調試版本)jar
maven-public:倉庫分組,把上面三個倉庫組合在一塊兒對外提供服務,在本地maven基礎配置settings.xml中使用。
(2)type列(Nexus默認的倉庫類型有如下四種):
group(倉庫組類型):又叫組倉庫,用於方便開發人員本身設定的倉庫;
hosted(宿主類型):內部項目的發佈倉庫(內部開發人員,發佈上去存放的倉庫);
proxy(代理類型):從遠程中央倉庫中尋找數據的倉庫(能夠點擊對應的倉庫的Configuration頁簽下Remote Storage Location屬性的值即被代理的遠程倉庫的路徑);
virtual(虛擬類型):虛擬倉庫(這個基本用不到,重點關注上面三個倉庫的使用);
點擊"Create Repositories"按鈕,再選擇maven2(hosted)
Name:xxxx-releases #自定義
Version policy:Release # Releases: 通常是已經發布的Jar包,Snapshot: 未發佈的版本,Mixed:混合的
Deployment Pollcy:Allow redeploy
其餘默認
xxxx-snapshots建立方法同樣
最後記得取消Anonymous裏邊Allow anonymous users to access the server的勾,這樣不登陸看不到任何庫文件
問題1:
web頁面最上邊提示:System Requirement: max file descriptors [4096] likely too low, Increase to at least [65536]
操做系統文件描述符過低,建議改爲65536
vi /etc/security/limits.conf
添加
* soft nofile 65536
* hard nofile 65536
注意value不能查過/proc/ysy/fs/nr_open的值,不然不能登陸操做系統