将JDK的安装包上传到Linux系统的usr/local目录
使用xftp上传文件
解压JDK的压缩包
xshell连接到云主机
[root@theo ~]# cd /usr/local
[root@theo local]# ls
aegis apache-tomcat-8.5.46.tar.gz bin etc games include jdk-8u221-linux-x64.tar.gz lib lib64 libexec sbin share src
[root@theo local]# tar -zxvf jdk-8u221-linux-x64.tar.gz
查看解压后的目录结构
[root@theo local]# ls
aegis apache-tomcat-8.5.46.tar.gz bin etc games include jdk1.8.0_221 jdk-8u221-linux-x64.tar.gz lib lib64 libexec sbin share src
[root@theo local]# cd jdk1.8.0_221/
[root@theo jdk1.8.0_221]# ls
bin COPYRIGHT include javafx-src.zip jre lib LICENSE man README.html release src.zip THIRDPARTYLICENSEREADME-JAVAFX.txt THIRDPARTYLICENSEREADME.txt
[root@theo jdk1.8.0_221]# cd bin
[root@theo bin]# ls
appletviewer jar javadoc javapackager jconsole jhat jmc jsadebugd jvisualvm pack200 rmiregistry tnameserv xjc
ControlPanel jarsigner javafxpackager java-rmi.cgi jcontrol jinfo jmc.ini jstack keytool policytool schemagen unpack200
extcheck java javah javaws jdb jjs jps jstat native2ascii rmic serialver wsgen
idlj javac javap jcmd jdeps jmap jrunscript jstatd orbd rmid servertool wsimport
配置jdk环境
进入到/etc目录,找到profile文件
[root@theo bin]# cd /etc
[root@theo etc]# ls
编辑这个profile文件,在文件中添加JDK环境变量
vim profile
[root@theo etc]# vim profile 可以打开文件编辑器,必须输入字母i进入到编辑状态,在最后面添加如下四项配置
export JAVA_HOME=/usr/local/jdk1.8.0_221
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
编辑完成之后,点击键盘“Esc”按键退出编辑状态,输入
:wq
保存并退出编辑器
重新加载配置文件查看java版本
[root@theo etc]# source /etc/profile
[root@theo etc]# java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
准备maven的压缩包
apache-maven-3.6.3-bin.tar.gz
解压到opt文件夹下
[root@iZ2ze6psmhg970tbycgrbpZ ~]# tar -zxvf apache-maven-3.6.3-bin.tar.gz -C /opt/
进入opt文件夹查看解压文件
[root@iZ2ze6psmhg970tbycgrbpZ ~]# cd /opt/
[root@iZ2ze6psmhg970tbycgrbpZ opt]# ls
apache-maven-3.6.3
[root@iZ2ze6psmhg970tbycgrbpZ opt]#
重命名文件夹
重命名为maven
[root@iZ2ze6psmhg970tbycgrbpZ opt]# mv apache-maven-3.6.3/ maven
[root@iZ2ze6psmhg970tbycgrbpZ opt]# ls
maven
配置环境变量
vim /etc/profile
键盘 i 进行编辑,在最后加入maven环境配置
export MAVEN_HOME=/opt/maven
export PATH=$PATH:$MAVEN_HOME/bin
:wq退出编辑文件
source /etc/profile
使文件配置生效
检查maven是否配置成功
[root@iZ2ze6psmhg970tbycgrbpZ opt]# mvn -vesion
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/maven
Java version: 1.8.0_221, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_221/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.10.134-15.al8.x86_64", arch: "amd64", family: "unix"
配置maven阿里云镜像
编辑settings.xml文件
vim /opt/maven/conf/settings.xml
在mirrors标签中间加入mirror镜像标签
<mirror>
<id>alimavenid>
<mirrorOf>centralmirrorOf>
<name>aliyun mavenname>
<url>http://maven.aliyun.com/nexus/content/repositories/central/url>
mirror>
<mirror>
<id>nexus-alimavenid>
<mirrorOf>*,!jeecg,!jeecg-snapshotsmirrorOf>
<name>Nexus aliyunname>
<url>http://maven.aliyun.com/nexus/content/groups/public/url>
mirror>