Home >Operation and Maintenance >Linux Operation and Maintenance >What is the rpm statement for installing jdk in linux?

What is the rpm statement for installing jdk in linux?

WBOY
WBOYOriginal
2022-06-20 17:05:562216browse

The rpm statement for installing jdk in linux is "rpm -ivh jdk-...-linux-x64.rpm"; the rpm package is a way in Linux to install the required software through database management. The management program on the host can realize and manage the installation, viewing and deletion of software.

What is the rpm statement for installing jdk in linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is the rpm statement for installing jdk in linux

The rpm package is a management program that installs the required software on the host through database management; rpm is commonly developed by Red Hat For the installation, upgrade, uninstallation and query of software packages, Linux uses rpm to implement and manage the installation, viewing and deletion of software.

1. Download the jdk version of rpm, ORACLE official website, download the .rpm package.

2. Upload the downloaded JDK to the installation server

3. Authorize the rpm file

chmod +x jdk jdk-8u202-linux-x64.rpm

4. Install the rpm file

 rpm -ivh jdk-8u202-linux-x64.rpm

5. Enter the JDK installation directory

cd /usr/java/
ls -all

6. Configure the environment variables of the linux server

vim /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_301-amd64
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH

Save Esc wq:

7. Refresh /etc/profile

source /etc/profile

8. Test the java -version output

java -version
javac -version

9. If it is a single user Install a specific version individually.

#添加 - 表示切换环境变量,此处需要用到用户自己的环境变量信息
su - leo

10. Install a copy of jdk (different versions), the installation method is the same (different versions, different paths under /usr/java).

11. Enter the current user’s own environment configuration file

cd ~
ls -all

##12. vim .bash_profile

#有可能在 /usr/local下面
PATH=$HOME/bin:/usr/java/jdk1.7.0_45/bin:/usr/java/jdk1.7.0_45/jre/bin:$PATH
JAVA_HOME=/usr/java
export JAVA_HOME
Save Esc wq:

13. Test the JAVA configuration information of the current user

#当前用户下执行
java -version
javac -version
14. Uninstall the jdk version that comes with the system:

查看自带的jdk: 
#rpm -qa|grep gcj 
看到如下信息: 
libgcj-4.1.2-44.el5 
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 
使用rpm -e --nodeps 命令删除上面查找的内容: 
#rpm -e –nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
15. Uninstall the jkd version installed by rpm

查看安装的jdk: 
#rpm -qa|grep jdk 
看到如下信息: 
jdk-1.6.0_22-fcs 
卸载: 
#rpm -e --nodeps jdk-1.6.0_22-fcs
#直接使用yum安装会装在默认路径,此处瞎子啊rpm包自己安装
#安装yum-utils
yum -y install yum-utils
#查询JDK
yum search java|grep jdk
#下载rpm包
yumdownloader java-1.8.0-openjdk
Recommended learning:

Linux video tutorial

The above is the detailed content of What is the rpm statement for installing jdk in linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn