zoukankan      html  css  js  c++  java
  • java linux安装jdk,git, maven

    jdk8下载地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

    mkdir /usr/local/java

    cd /usr/local/java 

    rz -e jdk-8u211-linux-x64.tar.gz

    tar -xvf   jdk-8u211-linux-x64.tar.gz

    检查效果:

    git 安装注册:

    mkdir /usr/local/git

    cd /usr/local/git 

    安装编译依赖:

    yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

    下载Git并解压

    wget https://github.com/git/git/archive/v2.3.0.zip

    unizp  v2.3.0.zip 

    cd  v2.3.0.zip 

    指定编译安装路径和执行安装:

    make prefix=/usr/local/git all && make prefix=/usr/local/git install

    检查:

    git --version 

    which git 

    whereis git 

     git注册,密钥生成:

    [root@bogon git]# git config --global user.name "chen1932390299"
    [root@bogon git]# git config --global user.email 1932390299@qq.com
    [root@bogon git]# git config --list
    user.name=chen1932390299
    user.email=1932390299@qq.com
    [root@bogon git]# cd git-repo/
    [root@bogon git-repo]#  echo “README” > readme.txt
    [root@bogon git-repo]# ll
    total 4
    -rw-r--r--. 1 root root 11 Apr 20 15:04 readme.txt
    [root@bogon git-repo]# git init
    Initialized empty Git repository in /usr/local/git/git-repo/.git/
    [root@bogon git-repo]# cd ~
    [root@bogon ~]# mkdir .ssh
    [root@bogon ~]# cd .ssh
    [root@bogon .ssh]# ssh-keygen -t rsa -C "1932390299@qq.com"
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /root/.ssh/id_rsa.
    Your public key has been saved in /root/.ssh/id_rsa.pub.
    The key fingerprint is:
    8c:fa:e5:3a:a4:48:c8:fe:58:41:7f:99:5c:e6:90:8d 1932390299@qq.com
    The key's randomart image is:
    +--[ RSA 2048]----+
    |                 |
    |        +        |
    |   .   E +       |
    |  . . .oB        |
    |.. . ..=S.       |
    |... ..o          |
    |.. o.o  .        |
    | .+ ...o         |
    | ...  oo.        |
    +-----------------+
    [root@bogon .ssh]# cat id_rsa.pub
    ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5wZoqfl3kpLnugTku4J10JhuKJLZq/0RBBfsRrO7OtBzjBjnGCBvdGY3K+2m0IMu5UGhXgdBRPMVtxKG1QlYxKEVmgQpaEpZnsXsG0wDKHsgrn3oBgD59mpdvIGOh6korJ/GBlYRF4Djw0YmtTRFTcv5Jx5AAo7lTXYkJttcm4rxFhLsXg/gZNoyBlRzH+AQXQQjajYyvnx4+dJMXxEizrebNSmVxnLyotGovCnza/jSC617ASi0AOoyrWM5RHUsvnf92LmUwk+LR6Eyz97Aa6tyl1r5G8sR0VV/k+koxKHSXxn1cxozmNPdqJZ2fLiisUp9oTa0S9I3RCqS7zAWLw== 1932390299@qq.com
    [root@bogon .ssh]#
    

      

    maven 安装:

    cd /usr/local

    mkdir maven

    cd /usr/local/maven

    wget https://archive.apache.org/dist/maven/maven-3/3.1.0/binaries/apache-maven-3.1.0-bin.tar.gz

    tar -zxvf apache-maven-3.1.0-bin.tar.gz 

    vim /etc/profile.d/maven.sh

    #添加如下:

    export MAVEN_HOME=/usr/local/maven/apache-maven-3.1.0
    export PATH=${MAVEN_HOME}/bin:${PATH}

    source /etc/profile.d/maven.sh

    检验:

    mvn -v 

    成功

    本地仓库建立配置

    mkdir /usr/local/maven

    cd /usr/local/maven

    rz -e apache-maven-3.6.1-bin.tar.gz

    tar -xvf  apache-maven-3.6.1-bin.tar.gz

    建立本地仓库

    mkdir mvn-repo :

    cd   /usr/local/maven/apache-maven-3.6.1/conf

    vi setting.xml 

    找到如下部分:

    <!-- localRepository
    | The path to the local repository maven will use to store artifacts.
    |
    | Default: ${user.home}/.m2/repository
    <localRepository>/path/to/local/repo</localRepository>
    -->

    在此位置新增仓库刚才的mvn-repo路径:
    <localRepository> /usr/local/maven/apache-maven-3.6.1/mvn-repo</localRepository>

    代理设置:

    找到<proxies>标签在里面修改host,port,:

    <proxy>
    <id>optional</id>
    <active>true</active>
    <protocol>http</protocol>
    <username></username>
    <password></password>
    <host>proxy.we.com</host>
    <port>8484</port>
    <nonProxyHosts></nonProxyHosts>
    </proxy>

    镜像设置:

    找到<miorrors>标签在里面加入ali镜像

    <mirror>
    <id>alimaven</id>
    <name>aliyun maven</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    <mirrorOf>central</mirrorOf>
    </mirror>

     四。环境变量配置java git ,maven 

    vi /ect/profile

    #java_home
    export JAVA_HOME=/usr/local/java/jdk1.8.0_211
    export JRE_HOME=$JAVA_HOME/jre
    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    export PATH=$PATH:$JAVA_HOME/bin
    #git 
    export PATH="/usr/local/git/bin:$PATH"
    #maven
    #maven
    export MAVEN_HOME=/usr/local/maven/apache-maven-3.6.1
    export PATH=${MAVEN_HOME}/bin:${PATH}

    保存后激活:

    source /etc/profile

  • 相关阅读:
    An Introduction to the Linuxbased Assignments
    [读书笔记]Binary Hancks(1)
    haneWIN NFS Server
    [读书笔记]Binary Hancks(2) livepatch在X86下的实践
    CTNG编译错误以及解决办法
    [转]ucLinux下sqlite数据库移植全攻略
    程序员该有的艺术气质—SOLID原则
    Httpclient远程调用WebService示例(Eclipse+httpclient)
    四种生成和解析XML文档的方法详解(介绍+优缺点比较+示例)
    全网首发:原创SQL数据库同步工具
  • 原文地址:https://www.cnblogs.com/SunshineKimi/p/11371253.html
Copyright © 2011-2022 走看看