文章目录
系统环境
主机IP:10.0.0.7
[root@web01 tools]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@web01 tools]# uname -r
3.10.0-862.el7.x86_64
1)安装Java环境
将jdk软件包下载至存放软件安装包的目录
[root@web01 tools]# pwd
/server/tools
[root@web01 tools]# ll
-rw-r--r-- 1 root root 194545143 Aug 20 09:42 jdk-8u241-linux-x64.tar.gz
解压软件包
[root@web01 tools]# tar xf jdk-8u241-linux-x64.tar.gz
[root@web01 tools]# ll
drwxr-xr-x 7 10143 10143 245 Dec 11 2019 jdk1.8.0_241
-rw-r--r-- 1 root root 194545143 Aug 20 09:42 jdk-8u241-linux-x64.tar.gz
创建一个放置jdk的目录
[root@web01 tools]# mkdir -p /usr/java
[root@web01 tools]# mv jdk1.8.0_241/ /usr/java/
设置Java环境变量/etc/profille
export JAVA_HOME=/usr/java/jdk1.8.0_241
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=$CLASSPATH:${JAVA_HOME}/lib/:${JAVA_HOME}/jre/lib
export PATH=${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin:$PATH
再次加载环境变量
source /etc/profile
最后检查JAVA环境
[root@web01 tools]# java -version
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)
2)安装tomcat
下载软件包至本地并解压
tar xf apache-tomcat-8.5.43
[root@web01 tools]# ll
drwxr-xr-x 9 root root 220 Aug 20 09:59 apache-tomcat-8.5.43
-rw-r--r-- 1 root root 9717059 Aug 20 09:24 apache-tomcat-8.5.43.tar.gz
修改目录名,并将其放入/usr/local
目录下
[root@web01 tools]# mv apache-tomcat-8.5.43 tomcat
[root@web01 tools]# mv tomcat/ /usr/local
[root@web01 tomcat]# pwd
/usr/local/tomcat
[root@web01 tomcat]# ls
bin conf lib logs README.md RUNNING.txt webapps
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE RELEASE-NOTES temp work
启动服务
[root@web01 tomcat]# /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.8.0_241/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
3)检查tomcat服务是否启动
查看8080端口,已经开启
[root@web01 tomcat]# netstat -lntup|grep 8080
tcp6 0 0 :::8080 :::* LISTEN 12095/java
在Linux主机检查确认
[root@web01 tomcat]# curl -I 10.0.0.7:8080
HTTP/1.1 200
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Sat, 20 Aug 2022 02:58:07 GMT
在windows主机确认
4)上传资源并解压
[root@web01 tools]# ll
-rw-r--r-- 1 root root 89957094 Aug 20 18:41 jforum-2.6.2.war
[root@web01 tools]# jar xf jforum-2.6.2.war
5)将解压后的资源放置指定目录下
首先将/usr/local/tomcat/webapps/ROOT
目录下的内容清空
rm -rf /usr/local/tomcat/webapps/ROOT/*
将解压内容放置该目录
mv * /usr/local/tomcat/webapps/ROOT/
6)通过浏览器打开界面
10.0.0.7:8080/install.jsp
7)部署数据库
安装mariadb软件
yum install -y mariadb mariadb-server
启动数据库
systemctl start mariadb
登录数据库,创建用户和授权
[root@web01 ROOT]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database jforum;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on jforum.* to 'jforum'@localhost identified by 'jforum';
Query OK, 0 rows affected (0.00 sec)
8)填写浏览器相关信息
填写确认后,“开始安装”
9)安装成功
安装成功后,界面如下