- 安装mariadb数据
yum -y install mariadb-server
#启动并设置开启自启动
systemctl start mariadb.service
systemctl enable mariadb.service
- 数据库准备
[root@web01 ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.68-MariaDB MariaDB ServerCopyright (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 jpress charset utf8mb4;
Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> show create database jpress;
+----------+--------------------------------------------------------------------+
| Database | Create Database |
+----------+--------------------------------------------------------------------+
| jpress | CREATE DATABASE `jpress` /*!40100 DEFAULT CHARACTER SET utf8mb4 */ |
+----------+--------------------------------------------------------------------+
1 row in set (0.00 sec)MariaDB [(none)]> grant all on jpress.* to 'jpress'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> select user,host from mysql.user;
+--------+-----------+
| user | host |
+--------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| jpress | localhost |
| root | localhost |
| | web01 |
| root | web01 |
+--------+-----------+
7 rows in set (0.00 sec)MariaDB [(none)]> grant all on jpress.* to 'jpress'@'172.16.1.%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> drop user ''@'localhost';
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]>
MariaDB [(none)]> drop user ''@'web01';
Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]>
MariaDB [(none)]> select user,host from mysql.user;
+--------+------------+
| user | host |
+--------+------------+
| root | 127.0.0.1 |
| jpress | 172.16.1.% |
| root | ::1 |
| jpress | localhost |
| root | localhost |
| root | web01 |
+--------+------------+
6 rows in set (0.00 sec)MariaDB [(none)]>
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@web01 ~]# mysql -ujpress -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 7
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)]>
- 准备代码jpress
上传jpress.war包,直接移动到webapps路径下
[root@web01 ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg jpress.war
[root@web01 ~]# mv jpress.war /application/tomcat/webapps/
[root@web01 ~]# ll /application/tomcat/webapps/
总用量 20320
drwxr-xr-x 14 root root 4096 8月 6 13:06 docs
drwxr-xr-x 6 root root 83 8月 6 13:06 examples
drwxr-xr-x 5 root root 87 8月 6 13:06 host-manager
drwxr-xr-x 7 root root 102 8月 6 16:01 jpress
-rw-r--r-- 1 root root 20797013 3月 3 2017 jpress.war
drwxr-xr-x 5 root root 103 8月 6 13:06 manager
drwxr-xr-x 3 root root 4096 8月 6 13:06 ROOT
- 安装向导
访问http://192.168.111.12:8080/jpress/
下图对应的数据信息存放的文件
#tomcat数据库配置文件 db.properties
[root@web01 /application/tomcat/webapps/jpress/WEB-INF/classes]# cat db.properties
#Auto create by JPress
#Sat Aug 06 19:35:01 CST 2022
db_name=jpress
db_host_port=3306
db_tablePrefix=jpress_
db_host=localhost
db_password=123456
db_user=jpress
如图所示对应的信息内容
- http://192.168.111.12:8080/jpress/admin/
编辑文章,添加内容文字和图片进行发布
发布成功
上传的图片存放位置
attachment 该路径为用上传目录
数据库中存放文章的的内容
[root@web01 ~]# cat /application/tomcat/webapps/ROOT/mem.jsp
<%
Runtime rtm = Runtime.getRuntime();
long mm = rtm.maxMemory()/1024/1024;
long tm = rtm.totalMemory()/1024/1024;
long fm = rtm.freeMemory()/1024/1024;
out.println("JVM memory detail info :<br>");
out.println("Max memory:"+mm+"MB"+"<br>");
out.println("Total memory:"+tm+"MB"+"<br>");
out.println("Free memory:"+fm+"MB"+"<br>");
out.println("Available memory can be used is :"+(mm+fm-tm)+"MB"+"<br>");
%>