写点什么

Linux 环境下部署 Jpress 大型博客网站

作者:jiangxl
  • 2022 年 5 月 18 日
  • 本文字数:2781 字

    阅读完需:约 9 分钟

Jpress 简介一个类似 WordPress 的产品,使用 Java 开发。


开始部署

1.环境准备

1.1.搭建 tomcat

jdk 安装


#这里的eof使用单引号引起来是为了让特殊符号也写入文件#PATH 存放命令的路径,如果不小心改错了/etc/profile文件那么命令就不能使用了,可以使用命令的绝对路径来修改/bin/vim /etc/profile改完后exit重新连一下就行#安装jdk之前先把之前rpm装的删掉
cat >>/etc/profile <<'EOF'export JAVA_HOME=/application/jdkexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATHexport CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jarEOF
[root@localhost ~]# mkdir /application[root@localhost application]# rz -Erz waiting to receive.[root@localhost application]# ln -s jdk1.8.0_60/ jdk
复制代码


Tomcat


[root@localhost application]# tar xf apache-tomcat-8.5.53.tar.gz[root@localhost application]# ln -s apache-tomcat-8.5.53 tomcat[root@localhost application]# ./tomcat/bin/startup.sh#到此为止Tomcat部署完成
复制代码

1.2.数据库部署

1.下载MySQL官方扩展源[root@localhost ~]# rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-release-el7-5.noarch.rpm
2.安装完mysqlrpm后会在/etc/yum.repos.d中生成两个文件root@localhost ~]# ls /etc/yum.repos.d/my*/etc/yum.repos.d/mysql-community.repo /etc/yum.repos.d/mysql-community-source.repo
[root@localhost ~]# yum install mysql-community-server
4.启动[root@localhost soft]# systemctl start mysqld[root@localhost soft]# systemctl enable mysqld
5.登录[root@localhost ~]# mysql
复制代码

2.部署 jpress 博客

2.1.创建数据库

MariaDB [(none)]> create database jpress charset utf8mb4;Query OK, 1 row affected (0.02 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)]> MariaDB [(none)]> select user,host from mysql.user;+--------+-----------------------+| user | host |+--------+-----------------------+| root | 127.0.0.1 || root | ::1 || | localhost || jpress | localhost || root | localhost || | localhost.localdomain || root | localhost.localdomain |+--------+-----------------------+7 rows in set (0.00 sec)
MariaDB [(none)]> grant all on jpress.* to 'jpress'@'192.168.81.%' 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)]> select user,host from mysql.user;+--------+-----------------------+| user | host |+--------+-----------------------+| root | 127.0.0.1 || jpress | 192.168.81.% || root | ::1 || jpress | localhost || root | localhost || | localhost.localdomain || root | localhost.localdomain |+--------+-----------------------+7 rows in set (0.00 sec)
MariaDB [(none)]> flush privileges;Query OK, 0 rows affected (0.00 sec)
复制代码

2.1.获取 jpress 代码

  • https://gitee.com/GalaIO/jpress/blob/master/wars/jpress-web-newest.war



  [root@localhost webapps]# cp jpress/jpress/wars/jpress-web-newest.war  .  [root@localhost webapps]# rm -rf jpress  [root@localhost webapps]# rm -rf jpress.war   [root@localhost webapps]# mv jpress-web-newest jpress  [root@localhost webapps]# mv jpress-web-newest.war jpress.war  [root@localhost webapps]# ls  docs  examples  host-manager  jpress  jpress.war  jpress-web-newest  manager  ROOT
复制代码


  • 下面访问 http://192.168.81.210:8080/jpress






  • 我们去重启一下 tomcat

  • jpress 的配置文件位于 webapps/jpress/WEB-INF/classes, db.properties

  • 安装完成默认是进入整体的首页,我们可以使用单独账号进行登录

  • 然后去访问 http://192.168.81.210:8080/jpress/admin




  • 可以写一篇文章并上传图片


  • 在 jpress/attachment/20200331/目录可以看到用户上传的附件

  • 可以看到 jpress 中的表


  MariaDB [(none)]> show tables from jpress;  +-------------------+  | Tables_in_jpress  |  +-------------------+  | jpress_attachment |  | jpress_comment    |  | jpress_content    |  | jpress_mapping    |  | jpress_metadata   |  | jpress_option     |  | jpress_taxonomy   |  | jpress_user       |  +-------------------+  8 rows in set (0.01 sec)    文章内容应该是在content表中  MariaDB [(none)]> select * from jpress.jpress_content \G;  *************************** 1. row ***************************                id: 1             title: 第一篇测试文档              text: <p>江晓龙很牛!!!!<img src="/jpress/attachment/20200331/da5a9dd62da44c3fb1cab6fe9f7b293d.jpg" alt="啊啊啊" width="554" height="221"></p>         thumbnail: NULL            module: article             style: NULL           user_id: 1         parent_id: NULL         object_id: NULL      order_number: 0            status: normal           vote_up: 0         vote_down: 0             price: 0.00    comment_status: NULL     comment_count: 0        view_count: 0           created: 2020-03-31 18:16:56          modified: 2020-03-31 18:16:56              slug: 第一篇测试文档              flag: NULL               lng: NULL               lat: NULL     meta_keywords: NULL  meta_description: NULL           remarks: NULL
复制代码


用户头像

jiangxl

关注

还未添加个人签名 2022.04.27 加入

CSDN博客专家、51CTO专家博主、阿里云博客专家、华为云享专家、DevOps运维领域优质创作者,擅长Linux系统运维、开源监控软件维护、Kubernetes容器技术、CI/CD持续集成、自动化运维、大规模互联网WEB集群架构

评论

发布
暂无评论
Linux环境下部署Jpress大型博客网站_jiangxl_InfoQ写作社区