LNMT部署jpress

LNMT部署jpress

环境要求:

MySQL版本5.6/5.7

tomcat版本9.0.65

源码安装MySQL5.7版

//源码安装MySQL5.7版

1关闭防火墙
2创建mysql用户
3上传mysql5.7包(https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz)

解压包
[root@web2 ~]#: tar xf mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz -C  /usr/local/

[root@web2 ~]# cd /usr/local/
[root@web2 local]# mv mysql-5.7.30-linux-glibc2.12-x86_64/ mysql-5.7

设置环境变量
[root@web2 local]# cd mysql-5.7/
[root@web2 mysql-5.7]# ls
bin  docs  include  lib  LICENSE  man  README  share  support-files
[root@web2 mysql-5.7]# echo 'export PATH=/usr/local/mysql-5.7/bin:$PATH' > /etc/profile.d/mysql-5.7.sh
[root@web2 mysql-5.7]# source /etc/profile.d/mysql-5.7.sh
[root@web2 mysql-5.7]# which mysql
/usr/local/mysql-5.7/bin/mysql

创建软连接
[root@web2 mysql-5.7]# ln -s /usr/local/mysql-5.7/include/ /usr/include/mysql-5.7

配置lib库文件
[root@web2 mysql-5.7]# vim /etc/ld.so.conf.d/mysql-5.7.conf
[root@web2 mysql-5.7]# cat /etc/ld.so.conf.d/mysql-5.7.conf
/use/local/mysql-5.7/lib

配置man文档
[root@web2 mysql-5.7]# vim /etc/man_db.conf
添加
MANDATORY_MANPATH                       /usr/local/mysql-5.7/man

更改所属权限
[root@web2 mysql-5.7]# chown -R mysql.mysql /usr/local/mysql-5.7/
[root@web2 mysql-5.7]# ll
总用量 292
drwxr-xr-x  2 mysql mysql   4096  2月 27 14:13 bin
drwxr-xr-x  2 mysql mysql     55  2月 27 14:13 docs
drwxr-xr-x  3 mysql mysql   4096  2月 27 14:13 include
drwxr-xr-x  5 mysql mysql   4096  2月 27 14:13 lib
-rw-r--r--  1 mysql mysql 275235  3月 24  2020 LICENSE
drwxr-xr-x  4 mysql mysql     30  2月 27 14:13 man
-rw-r--r--  1 mysql mysql    587  3月 24  2020 README
drwxr-xr-x 28 mysql mysql   4096  2月 27 14:13 share
drwxr-xr-x  2 mysql mysql     90  2月 27 14:13 support-files

创建数据库数据目录
初始化
[root@web2 mysql-5.7]# mkdir /opt/test
[root@web2 mysql-5.7]# mysqld --initialize --user=mysql --datadir=/opt/test/
2024-02-27T06:41:39.272419Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2024-02-27T06:41:39.405698Z 0 [Warning] InnoDB: New log files created, LSN=45790
2024-02-27T06:41:39.428111Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2024-02-27T06:41:39.481601Z 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: 42c14fc1-d53b-11ee-b66e-000c294b2c31.
2024-02-27T06:41:39.482152Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2024-02-27T06:41:40.052229Z 0 [Warning] CA certificate ca.pem is self signed.
2024-02-27T06:41:40.156300Z 1 [Note] A temporary password is generated for root@localhost: Gl6Ag0%MlOwj

配置my.cnf文件
[root@web2 mysql]# vim /etc/my.cnf
[root@web2 mysql]# cat /etc/my.cnf

[mysqld]
basedir = /usr/local/mysql-5.7
datadir = /opt/test
socket = /tmp/mysql.sock
port = 3307
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve


[root@web2 ~]# /usr/local/mysql-5.7/support-files/mysql.server start
Starting MySQL. SUCCESS! 
[root@web2 ~]# ss -antl
State      Recv-Q     Send-Q              Local Address:Port          Peer Address:Port     Process     
LISTEN     0          4096                    127.0.0.1:9000               0.0.0.0:*                    
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          1              [::ffff:127.0.0.1]:8005                     *:*                    
LISTEN     0          80                              *:3307                     *:*                    
LISTEN     0          100                             *:8081                     *:*                    
LISTEN     0          128                          [::]:22                    [::]:*   

设置开机自启
[root@web2 ~]# cp /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/mysql-5.7.service
[root@web2 ~]# vim /usr/lib/systemd/system/mysql-5.7.service
[root@web2 ~]# cat /usr/lib/systemd/system/mysql-5.7.service
[Unit]
Description=mysqld server daemon
After=network.target 

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

[Install]
WantedBy=multi-user.target

[root@web2 ~]# systemctl daemon-reload 
[root@web2 ~]# systemctl status mysql-5.7.service 
○ mysql-5.7.service - mysqld server daemon
     Loaded: loaded (/usr/lib/systemd/system/mysql-5.7.service; disabled; vendor preset: disabled)
     Active: inactive (dead)
                  
[root@web2 ~]# systemctl start mysql-5.7.service 
[root@web2 ~]# systemctl enable mysql-5.7.service 
Created symlink /etc/systemd/system/multi-user.target.wants/mysql-5.7.service → /usr/lib/systemd/system/mysql-5.7.service.
[root@web2 ~]# systemctl status mysql-5.7.service 
● mysql-5.7.service - mysqld server daemon
     Loaded: loaded (/usr/lib/systemd/system/mysql-5.7.service; enabled; vendor preset: disabled)
     Active: active (running) since Tue 2024-02-27 15:12:07 CST; 24s ago
   Main PID: 3573 (mysqld_safe)
      Tasks: 28 (limit: 22948)
     Memory: 178.1M
        CPU: 310ms
     CGroup: /system.slice/mysql-5.7.service
             ├─3573 /bin/sh /usr/local/mysql-5.7/bin/mysqld_safe --datadir=/opt/test --pid-file=/opt/da>
             └─3763 /usr/local/mysql-5.7/bin/mysqld --basedir=/usr/local/mysql-5.7 --datadir=/opt/test >

2月 27 15:12:06 web2 systemd[1]: Starting mysqld server daemon...
2月 27 15:12:07 web2 mysql.server[3560]: Starting MySQL. SUCCESS!
2月 27 15:12:07 web2 systemd[1]: Started mysqld server daemon.

[root@web2 ~]# ss -antl
State      Recv-Q     Send-Q              Local Address:Port          Peer Address:Port     Process     
LISTEN     0          4096                    127.0.0.1:9000               0.0.0.0:*                    
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          1              [::ffff:127.0.0.1]:8005                     *:*                    
LISTEN     0          80                              *:3307                     *:*                    
LISTEN     0          100                             *:8081                     *:*                    
LISTEN     0          128                          [::]:22                    [::]:*   

设置数据库密码
[root@web2 ~]# mysql -uroot -p'Gl6Ag0%MlOwj'
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
[root@web2 ~]# mysql
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
如报以上错误,设置软连接
[root@web2 ~]# find / -name libtinfo.so*
/usr/lib64/libtinfo.so.6
/usr/lib64/libtinfo.so.6.2
/usr/lib64/libtinfo.so
[root@web2 ~]# ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so.5
[root@web2 ~]# ln -s /usr/lib64/libncurses.so.6 /usr/lib64/libncurses.so.5

[root@web2 ~]# mysql -uroot -p'Gl6Ag0%MlOwj'
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

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('mysql5-7');
Query OK, 0 rows affected, 1 warning (0.00 sec)

部署tomcat9.0.65版

部署tomcat9.0.65版

[root@web2 ~]# wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.65/bin/apache-tomcat-9.0.65.tar.gz
--2024-02-27 16:35:03--  https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.65/bin/apache-tomcat-9.0.65.tar.gz
正在解析主机 archive.apache.org (archive.apache.org)... 65.108.204.189, 2a01:4f9:1a:a084::2
正在连接 archive.apache.org (archive.apache.org)|65.108.204.189|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:11593900 (11M) [application/x-gzip]
正在保存至: “apache-tomcat-9.0.65.tar.gz”

apache-tomcat-9.0.65.tar. 100%[=====================================>]  11.06M   176KB/s  用时 1m 40s  

2024-02-27 16:36:44 (113 KB/s) - 已保存 “apache-tomcat-9.0.65.tar.gz” [11593900/11593900])

[root@web2 ~]# tar xf apache-tomcat-9.0.65.tar.gz -C /usr/local/
[root@web2 ~]# cd /usr/local/
[root@web2 local]# ls
apache-tomcat-10.1.19  bin  games    lib    libexec  mysql-5.7  php8  share
apache-tomcat-9.0.65   etc  include  lib64  mysql    nginx      sbin  src
[root@web2 local]# ln -s /usr/local/apache-tomcat-9.0.65/ jpress
[root@web2 local]# cd jpress/
[root@web2 jpress]# cp /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/tomcat9.service
[root@web2 jpress]# vim /usr/lib/systemd/system/tomcat9.service
[root@web2 jpress]# cat /usr/lib/systemd/system/tomcat9.service
[Unit]
Description=tomcat server daemon
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/jpress/bin/catalina.sh start
ExecStop=/usr/local/jpress/bin/catalina.sh stop
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target


[root@web2 jpress]# systemctl status tomcat9.service 
○ tomcat9.service - tomcat server daemon
     Loaded: loaded (/usr/lib/systemd/system/tomcat9.service; disabled; vendor preset: disabled)
     Active: inactive (dead)
[root@web2 jpress]# systemctl enable --now tomcat9.service 
[root@web2 jpress]# systemctl start tomcat9.service 
[root@web2 jpress]# ss -antl
State      Recv-Q     Send-Q              Local Address:Port          Peer Address:Port     Process     
LISTEN     0          4096                    127.0.0.1:9000               0.0.0.0:*                    
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          1              [::ffff:127.0.0.1]:8005                     *:*                    
LISTEN     0          80                              *:3307                     *:*                    
LISTEN     0          100                             *:8080                     *:*                    
LISTEN     0          128                          [::]:22                    [::]:*                    

在这里插入图片描述

部署jpress

jpresshttps://www.jpress.cn/

打包源代码war包
安装git
下载
[root@web2 ~]# git clone https://gitee.com/JPressProjects/jpress.git
正克隆到 'jpress'...
remote: Enumerating objects: 111600, done.
remote: Counting objects: 100% (1694/1694), done.
remote: Compressing objects: 100% (893/893), done.
remote: Total 111600 (delta 534), reused 1161 (delta 294), pack-reused 109906
接收对象中: 100% (111600/111600), 200.98 MiB | 542.00 KiB/s, 完成.
处理 delta 中: 100% (45760/45760), 完成.

编译
[root@web2 ~]# cd jpress
[root@web2 jpress]# mvn clean package
......
......
......
将war包移动至家目录
[root@web2 ~]# cp -a  /root/jpress/starter-tomcat/target/starter-tomcat-5.0.war ~/



[root@web2 ~]# cd /usr/local/jpress/webapps/
[root@web2 webapps]# ls
docs  examples  host-manager  manager  ROOT 

将war包复制到当前的webapps目录下,自动解压
[root@web2 webapps]# cp ~/starter-tomcat-5.0.war .
[root@web2 webapps]# ls
docs  examples  host-manager  manager  ROOT  starter-tomcat-5.0.war  
[root@web2 webapps]# ls
docs  examples  host-manager  manager  ROOT  starter-tomcat-5.0  starter-tomcat-5.0.war  

在这里插入图片描述

[root@web2 ~]# mysql -uroot -pmysql5-7
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 5
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 'mysql5-7';
Query OK, 0 rows affected, 1 warning (0.00 sec)

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

mysql> quit

在这里插入图片描述

在这里插入图片描述

简单化访问
[root@web2 webapps]# ls
docs  examples  host-manager  manager  ROOT  starter-tomcat-5.0  starter-tomcat-5.0.war
[root@web2 webapps]# rm -rf docs  examples  host-manager  manager ROOT
[root@web2 webapps]# ls
starter-tomcat-5.0  starter-tomcat-5.0.war
[root@web2 webapps]# mv starter-tomcat-5.0 ROOT
[root@web2 webapps]# rm -rf *.war
[root@web2 webapps]# ls
ROOT

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

  • 10
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值