安装jdk:
Oracle官方下载 https://www.oracle.com/technetwork/java/javase/downloads/index.html
yum安装openjdk:
1.查找可使用的jdk包:
[root@linux ~]# yum list |grep jdk
2.选择对应版本的包安装:
[root@linux ~]# yum -y install java-1.8.0-openjdk
安装tomcat:
tomcat官网:http://tomcat.apache.org/
tomcat主流版本:7.0/8.5/9.0
下载tomcat二进制包:
[root@linux ~]# cd /usr/local/src/[root@linux src]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.27/bin/apache-tomcat-9.0.27.tar.gz
解压:
[root@linux src]# tar -xzvf apache-tomcat-9.0.27.tar.gz
移动到/usr/local/目录下:
[root@linux src]# mv apache-tomcat-9.0.27 /usr/local/tomcat
启动tomcat:
[root@linux ~]# /usr/local/tomcat/bin/startup.sh Using CATALINA_BASE: /usr/local/tomcatUsing CATALINA_HOME: /usr/local/tomcatUsing CATALINA_TMPDIR: /usr/local/tomcat/tempUsing JRE_HOME: /usrUsing CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jarTomcat started.
查看进程:
ps -ef|grep tomcat 或 ps -ef|grep java
查看监听端口:
[root@linux ~]# netstat -lntp |grep javatcp6 0 0 :::8009 :::* LISTEN 13601/java tcp6 0 0 :::8080 :::* LISTEN 13601/java tcp6 0 0 127.0.0.1:8005 :::* LISTEN 13601/java
8080:web端口
8005:管理端口
8009:AJP端口(提供给第三方应用连接)
使用zrlog通过tomcat部署网站:
zrlog是一款开源的java博客系统,官网:https://www.zrlog.com/
下载zrlog:
[root@linux ~]# wget http://dl.zrlog.com/release/zrlog-2.1.3-b5f0d63-release.war?attname=ROOT.war&ref=index
移动到tomcat的webapps目录下:
[root@linux ~]# mv zrlog-2.1.3-b5f0d63-release.war/?attname/=ROOT.war /usr/local/tomcat/webapps/zrlog.war
移动.war包到webapps目录下时会自动解压:
[root@linux ~]# cd /usr/local/tomcat/webapps/[root@linux webapps]# lsdocs examples host-manager manager ROOT zrlog zrlog.war
将zrlog目录更名为ROOT:
[root@linux webapps]# mv ROOT ROOT.bak[root@linux webapps]# mv zrlog ROOT
为zrlog博客网站创建数据库:
[root@linux ~]# mysql -uroot -p123456 -e "create database zrlog"
创建数据库用户并授权:
[root@linux ~]# mysql -uroot -p123456 -e "grant all on zrlog.* to 'zrloguser'@'127.0.0.1' identified by 'test123'"
#创建用户zrloguser,密码test123,授权host:127.0.01
从浏览器访问:http://ip:8080/
#配置好数据库信息后下一步
配置管理员账号信息:
新闻热点
疑难解答