官网下载: jdk下载
安装完后,
输入:
cd /Library/Java/JavaVirtualMachines && ls
输出:
jdk-17.jdk jdk1.8.0_361.jdk
1、将下载的安装文件上传到 /usr/local/java .文件夹没有则新建即可
在路径:cd /usr/local/java 下 解压缩文件:
tar -zxvf jdk-8u281-linux-x64.tar.gz
2、配置环境变量
编辑:vi /etc/profile 在最后一行输入,保存并退出
export JAVA_HOME=/usr/local/java/jdk1.8
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
刷新文件使之立即生效
source /etc/profile
验证是否安装成功 java -version
得到
java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)
-- 明确 jdk版本
rpm -qa | grep jdk
java-1.8.0-openjdk-headless-1.8.0.275.b01-1.el8_3.x86_64
java-1.8.0-openjdk-devel-1.8.0.275.b01-1.el8_3.x86_64
copy-jdk-configs-3.7-4.el8.noarch
java-1.8.0-openjdk-1.8.0.275.b01-1.el8_3.x86_64
以上得到:copy-jdk-configs-3.7-4.el8.noarch , 卸载:
yum -y remove copy-jdk-configs-3.7-4.el8.noarch
查看jdk安装路径
echo $JAVA_HOME
echo $PATH
/usr/local/tomcat
下,解压缩tar -xzvf apache-tomcat-9.0.0.M9.tar.gz
vi /etc/profile
CATALINA_HOME=/usr/local/tomcat
export JAVA_HOME=/usr/local/java/jdk1.8
export PATH=$JAVA_HOME/bin:$PATH:$CATALINA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH JAVA_HOME CLASSPATH CATALINA_HOME
保存后刷新下,即可生效
source /etc/profile
vi server.xml
编辑配置文件,红色为调整内容,编辑后保存。bin路径下,运行./startup.sh
查看进程:ps -ef|grep java
查看进程是否占用8088端口: netstat -nalp|grep 8088
1、系统约定
mysql文件下载目录:/data/software
安装位置:/usr/local/mysql
数据库保存位置:/data/mysql
日志存储位置:/data/log/mysql
在目录/data/software
下下载安装文件,执行
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
在路径/usr/local/mysql
里解压缩,执行:
tar -xzvf /data/software/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
eg:jdk8和jdk17
下载路径:oracle下载
安装配置:
打开终端sudo vim /etc/profile
输入:
JAVA_HOME_8="/Library/Java/JavaVirtualMachines/jdk1.8.0_361.jdk/Contents/Home"
JAVA_HOME_17="/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home"
export JAVA_HOME=$JAVA_HOME_17
alias jdk8="export JAVA_HOME=$JAVA_HOME_8 && echo current JDK has switched to oracle jdk version 1.8. && java -version"
alias jdk17="export JAVA_HOME=$JAVA_HOME_17 && echo current JDK has switched to openjdk version 17. && java -version"
CLASS_PATH="$JAVA_HOME/lib"
PATH=".$PATH:$JAVA_HOME/bin"
验证jdk8和17是否安装且配置成功:
输入:jdk8
输出:
java version "1.8.0_361"
Java(TM) SE Runtime Environment (build 1.8.0_361-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.361-b09, mixed mode)
输入:jdk -version
输出:
java version "1.8.0_361"
Java(TM) SE Runtime Environment (build 1.8.0_361-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.361-b09, mixed mode)
输入:jdk17
输出:
java version "17.0.8" 2023-07-18 LTS
Java(TM) SE Runtime Environment (build 17.0.8+9-LTS-211)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.8+9-LTS-211, mixed mode, sharing)
输入:java -version
输出:
java version "1.8.0_361"
java version "17.0.8" 2023-07-18 LTS
Java(TM) SE Runtime Environment (build 17.0.8+9-LTS-211)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.8+9-LTS-211, mixed mode, sharing)