如何用lnmt部署jpress

lnmt部署jpress

先去下载JPress安装包(war包)

下载

[root@localhost ~]# git clone https://gitee.com/JPressProjects/jpress.git
[root@localhost ~]# ls
anaconda-ks.cfg  jpress

在编译

[root@localhost jpress]# cd jpress
[root@localhost jpress]# mvn clean package

查看下载的war包

[root@localhost jpress]# cd /root/jpress/starter-tomcat/target/
[root@localhost target]# ls
classes         starter-tomcat-5.0              starter-tomcat-5.0.war
maven-archiver  starter-tomcat-5.0-classes.jar

先准备lnmt的环境

安装ngix

安装编译工具
[root@localhost ~]# yum -y install gcc gcc-c++ make wget

下载包
[root@localhost ~]# wget https://nginx.org/download/nginx-1.24.0.tar.gz
--2024-02-27 14:48:20--  https://nginx.org/download/nginx-1.24.0.tar.gz
Resolving nginx.org (nginx.org)... 52.58.199.22, 3.125.197.172, 2a05:d014:5c0:2600::6, ...
Connecting to nginx.org (nginx.org)|52.58.199.22|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1112471 (1.1M) [application/octet-stream]
Saving to: ‘nginx-1.24.0.tar.gz’

nginx-1.24.0.tar.gz    100%[===========================>]   1.06M   656KB/s    in 1.7s    

2024-02-27 14:48:23 (656 KB/s) - ‘nginx-1.24.0.tar.gz’ saved [1112471/1112471]

创建系统用户nginx
[root@localhost ~]# useradd -r -M -s /sbin/nologin nginx

安装依赖环境
[root@localhost ~]# yum -y install pcre-devel openssl openssl-devel gd-devel

创建日志存放目录
[root@localhost ~]# mkdir -p /var/log/nginx
[root@localhost ~]# chown -R nginx.nginx /var/log/nginx

编译安装
[root@localhost ~]# ls
anaconda-ks.cfg  nginx-1.24.0.tar.gz
[root@localhost ~]# tar xf nginx-1.24.0.tar.gz 
[root@localhost ~]# cd nginx-1.24.0
[root@localhost nginx-1.24.0]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src
[root@localhost nginx-1.24.0]# ./configure \
 --prefix=/usr/local/nginx \
 --user=nginx \
 --group=nginx \
 --with-debug \
 --with-http_ssl_module \
 --with-http_realip_module \
 --with-http_image_filter_module \
 --with-http_gunzip_module \
 --with-http_gzip_static_module \
 --with-http_stub_status_module \
 --http-log-path=/var/log/nginx/access.log \
 --error-log-path=/var/log/nginx/error.log
.........................................................
Configuration summary
  + using system PCRE2 library
  + using system OpenSSL library
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

[root@localhost nginx-1.24.0]# make && make install

nginx安装后配置

配置环境变量
[root@localhost ~]# echo 'export PATH=/usr/local/nginx/sbin:$PATH' > /etc/profile.d/nginx.sh
[root@localhost ~]# source /etc/profile.d/nginx.sh 
[root@localhost ~]# which nginx
/usr/local/nginx/sbin/nginx

启动nginx
[root@localhost ~]# nginx
[root@localhost ~]# ss -antl
State     Recv-Q    Send-Q       Local Address:Port        Peer Address:Port    Process    
LISTEN    0         511                0.0.0.0:80               0.0.0.0:*                  
LISTEN    0         128                0.0.0.0:22               0.0.0.0:*                  
LISTEN    0         128                   [::]:22                  [::]:*     

停止用nginx -s stop
[root@localhost ~]# nginx -s stop
[root@localhost ~]# ss -antl
State     Recv-Q    Send-Q       Local Address:Port        Peer Address:Port    Process    
LISTEN    0         128                0.0.0.0:22               0.0.0.0:*                  
LISTEN    0         128                   [::]:22                  [::]:*                  

设置一个开机自启
[root@localhost ~]# cp /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/nginx.service
[root@localhost ~]# vim /usr/lib/systemd/system/nginx.service 
[root@localhost ~]# cat /usr/lib/systemd/system/nginx.service 
[Unit]
Description=nginx server daemon
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecStop=/usr/local/nginx/sbin/nginx -s stop
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl enable --now nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.
[root@localhost ~]# systemctl status nginx
● nginx.service - nginx server daemon
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: disabled)
     Active: active (running) since Tue 2024-02-27 14:53:42 CST; 10s ago
    Process: 37587 ExecStart=/usr/local/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
   Main PID: 37588 (nginx)
      Tasks: 2 (limit: 10820)
     Memory: 2.3M
        CPU: 10ms
     CGroup: /system.slice/nginx.service
             ├─37588 "nginx: master process /usr/local/nginx/sbin/nginx"
             └─37589 "nginx: worker process"

Feb 27 14:53:42 localhost.localdomain systemd[1]: Starting nginx server daemon...
Feb 27 14:53:42 localhost.localdomain systemd[1]: Started nginx server daemon.
[root@localhost ~]# ss -antl
State     Recv-Q    Send-Q       Local Address:Port        Peer Address:Port    Process    
LISTEN    0         128                0.0.0.0:22               0.0.0.0:*                  
LISTEN    0         511                0.0.0.0:80               0.0.0.0:*                  
LISTEN    0         128                   [::]:22                  [::]:*                  

在这里插入图片描述

安装mysql(JPress目前暂时只支持mysql5.6或者5.7版本)

[root@localhost ~]# ls
anaconda-ks.cfg                             nginx-1.24.0
apache-tomcat-9.0.65.tar.gz                 nginx-1.24.0.tar.gz
jpress                                      starter-tomcat-5.0.war
mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz
[root@localhost ~]# tar xf mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
bin  games    lib    libexec                              nginx  share  tomcat
etc  include  lib64  mysql-5.7.30-linux-glibc2.12-x86_64  sbin   src
[root@localhost local]# mv mysql-5.7.30-linux-glibc2.12-x86_64 mysql
[root@localhost local]# ls
bin  etc  games  include  lib  lib64  libexec  mysql  nginx  sbin  share  src  tomcat
[root@localhost local]# useradd -M -r -s /sbin/nologin mysql
[root@localhost local]# chown -R mysql.mysql /usr/local/mysql
[root@localhost local]# ll
total 4
drwxr-xr-x.  2 root  root     6 May 16  2022 bin
drwxr-xr-x.  2 root  root     6 May 16  2022 etc
drwxr-xr-x.  2 root  root     6 May 16  2022 games
drwxr-xr-x.  2 root  root     6 May 16  2022 include
drwxr-xr-x.  2 root  root     6 May 16  2022 lib
drwxr-xr-x.  3 root  root    17 Jan 11 10:25 lib64
drwxr-xr-x.  2 root  root     6 May 16  2022 libexec
drwxr-xr-x.  9 mysql mysql  129 Feb 27 15:37 mysql
drwxr-xr-x. 11 root  root   151 Feb 27 14:52 nginx
drwxr-xr-x.  2 root  root     6 May 16  2022 sbin
drwxr-xr-x.  5 root  root    49 Jan 11 10:25 share
drwxr-xr-x.  2 root  root     6 May 16  2022 src
drwxr-xr-x.  9 root  root  4096 Feb 27 15:09 tomcat
[root@localhost local]# cd mysql
[root@localhost mysql]# ls
bin  docs  include  lib  LICENSE  man  README  share  support-files
[root@localhost mysql]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@localhost mysql]# source /etc/profile.d/mysql.sh 
[root@localhost mysql]# ln -s /usr/local/mysql/include /usr/include/mysql
[root@localhost mysql]# vim /etc/ld.so.conf.d/mysql.conf
[root@localhost mysql]# cat /etc/ld.so.conf.d/mysql.conf 
/usr/local/mysql/lib
[root@localhost mysql]# cd support-files/
[root@localhost support-files]# ls
magic  mysqld_multi.server  mysql-log-rotate  mysql.server
[root@localhost support-files]# vim mysql.server 
basedir=/usr/local/mysql
datadir=/opt/data
在设置开机自启
[root@localhost support-files]# pwd
/usr/local/mysql/support-files
[root@localhost support-files]# cp /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/mysqld.service
[root@localhost support-files]# vim /usr/lib/systemd/system/mysqld.service 
[root@localhost support-files]# cat /usr/lib/systemd/system/mysqld.service
[Unit]
Description=mysql server daemon
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/mysql/support-files/mysql.server start
ExecStop=/usr/local/mysql/support-files/mysql.server stop
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

[root@localhost support-files]#  cd
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# mkdir /opt/data
[root@localhost ~]# chown -R mysql.mysql /opt/data
[root@localhost ~]# /usr/local/mysql/bin/mysqld --initialize --user mysql --datadir /opt/data
2024-02-27T07:53:08.730586Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2024-02-27T07:53:08.955883Z 0 [Warning] InnoDB: New log files created, LSN=45790
2024-02-27T07:53:08.989095Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2024-02-27T07:53:09.052784Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3f89edce-d545-11ee-9e14-000c29b6d6ff.
2024-02-27T07:53:09.054520Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2024-02-27T07:53:09.457699Z 0 [Warning] CA certificate ca.pem is self signed.
2024-02-27T07:53:09.533521Z 1 [Note] A temporary password is generated for root@localhost: se2iI.lft%%M
[root@localhost ~]# echo 'se2iI.lft%%M' > pass
[root@localhost ~]# ls
anaconda-ks.cfg                             nginx-1.24.0
apache-tomcat-9.0.65.tar.gz                 nginx-1.24.0.tar.gz
jpress                                      pass
mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz  starter-tomcat-5.0.war
[root@localhost ~]# vim /etc/my.cnf
[root@localhost ~]# cat /etc/my.cnf 
[mysqld]
user = mysql
pid-file = /opt/data/mysql.pid
port = 3306
socket = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /opt/data
skip-name-resolve

[root@localhost ~]# systemctl enable --now mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@localhost ~]# systemctl status mysqld
● mysqld.service - mysql server daemon
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
     Active: active (running) since Tue 2024-02-27 16:02:33 CST; 15s ago
    Process: 38082 ExecStart=/usr/local/mysql/support-files/mysql.server start (code=exite>
   Main PID: 38095 (mysqld_safe)
      Tasks: 28 (limit: 10820)
     Memory: 176.6M
        CPU: 420ms
     CGroup: /system.slice/mysqld.service
             ├─38095 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/opt/data --pid-fi>
             └─38283 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/opt>

Feb 27 16:02:32 localhost.localdomain systemd[1]: Starting mysql server daemon...
Feb 27 16:02:32 localhost.localdomain mysql.server[38082]: Starting MySQL.
Feb 27 16:02:32 localhost.localdomain mysql.server[38095]: Logging to '/opt/data/localhost>
Feb 27 16:02:33 localhost.localdomain mysql.server[38082]:  SUCCESS!
Feb 27 16:02:33 localhost.localdomain systemd[1]: Started mysql server daemon.
[root@localhost ~]# ss -antl
State    Recv-Q   Send-Q            Local Address:Port       Peer Address:Port   Process   
LISTEN   0        128                     0.0.0.0:22              0.0.0.0:*                
LISTEN   0        511                     0.0.0.0:80              0.0.0.0:*                
LISTEN   0        128                        [::]:22                 [::]:*                
LISTEN   0        80                            *:3306                  *:*                
LISTEN   0        1            [::ffff:127.0.0.1]:8005                  *:*                
LISTEN   0        100                           *:8080                  *:*                
[root@localhost ~]# cat pass
se2iI.lft%%M
[root@localhost ~]# mysql -uroot -p'se2iI.lft%%M'
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
[root@localhost ~]# ln -s /usr/lib64/libncurses.so.6 /usr/lib64/libncurses.so.5
[root@localhost ~]# mysql -uroot -p'se2iI.lft%%M'
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
[root@localhost ~]# ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so.5
[root@localhost ~]# mysql -uroot -p'se2iI.lft%%M'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.30

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password = password('cjy123!');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> quit
Bye
[root@localhost ~]# mysql -uroot -pcjy123!
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.30 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye

安装tomcat

java环境安装
安装jdk环境
[root@node1 ~]# yum -y install java-11-openjdk*

查看安装的版本
[root@node1 ~]# java -version
openjdk version "11.0.22" 2024-01-16 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.22.0.7-1) (build 11.0.22+7-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.22.0.7-1) (build 11.0.22+7-LTS, mixed mode, sharing)

下载tomcat的包
[root@localhost ~]# wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.65/bin/apache-tomcat-9.0.65.tar.gz
--2024-02-27 15:06:32--  https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.65/bin/apache-tomcat-9.0.65.tar.gz
Resolving archive.apache.org (archive.apache.org)... 65.108.204.189, 2a01:4f9:1a:a084::2
Connecting to archive.apache.org (archive.apache.org)|65.108.204.189|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11593900 (11M) [application/x-gzip]
Saving to: ‘apache-tomcat-9.0.65.tar.gz’

apache-tomcat-9.0.65.t 100%[===========================>]  11.06M   302KB/s    in 54s     

2024-02-27 15:07:28 (208 KB/s) - ‘apache-tomcat-9.0.65.tar.gz’ saved [11593900/11593900]

解压部署
[root@localhost ~]# ls
anaconda-ks.cfg              jpress        nginx-1.24.0.tar.gz
apache-tomcat-9.0.65.tar.gz  nginx-1.24.0  starter-tomcat-5.0.war
[root@localhost ~]# tar xf apache-tomcat-9.0.65.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
apache-tomcat-9.0.65  etc    include  lib64    nginx  share
bin                   games  lib      libexec  sbin   src
[root@localhost local]# mv apache-tomcat-9.0.65 tomcat
[root@localhost local]# ls
bin  etc  games  include  lib  lib64  libexec  nginx  sbin  share  src  tomcat
[root@localhost local]# cd tomcat/
[root@localhost tomcat]# ls
bin           conf             lib      logs    README.md      RUNNING.txt  webapps
BUILDING.txt  CONTRIBUTING.md  LICENSE  NOTICE  RELEASE-NOTES  temp         work
[root@localhost tomcat]# cd webapps/
[root@localhost webapps]# ls
docs  examples  host-manager  manager  ROOT
把war包放到此目录
[root@localhost webapps]# cp ~/starter-tomcat-5.0.war .
[root@localhost webapps]# ls
docs  examples  host-manager  manager  ROOT  starter-tomcat-5.0.war
启动
[root@localhost webapps]# /usr/local/tomcat/bin/catalina.sh start
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.
[root@localhost webapps]# ss -antl
State     Recv-Q    Send-Q       Local Address:Port        Peer Address:Port    Process    
LISTEN    0         128                0.0.0.0:22               0.0.0.0:*                  
LISTEN    0         511                0.0.0.0:80               0.0.0.0:*                  
LISTEN    0         128                   [::]:22                  [::]:*                  
LISTEN    0         100                      *:8080                   *:*                  
[root@localhost webapps]# ss -antl
State    Recv-Q   Send-Q            Local Address:Port       Peer Address:Port   Process   
LISTEN   0        128                     0.0.0.0:22              0.0.0.0:*                
LISTEN   0        511                     0.0.0.0:80              0.0.0.0:*                
LISTEN   0        128                        [::]:22                 [::]:*                
LISTEN   0        1            [::ffff:127.0.0.1]:8005                  *:*                
LISTEN   0        100                           *:8080                  *:*                

现在访问IP地址带:8080/starter-tomcat-5.0/出现这个界面

在这里插入图片描述

设置默认界面就是安装界面

[root@localhost webapps]# ls
docs  examples  host-manager  manager  ROOT  starter-tomcat-5.0  starter-tomcat-5.0.war
[root@localhost webapps]# rm -rf docs  examples  host-manager  manager  ROOT starter-tomcat-5.0.war 
[root@localhost webapps]# ls
starter-tomcat-5.0
[root@localhost webapps]# mv starter-tomcat-5.0 ROOT
mv: cannot stat 'starter-tomcat-5.0': No such file or directory
[root@localhost webapps]# ls
[root@localhost webapps]# cp ~/starter-tomcat-5.0.war .
[root@localhost webapps]# ls
starter-tomcat-5.0.war
[root@localhost webapps]# ls
starter-tomcat-5.0  starter-tomcat-5.0.war
[root@localhost webapps]# mv starter-tomcat-5.0 ROOT
[root@localhost webapps]# ls
ROOT  starter-tomcat-5.0.war
[root@localhost webapps]# rm -rf starter-tomcat-5.0.war 
[root@localhost webapps]# ls
ROOT

再次访问8080端口

在这里插入图片描述

给数据库授权

[root@localhost ~]# mysql -uroot -pcjy123!
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.30 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant all on *.* to root@'%' identified by 'cjy123!';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

点击下一步然后按照步骤去安装

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
输入设置的账号密码登录
在这里插入图片描述
成功登录到后台界面
在这里插入图片描述
可以编写文章并发布
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值