1. 程式人生 > 其它 >003.centos7.3安裝openjdk8

003.centos7.3安裝openjdk8

直接上指令碼,不廢話

# docker centos7.3
# 檢視操作心痛
$ cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

# 更新 yum 類庫 
yum update 

# 安裝openjdk7
$ tar -zxf  jdk-7u79-linux-x64.tar.gz
# 配置環境變數
$ vim ~/.bashrc

JAVA_HOME=/usr/local/jdk/jdk1.7.0_79
export JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH

# 安裝些工具
$ yum install -y wget tree lrzsz zip unzip vim 

# 編譯環境依賴的類庫
yum -y install bzip2 bzip2-devel
yum -y install gdbm gdbm-devel
yum -y install libffi-devel ncurses ncurses-devel
yum -y install openssl openssl-devel openssl-static
yum -y install readline readline-devel
yum -y install sqlite sqlite-devel
yum -y install tk tk-devel xz lzma xz-devel  zlib zlib-devel
yum groupinstall "Development Tools"
yum install alsa-lib-devel cups-devel libX* gcc gcc-c++ freetype-devel libstdc++-static ant make
yum install libXtst-devel libXt-devel libXrender-devel
 
yum install ccache(這個yum安裝不了,這個是提交編譯速度的,不安裝速度慢一些,不影響編譯)


# openjdk構建
$ ./configure --with-target-bits=64 --with-boot-jdk=/usr/local/jdk/jdk1.7.0_79 --with-debug-level=slowdebug --enable-debug-symbols ZIP_DEBUGINFO_FILES=0

# 編譯
$ make all ZIP_DEBUGINFO_FILES=0  


# 在編譯時出現的問題,需要支援 linux核心 5版本
*** This OS is not supported: Linux 1341611fe4ef 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
gmake[5]: *** [check_os_version] Error 1
gmake[4]: *** [linux_amd64_compiler2/fastdebug] Error 2
gmake[3]: *** [generic_build2] Error 2
gmake[2]: *** [debug] Error 2
gmake[1]: *** [/usr/local/jdk/open

檔案hotspot/make/linux/Makefile

-SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3% 
+SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3% 5%


# 構建完成標記
----- Build times -------
Start 2021-06-22 08:41:01
End   2021-06-22 08:57:01
00:00:43 corba
00:00:56 demos
00:02:13 docs
00:05:29 hotspot
00:01:01 images
00:00:18 jaxp
00:00:28 jaxws
00:04:37 jdk
00:00:00 langtools
00:00:14 nashorn
00:16:00 TOTAL
-------------------------