Linux环境下部署Jpress大型博客网站 #yyds干货盘点#
Posted 江晓龙的技术博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux环境下部署Jpress大型博客网站 #yyds干货盘点#相关的知识,希望对你有一定的参考价值。
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/jdk
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
EOF
[root@localhost ~]# mkdir /application
[root@localhost application]# rz -E
rz 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代码
[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" ></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
以上是关于Linux环境下部署Jpress大型博客网站 #yyds干货盘点#的主要内容,如果未能解决你的问题,请参考以下文章
云原生之Docker实战使用Docker部署jpress开源网站