阿里云虚机环境配置

1.安装的操作系统是centos7.4

[root@iz2ze8a01m28p14ttwjg27z profile.d]# uname -a
Linux iz2ze8a01m28p14ttwjg27z 3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

[root@iz2ze8a01m28p14ttwjg27z profile.d]# cat /proc/version
Linux version 3.10.0-693.2.2.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Sep 12 22:26:13 UTC 2017

[root@iz2ze8a01m28p14ttwjg27z profile.d]# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.4.1708 (Core) 
Release:    7.4.1708
Codename:   Core

2.安装java8 和 java11

下载:

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/11.0.1+13/90cf5d8f270a4347a95050320eef3fb7/jdk-11.0.1_linux-x64_bin.rpm"

安装:

rpm -ivh jdk-8u191-linux-x64.rpm 
rpm -ivh jdk-11.0.1_linux-x64_bin.rpm 

3.多版本配置

3.1 环境变量配置

在/etc/profile.d/路径下新建一个文件,名为java.sh

#!/bin/bash
export JAVA_HOME=/usr/java/jdk1.8.0_191-amd64
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib

添加执行权限:

chmod +x /etc/profile.d/java.sh

执行source使改动生效:

source /etc/profile.d/java.sh

3.2 配置多版本Java

alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_191-amd64/bin/java 200
alternatives --install /usr/bin/java java /usr/java/jdk-11.0.1/bin/java 300

选择一个:

alternatives --config java
There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /usr/java/jdk1.8.0_191-amd64/jre/bin/java
   2           /usr/java/jdk-11.0.1/bin/java
 + 3           /usr/java/jdk1.8.0_191-amd64/bin/java

Enter to keep the current selection[+], or type selection number: 

4.安装asmtools

4.1 安装Mercurial (hg)3.9.2版

Mercurial是一种轻量级分布式版本控制系统,采用Python语言实现。

 yum install hg

版本是2.6.2,发现不是最新版,去官方下载centos 7最新版3.9.2

wget https://www.mercurial-scm.org/release/centos7/RPMS/x86_64/mercurial-3.9.2-1.x86_64.rpm

升级2.6.2 到3.9.2

rpm -Uvh mercurial-3.9.2-1.x86_64.rpm

4.2 安装asmtools

hg clone http://hg.openjdk.java.net/code-tools/asmtools/ asmtools
cd asmtools/build/
yum install ant
ant //编译生成asmtools.jar

你可能感兴趣的:(阿里云虚机环境配置)