记录一下周末搭建SpringBoot单体应用的主要步骤:
ssh root@192.168.0.1
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.8</java.version>
<ijapy.version>2.9.3</ijapy.version>
<enjoy.version>4.3</enjoy.version>
<!-- <fastjson.version>1.2.75</fastjson.version>-->
<zxing.version>3.5.0</zxing.version>
<slf4j.api.version>2.0.3</slf4j.api.version>
<xk.time.version>3.2.4</xk.time.version>
<alipay.version>4.34.0.ALL</alipay.version>
<fastjson.version>2.0.14.graal</fastjson.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.generator</groupId>
<artifactId>uid-generator</artifactId>
<version>1.0.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</exclusion>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<!-- IJPay 让支付触手可及 -->
<dependency>
<groupId>com.github.javen205</groupId>
<artifactId>IJPay-All</artifactId>
<version>2.9.3</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>2.0.14</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>enjoy</artifactId>
<version>${enjoy.version}</version>
</dependency>
<!-- 开源多维码生成工具 -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>${zxing.version}</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>${zxing.version}</version>
</dependency>
<!-- 开源多维码生成工具 -->
<dependency>
<groupId>com.github.xkzhangsan</groupId>
<artifactId>xk-time</artifactId>
<version>${xk.time.version}</version>
</dependency>
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId>
<version>${alipay.version}</version>
<exclusions>
<exclusion>
<artifactId>fastjson</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.8.0-beta4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.8.0-beta4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>1.27.2</version>
</dependency>
</dependencies>
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-10/v10.1.7/bin/apache-tomcat-10.1.7.tar.gz --no-check-certificate
scp -P 22 jdk-8u361-linux-x64.tar root@124.x.x.x:/root
cd /root
mkdir jdk
mv jdk-8u361-linux-x64.tar ./jdk
cd jdk
tar -xvf jdk-8u361-linux-x64.tar
vi /etc/profile
//在底部添加以下内容
#set java environment
JAVA_HOME=/root/jdk/jdk1.8.0_361
JRE_HOME=$JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JRE_HOME/lib/tools.jar
export JAVA_HOME JRE_HOME PATH CLASSPATH
export JAVA_HOME=/root/jdk/jdk1.8.0_361
export JRE_HOME=$JAVA_HOME
//执行以下命令保存并退出。
:wq
//验证安装。
java -version
398 2023-03-10 22:06:51 root cd tomcat
399 2023-03-10 22:06:52 root ll
400 2023-03-10 22:07:07 root tar -xvf apache-tomcat-10.1.7.tar.gz
401 2023-03-10 22:07:11 root ll
402 2023-03-10 22:07:24 root cd apache-tomcat-10.1.7
403 2023-03-10 22:07:25 root ll
404 2023-03-10 22:07:53 root cd bin
405 2023-03-10 22:07:54 root ll
406 2023-03-10 22:08:56 root vi setclasspath.sh
407 2023-03-10 22:09:50 root ./startup.sh
408 2023-03-10 22:10:07 root ps -ef|grep tomcat
#执行如下命令编辑setclasspath.sh脚本。
vi setclasspath.sh
#set java environment
JAVA_HOME=/root/jdk/jdk1.8.0_361
JRE_HOME=$JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JRE_HOME/lib/tools.jar
export JAVA_HOME JRE_HOME PATH CLASSPATH
export JAVA_HOME=/root/jdk/jdk1.8.0_361
export JRE_HOME=$JAVA_HOME
704 2023-03-11 14:25:29 root mkdir mysqldb
705 2023-03-11 14:25:30 root ll
706 2023-03-11 14:25:40 root mv mysql-8.0.30-1.el7.x86_64.rpm-bundle.tar ./mysqldb
707 2023-03-11 14:25:41 root ll
708 2023-03-11 14:25:49 root cd mysqldb
709 2023-03-11 14:25:50 root ll
710 2023-03-11 14:26:21 root tar -xvf mysql-8.0.30-1.el7.x86_64.rpm-bundle.tar
711 2023-03-11 14:26:36 root ll
712 2023-03-11 14:27:12 root rpm -ivh mysql-community-common-8.0.30-l.e17.x86_64.rpm
713 2023-03-11 14:27:18 root ll
714 2023-03-11 14:28:01 root rpm -ivh mysql-community-common-8.0.30-1.el7.x86_64.rpm
715 2023-03-11 14:28:34 root rpm ivh mysql-community-client-plugins-8.0.30-1.el7.x86_64.rpm
716 2023-03-11 14:30:01 root rpm -ivh mysql-community-client-plugins-8.0.30-1.el7.x86_64.rpm
717 2023-03-11 14:30:54 root rpm -ivh mysql-community-libs-8.0.30-1.el7.x86_64.rpm
718 2023-03-11 14:32:06 root rpm -ivh mysql-community-client-8.0.30-1.el7.x86_64.rpm
719 2023-03-11 14:32:27 root yum -y install openssl-devel
720 2023-03-11 14:32:54 root rpm -ivh mysql-community-devel-8.0.30-1.el7.x86_64.rpm
721 2023-03-11 14:33:03 root yum -y install libaio
722 2023-03-11 14:33:29 root rpm -ivh mysql-community-server-8.0.30-1.el7.x86_64.rpm
723 2023-03-11 14:34:40 root ll
724 2023-03-11 14:34:56 root rpm -ivh mysql-community-icu-data-files-8.0.30-1.el7.x86_64.rpm
725 2023-03-11 14:35:03 root rpm -ivh mysql-community-server-8.0.30-1.el7.x86_64.rpm
726 2023-03-11 14:35:40 root yum -y install net-tools
727 2023-03-11 14:36:00 root vim /etc/my.cnf
728 2023-03-11 14:47:22 root mysqld --initialize --console
729 2023-03-11 14:48:03 root chown -R mysql:mysql /var/lib/mysql/
730 2023-03-11 14:48:16 root chmod -R 755 /var/lib/mysql
731 2023-03-11 14:48:25 root systemctl start mysqld.service
732 2023-03-11 14:48:43 root systemctl status mysqld.service
733 2023-03-11 14:49:12 root cat /var/log/mysqld.log|grep localhost
734 2023-03-11 14:49:30 root mysql -uroot -p
735 2023-03-11 14:53:17 root systemctl restart mysqld.service
736 2023-03-11 14:53:30 root systemctl enable mysqld
737 2023-03-11 14:53:59 root systemctl start firewalld.service
738 2023-03-11 14:54:10 root firewall-cmd --zone=public --add-port=3306/tcp --permanent
739 2023-03-11 14:54:19 root systemctl restart firewalld.service
740 2023-03-11 14:54:32 root firewall-cmd --list-port
741 2023-03-11 15:17:58 root pwd
742 2023-03-11 15:18:08 root mysql -uroot -p
743 2023-03-11 16:02:00 root 12345678
744 2023-03-11 16:02:02 root mysql -uroot -p
745 2023-03-11 17:02:26 root pwd
经历了多次尝试,最后成功。
880 2023-03-11 19:21:42 root yum -y install rabbitmq-server
881 2023-03-11 19:22:07 root systemctl enable rabbitmq-server.service
882 2023-03-11 19:22:26 root systemctl start rabbitmq-server.service
# 添加新用户
884 2023-03-11 19:27:31 root rabbitmqctl add_user admin admin
# 设置权限
885 2023-03-11 19:28:06 root rabbitmqctl set_user_tags admin administrator
886 2023-03-11 19:28:43 root rabbitmqctl set_permissions -p admin ".*" ".*" ".*"
# 开启web端ui
889 2023-03-11 19:30:43 root rabbitmq-plugins enable rabbitmq_management
890 2023-03-11 19:32:01 root systemctl restart rabbitmq-server.service
891 2023-03-11 19:32:36 root systemctl start rabbitmq-server.service
892 2023-03-11 19:33:18 root service rabbitmq-server status
893 2023-03-11 19:33:53 root rabbitmqctl -version
894 2023-03-11 19:34:33 root rabbitmqctl list_users
895 2023-03-11 19:35:15 root lsof -i:5672
#添加开启一个端口
#firewall-cmd --zone=public --add-port=5672/tcp --permanent
#firewall-cmd --zone=public --add-port=15672/tcp --permanent
896 2023-03-11 19:36:35 root firewall-cmd --zone=public --add-port=15672/tcp --permanent
897 2023-03-11 19:37:06 root firewall-cmd --zone=public --add-port=5672/tcp --permanent
898 2023-03-11 19:37:40 root firewall-cmd --zone=public --list-ports
systemctl restart rabbitmq-server.service
899 2023-03-11 19:38:17 root iptables -L
900 2023-03-11 19:45:09 root service rabbitmq-server status
https://cloud.tencent.com/developer/article/1520710?areaSource=103001.5&traceId=WmRTRSzkMuNFD9XN0lnYz
### springboot jar 后台运行
nohup java -jar mgeids-boot.war >/dev/null &
查询到程序相应的PID
ps aux
利用kill PID杀到进程
kill 6759
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。