日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

nexus3私库环境搭建(maven,yum,apt,nodejs)

發(fā)布時(shí)間:2024/8/1 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nexus3私库环境搭建(maven,yum,apt,nodejs) 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

目錄

  • 一.nexus3私庫(kù)環(huán)境搭建(maven,yum,apt,nodejs)
    • 1.jdk安裝
    • 2.nexus軟件安裝
    • 3.修改配置
    • 4.啟動(dòng),重啟,停止
    • 5.訪問(wèn)測(cè)試
  • 二、maven,yum,apt,docker,npm私庫(kù)搭建
  • 3.私庫(kù)使用
    • Yum私庫(kù)
    • apt私庫(kù):
    • npm庫(kù):


一.nexus3私庫(kù)環(huán)境搭建(maven,yum,apt,nodejs)

Nexus3是一個(gè)倉(cāng)庫(kù)管理器,它極大地簡(jiǎn)化了本地內(nèi)部倉(cāng)庫(kù)的維護(hù)和外部倉(cāng)庫(kù)的訪問(wèn),平常我們?cè)讷@取maven倉(cāng)庫(kù)資源的時(shí)候,都是從maven的官方(或者國(guó)內(nèi)的鏡像)獲取,但假如你的生產(chǎn)環(huán)境的服務(wù)器無(wú)互聯(lián)網(wǎng)訪問(wèn)權(quán)限,此時(shí)需要在局域網(wǎng)一個(gè)有互聯(lián)網(wǎng)訪問(wèn)權(quán)限的服務(wù)器上搭建一個(gè)私有的倉(cāng)庫(kù),這樣其他有互聯(lián)網(wǎng)訪問(wèn)權(quán)限的服務(wù)器可以通過(guò)已搭建的私庫(kù)倉(cāng)庫(kù)來(lái)下載安裝如Maven、apt、yum、gradle、pypi、docker等等,就像是直接通過(guò)互聯(lián)網(wǎng)下載一樣。

Nexus支持:
Nexus在代理遠(yuǎn)程倉(cāng)庫(kù)的同時(shí)維護(hù)本地倉(cāng)庫(kù),以降低中央倉(cāng)庫(kù)的負(fù)荷,節(jié)省外網(wǎng)帶寬和時(shí)間,Nexus私服就可以滿足這樣的需要。
Nexus是一套“開(kāi)箱即用”的系統(tǒng)不需要數(shù)據(jù)庫(kù),它使用文件系統(tǒng)加Lucene來(lái)組織數(shù)據(jù)。
Nexus支持WebDAV與LDAP安全身份認(rèn)證。
Nexus還提供了強(qiáng)大的倉(cāng)庫(kù)管理功能,構(gòu)件搜索功能,基于REST,占用較少的內(nèi)存,基于簡(jiǎn)單文件系統(tǒng)而非數(shù)據(jù)庫(kù)。

1.jdk安裝

nexus3是由Java開(kāi)發(fā)的,需要先安裝好Jdk

準(zhǔn)備好jdk-8u191-linux-x64.tar.gz########解壓到/usr/local目錄下: tar -xvf jdk-8u191-linux-x64.tar.gz -C /usr/local########配置JDK環(huán)境變量 cat >> /etc/profile << EOFexport JAVA_HOME=/usr/local/jdk1.8.0_191/ export PATH=\$JAVA_HOME/bin:\$PATH export CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar EOF########執(zhí)行環(huán)境變量生效 source /etc/profile########查看 java -version

2.nexus軟件安裝

以安裝nexus-3.29為例,準(zhǔn)備好nexus-3.29.1-01-unix.tar.gz

########解壓 mkdir /usr/local/nexus3 tar -xvf nexus-3.29.1-01-unix.tar.gz -C /usr/local/nexus3

結(jié)果如下,其中nexus-3.29.1-01為程序,sonatype-work為數(shù)據(jù)目錄
[root@localhost nexus3]# cd /usr/local/nexus3/
[root@localhost nexus3]# ls -hl
total 0
drwxr-xr-x. 9 root root 163 Jun 28 10:47 nexus-3.29.1-01
drwxr-xr-x. 3 root root 20 Jun 28 10:47 sonatype-work

3.修改配置

Jvm相關(guān)的配置在/usr/local/nexus3/nexus-3.29.1-01/bin/nexus.vmoptions

  • 比如內(nèi)存比較少,則調(diào)整下VM參數(shù),參考值如
  • -Xms500M
    -Xmx500M
    -XX:MaxDirectMemorySize=800M

  • 默認(rèn)的存儲(chǔ)目錄在安裝目錄下的nexus-3.29.1-01,比如要修改這個(gè)到別處,則修改nexus.vmoptions中的karaf.data,karaf.log,java.io.tmpdir等值
  • -Dkaraf.data=…/sonatype-work/nexus3
    -Dkaraf.log=…/sonatype-work/nexus3/log
    -Djava.io.tmpdir=…/sonatype-work/nexus3/tmp

  • 比如要修改修改默認(rèn)8081端口變成80, 或上下文工程路徑,修改文件/usr/local/nexus3/nexus-3.29.1-01/etc/nexus-default.properties
  • 端口修改:

    sed -i ‘s/application-port=8081/application-port=80/’ /usr/local/nexus3/nexus-3.29.1-01/etc/nexus-default.properties

    nexus-context-path修改

    sed -i ‘s/nexus-context-path=//nexus-context-path=/nexus3/’ /usr/local/nexus3/nexus-3.29.1-01/etc/nexus-default.properties

    4.啟動(dòng),重啟,停止

    /usr/local/nexus3/nexus-3.29.1-01/bin/nexus start /usr/local/nexus3/nexus-3.29.1-01/bin/nexus restart /usr/local/nexus3/nexus-3.29.1-01/bin/nexus stop

    5.訪問(wèn)測(cè)試

    測(cè)試時(shí)我將/nexus-context-path修改為了/nexus3,因此訪問(wèn)地址如下:
    http://192.168.56.101:8081/nexus3/
    admin admin123

    二、maven,yum,apt,docker,npm私庫(kù)搭建

    Maven私庫(kù):

    https://maven.aliyun.com/repository/public
    https://maven.aliyun.com/repository/google
    https://maven.aliyun.com/repository/spring
    https://maven.aliyun.com/repository/spring-plugin

    Yum私庫(kù):

    新建代理倉(cāng)庫(kù),在nexus管理界面上新建代理,測(cè)試過(guò)的代理如下:
    Proxy Remote storage:
    docker-ce —> http://mirrors.aliyun.com/docker-ce/linux/centos/
    kubernetes —> https://mirrors.aliyun.com/kubernetes/
    centos —> https://mirrors.aliyun.com/centos
    epel -----> http://download.fedoraproject.org/
    docker --googlecontainer—>>> https://registry.aliyuncs.com/
    nginx -----> http://nginx.org/
    enterprise -----> http://rpms.remirepo.net/enterprise
    mysql ------> http://repo.mysql.com/
    google-chrome ------> http://dl.google.com/
    postgresql -------> https://download.postgresql.org/

    apt-proxy

    Name: apt-proxy
    Distribution: bionic
    Remote Stroage: https://mirrors.aliyun.com/ubuntu/

    docker私庫(kù)設(shè)置

    ##新建docker_google_containers
    docker --googlecontainer—>>> https://registry.aliyuncs.com
    remote storeage: https://registry.aliyuncs.com/
    customer index: https://registry-1.docker.io
    ##Realms—>>> Docker Bearer Token Realm移到Active然后保存

    ##官網(wǎng)docker_hub的設(shè)置記錄如下:

    #####如: docker_hub私庫(kù),6000端口 Repositories----->>>>Create repository---->>>>選擇docker(proxy) Name:docker_hub Http:打勾,設(shè)置6000端口 Allow anonymous docker pull: 打勾 Enable Docker V1 API:打勾 Remote storage: https://uyah70su.mirror.aliyuncs.com docker index: Use Docker Hub Storage:default 然后保存。

    npm npm-repo-proxy

    Name: npm-repo-proxy
    Remote storage: https://registry.npmjs.org

    3.私庫(kù)使用

    Yum私庫(kù)

    備份舊配置,執(zhí)行新配置,然后yum clean all清除緩存,然后進(jìn)行正常的yum install操作即可

    cd /etc/yum.repos.d/ mkdir bak mv *.repo bak################## cat > /etc/yum.repos.d/centos.repo << EOF [centos_os] name=centos_os baseurl=http://192.168.56.1:8081/nexus3/repository/centos/7/os/x86_64/ enabled=1 gpgcheck=0[centos_extras] name=centos_extras baseurl=http://192.168.56.1:8081/nexus3/repository/centos/7/extras/x86_64/ enabled=1 gpgcheck=0[centos_update] name=centos_update baseurl=http://192.168.56.1:8081/nexus3/repository/centos/7/updates/x86_64/ enabled=1 gpgcheck=0[centos_centosplus] name=centos_centosplus baseurl=http://192.168.56.1:8081/nexus3/repository/centos/7/centosplus/x86_64/ enabled=1 gpgcheck=0 EOF################## cat > /etc/yum.repos.d/epel.repo << EOF [epel] name=epel baseurl=http://192.168.56.1:8081/nexus3/repository/epel/pub/epel/7/x86_64/ enabled=1 gpgcheck=0 EOF################## cat > /etc/yum.repos.d/nginx.repo << EOF [epel] name=epel baseurl=http://192.168.56.1:8081/nexus3/repository/nginx/packages/centos/7/x86_64/ enabled=1 gpgcheck=0 EOF################## cat > /etc/yum.repos.d/remi-safe.repo << EOF [remi-safe] name=Safe Remi's RPM repository for Enterprise Linux 7 - x86_64 baseurl=http://192.168.56.1:8081/nexus3/repository/enterprise/7/safe/x86_64/ enabled=1 gpgcheck=0 EOF################## cat > /etc/yum.repos.d/docker-ce.repo << EOF [docker-ce-stable] name=Docker CE Stable - baseurl=http://192.168.56.1:8081/nexus3/repository/docker-ce/7/x86_64/stable enabled=1 gpgcheck=0 EOF################## cat > /etc/yum.repos.d/kubernetes.repo << EOF [kubernets] name=kubernets baseurl=http://192.168.56.1:8081/nexus3/repository/kubernetes/yum/repos/kubernetes-el7-x86_64/ enabled=1 gpgcheck=0 EOF##################Mysql5.7 cat > /etc/yum.repos.d/mysql.repo << EOF [mysql-connectors-community] name=mysql-connectors-community baseurl=http://192.168.56.1:8081/nexus3/repository/mysql/yum/mysql-connectors-community/el/7/x86_64/ enabled=1 gpgcheck=0[mysql-tools-community] name=mysql-tools-community baseurl=http://192.168.56.1:8081/nexus3/repository/mysql/yum/mysql-tools-community/el/7/x86_64/ enabled=1 gpgcheck=0[mysql57-community] name=mysql57-community baseurl=http://192.168.56.1:8081/nexus3/repository/mysql/yum/mysql-5.7-community/el/7/x86_64/ enabled=1 gpgcheck=0 EOF##################Google-chrome cat > /etc/yum.repos.d/google-chrome.repo << EOF [google-chrome] name=google-chrome baseurl=http://192.168.56.1:8081/nexus3/repository/google-chrome/linux/chrome/rpm/stable/x86_64 enabled=1 gpgcheck=0 EOF##################gluster9 cat > /etc/yum.repos.d/gluster9.repo << EOF [centos-gluster9] name=CentOS Gluster 9 baseurl=http://192.168.56.1:8081/nexus3/repository/centos/7/storage/x86_64/gluster-9/ enabled=1 gpgcheck=0 EOF##################pgdg10 cat > /etc/yum.repos.d/pgdg10.repo << EOF [pgdg10] name=PostgreSQL 10 for RHEL / CentOS x86_64 #baseurl=https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-$releasever-$basearch baseurl=http://192.168.56.1:8081/nexus3/repository/postgresql/pub/repos/yum/10/redhat/rhel-7.6-x86_64/ enabled=1 gpgcheck=0 EOF

    apt私庫(kù):

    ##################sudo mv /etc/apt/sources.list /etc/apt/sources.list.defaultcat > /etc/apt/sources.list << EOF deb http://192.168.56.1:8081/nexus3/repository/apt-proxy/ bionic main restricted universe multiverse deb http://192.168.56.1:8081/nexus3/repository/apt-proxy/ bionic-security main restricted universe multiverse deb http://192.168.56.1:8081/nexus3/repository/apt-proxy/ bionic-updates main restricted universe multiverse deb http://192.168.56.1:8081/nexus3/repository/apt-proxy/ bionic-proposed main restricted universe multiverse deb http://192.168.56.1:8081/nexus3/repository/apt-proxy/ bionic-backports main restricted universe multiverse EOFsudo apt update####可以開(kāi)始使用了

    npm庫(kù):

    ##正常情況設(shè)置成淘寶源加速訪問(wèn) npm config set registry https://registry.npm.taobao.org##如果配置了私有npm庫(kù),可以使用如下命令,也可直接修改.npmrc文件 npm config set registry http://192.168.56.1:8081/nexus3/repository/npm-repo-proxy/

    總結(jié)

    以上是生活随笔為你收集整理的nexus3私库环境搭建(maven,yum,apt,nodejs)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。