准备:只需要一个 jdk-8u11-linux-x64.tar.gz
操作如下
[root@vm1 ~]# ll
total 155316
-rw-------. 1 root root 1106 Jul 7 03:53 anaconda-ks.cfg
-rw-r--r--. 1 root root 8815 Jul 7 03:53 install.log
-rw-r--r--. 1 root root 3384 Jul 7 03:52 install.log.syslog
-rw-r--r--. 1 root root 159019376 Jul 7 06:00 jdk-8u11-linux-x64.tar.gz
[root@vm1 ~]# tar -zxf jdk-8u11-linux-x64.tar.gz
[root@vm1 ~]# ll
total 155320
-rw-------. 1 root root 1106 Jul 7 03:53 anaconda-ks.cfg
-rw-r--r--. 1 root root 8815 Jul 7 03:53 install.log
-rw-r--r--. 1 root root 3384 Jul 7 03:52 install.log.syslog
drwxr-xr-x. 8 uucp 143 4096 Jun 16 2014 jdk1.8.0_11
-rw-r--r--. 1 root root 159019376 Jul 7 06:00 jdk-8u11-linux-x64.tar.gz
[root@vm1 ~]# mv jdk1.8.0_11/ /usr/local/
[root@vm1 ~]# cd /usr/local/
[root@vm1 local]# ls
bin etc games include jdk1.8.0_11 lib lib64 libexec sbin share src
[root@vm1 local]# cd
[root@vm1 ~]# ll
total 155316
-rw-------. 1 root root 1106 Jul 7 03:53 anaconda-ks.cfg
-rw-r--r--. 1 root root 8815 Jul 7 03:53 install.log
-rw-r--r--. 1 root root 3384 Jul 7 03:52 install.log.syslog
-rw-r--r--. 1 root root 159019376 Jul 7 06:00 jdk-8u11-linux-x64.tar.gz
[root@vm1 jdk1.8.0_11]# vi /etc/profile
#文件末尾添加如下几行
export JAVA_HOME=/usr/local/jdk1.8.0_11 #java的解压路径
export CLASSPATH=.
export JAVA_PATH=${JAVA_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
[root@vm1 jdk1.8.0_11]# source /etc/profile
[root@vm1 jdk1.8.0_11]# java -version #验证是否配置成功
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
如果出现java version的字眼说明安装成功,如果没有出现这些字眼,查看一下/etc/profile配置文件中对应的jdk路径是否正确,尤其是java的版本号,保存之后记得source一下
使用wget获取Tomcat的tar包进行直接解压
[root@vm1 ~]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.94/bin/apache-tomcat-7.0.94.tar.gz
--2019-07-07 06:24:49-- http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.94/bin/apache-tomcat-7.0.94.tar.gz
Resolving mirrors.tuna.tsinghua.edu.cn... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn|101.6.8.193|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9182780 (8.8M) [application/octet-stream]
Saving to: “apache-tomcat-7.0.94.tar.gz”
100%[=====================================================================================================================================================================>] 9,182,780 715K/s in 12s
2019-07-07 06:25:00 (770 KB/s) - “apache-tomcat-7.0.94.tar.gz” saved [9182780/9182780]
[root@vm1 ~]# tar -zxf apache-tomcat-7.0.94.tar.gz -C /usr/local/
[root@vm1 ~]# service iptables stop #关闭防火墙
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@vm1 ~]# /usr/local/apache-tomcat-7.0.94/bin/startup.sh #启动Tomcat
Using CATALINA_BASE: /usr/local/apache-tomcat-7.0.94
Using CATALINA_HOME: /usr/local/apache-tomcat-7.0.94
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.94/temp
Using JRE_HOME: /usr/local/jdk1.8.0_11
Using CLASSPATH: /usr/local/apache-tomcat-7.0.94/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.94/bin/tomcat-juli.jar
[root@vm1 ~]# service iptables status #查看防火墙状态
iptables: Firewall is not running.
安装完成,在浏览器中输入IP:8080访问一下,如果出现一只三脚猫,说明安装成功
关闭防火墙的方法为:
1. 永久性生效
开启:chkconfig iptables on
关闭:chkconfig iptables off
2. 即时生效,重启后失效
开启:service iptables start
关闭:service iptables stop
开启某些端口的命令
[root@vm1 ~]# vi /etc/sysconfig/iptables #照葫芦画瓢就行了
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
[root@vm1 ~]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
使用wget获取maven3.6.1的tar包进行安装
[root@vm1 ~]# wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
--2019-07-07 06:51:33-- http://mirror.bit.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
Resolving mirror.bit.edu.cn... 219.143.204.117, 202.204.80.77, 2001:da8:204:2001:250:56ff:fea1:22
Connecting to mirror.bit.edu.cn|219.143.204.117|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://45.252.224.76/files/624300000DFDAE6F/mirror.bit.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz [following]
--2019-07-07 06:51:33-- http://45.252.224.76/files/624300000DFDAE6F/mirror.bit.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
Connecting to 45.252.224.76:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9136463 (8.7M) [application/octet-stream]
Saving to: “apache-maven-3.6.1-bin.tar.gz”
100%[=====================================================================================================================================================================>] 9,136,463 4.28M/s in 2.0s
2019-07-07 06:51:35 (4.28 MB/s) - “apache-maven-3.6.1-bin.tar.gz” saved [9136463/9136463]
[root@vm1 ~]# tar -zxf apache-maven-3.6.1-bin.tar.gz -C /usr/local/
[root@vm1 apache-maven-3.6.1]# vi /etc/profile
export MAVEN_HOME=/usr/local/apache-maven-3.6.1
export PATH=$PATH:$MAVEN_HOME/bin
[root@vm1 apache-maven-3.6.1]# source /etc/profile
[root@vm1 apache-maven-3.6.1]# mvn -version
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T15:00:29-04:00)
Maven home: /usr/local/apache-maven-3.6.1
Java version: 1.8.0_11, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_11/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
使用mvn -version命令,如果出现maven版本,则提示安装成功