# 安装文档

# 操作系统初始化

当前安装方法适合操作系统:CentOS8,x86_64

# 1. 系统初始化操作

# 查看
uname -a // 查看操作系统

# 系统更新
yum update -y

# 关闭SELINUX
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config

# 调大服务器所支持的最大文件句柄数(云服务器一般已经默认已经设置)
echo "* hard nofile 65536" >> /etc/security/limits.conf
echo "* soft nofile 65536" >> /etc/security/limits.conf

# 配置
echo "vm.max_map_count=262144" >> /etc/sysctl.conf
sysctl -p

# 安装基础工具
yum install -y lrzsz unzip git wget

# 使用阿里源,可以加快安装速度(如果使用anolis操作系统,跳过此步骤)
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo

# 2. 用户初始化操作

# 新增一个普通用户,系统应用都由这个普通用户来运行
useradd roncoo
passwd roncoo
# 用户密码自行管理

# 设置sudo权限
sed -i '/OPASSWD: ALL/a\roncoo ALL=(ALL) NOPASSWD: ALL' /etc/sudoers

# MySQL-8.0的安装

# 1. 安装

# mysql8.0
yum install -y https://repo.mysql.com/mysql80-community-release-el8.rpm
# 安装mysql
yum install -y mysql-community-server

#安装完成之后,默认已设置开机启动。

# 2. 配置

cat >> /etc/my.cnf << 'EOF'
# 默认时区
default-time_zone='+8:00'
# 性能优化(若有单独是数据库服务器,推荐innodb_buffer_pool_size设置为系统内存的60%到80%)
innodb_buffer_pool_size=4G
innodb_log_file_size=256M
max_allowed_packet=64M
# 关闭log-bin(8.0默认是开启的)
disable-log-bin
# 设置身份认证插件(兼容低版本的认证方式)
default_authentication_plugin=mysql_native_password
# 最大连接数
max_connections=10240
# 需要启用only_full_group_by SQL模式
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
EOF

# 3. 初始化

# 启动
systemctl start mysqld

# 查看初始化密码
cat /var/log/mysqld.log | grep password

# 初始化,按需进行确认即可(注意密码的强度,不满足无法设置密码)
mysql_secure_installation

# 登录设置授权(这里新增用户:roncoo,密码为:RonCoo.123)
mysql -uroot -p
> create user roncoo@'%' identified by 'RonCoo.123';
> grant all on *.* to roncoo@'%';
> FLUSH PRIVILEGES;
> exit;

# 4. 说明

# 启动
systemctl start mysqld
# 关闭
systemctl stop mysqld
# 重启
systemctl restart mysqld

配置文件位置:/etc/my.cnf
软件安装位置:/var/lib/mysql
应用日志位置:/var/log/mysqld.log

# MongoDB-7.0安装

# 1. 安装

cat >> /etc/yum.repos.d/mongodb-org.repo << 'EOF'
[mngodb-org-7.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/8/mongodb-org/7.0/x86_64/
gpgcheck=0
enabled=1
EOF

# 安装
yum -y install mongodb-org

#安装完成之后,默认已设置开机启动。

# 2. 配置

# /etc/mongod.conf 配置文件
sed -i 's/bindIp: 127.0.0.1/bindIp: 0.0.0.0/' /etc/mongod.conf

# 3. 初始化

# 启动
systemctl start mongod

# 登录(这里创建超级用户:admin,密码:RonCoo.123)
mongosh
> use admin;
> db.createUser({user: "admin",pwd: "RonCoo.123",roles: ["root"]});

# 开启认证
vi /etc/mongod.conf
security:
  authorization: enabled 
#注意缩进,参照其他的值来改,若是缩进不对,可能导致后面服务不能重启

# 重启,使认证生效
systemctl restart mongod

# 登录
mongosh
> use admin;
> db.auth("admin","RonCoo.123")

# 创建数据库并授权
> use education;
> db.createUser({user: "roncoo",pwd: "RonCoo.123",roles: [ { role: "dbOwner", db: "education" } ]});

# 删除用户必须由账号管理员来删,所以,切换到admin角色
> use admin
> db.auth("admin","password")
> db.system.users.remove({user:"roncoo"})

# 4. 说明

# 启动
systemctl start mongod
# 关闭
systemctl stop mongod
# 重启
systemctl restart mongod

# Redis-6.2.9的安装

下载地址:https://download.redis.io/releases/ (opens new window)

推荐版本:redis-6.2.9.tar.gz

# 1. 安装

yum install -y gcc tcl

cd /opt/tools
wget https://download.redis.io/releases/redis-6.2.9.tar.gz
tar zxvf redis-6.2.9.tar.gz && cd redis-6.2.9
make install PREFIX=/opt/redis

# 添加配置文件
cp -r /opt/tools/redis-6.2.9/redis.conf /opt/redis/redis.conf

# 创建redis系统用户
useradd -r redis
chown -R redis:redis /opt/redis

# 2. 配置

# 设置允许外网访问
sed -i 's/bind 127.0.0.1/bind 0.0.0.0/' /opt/redis/redis.conf

# 设置密码(安全考虑,建议必须设置密码)
sed -i 's/# requirepass foobared/requirepass RonCoo.123/' /opt/redis/redis.conf

# 设置用守护线程的方式启动
sed -i 's/daemonize no/daemonize yes/' /opt/redis/redis.conf
sed -i 's/top-writes-on-bgsave-error yes/top-writes-on-bgsave-error no/' /opt/redis/redis.conf

cat >> /etc/profile << 'EOF'
# redis
export REDIS_HOME=/opt/redis
export PATH=${REDIS_HOME}/bin:${PATH}
EOF

# 3. 启动

cat >> /usr/lib/systemd/system/redis.service << 'EOF'
[Unit]
Description=Redis
After=network.target

[Service]
Type=forking
User=redis
LimitNOFILE=65536
LimitNPROC=65536
PIDFILE=/var/run/redis.pid
ExecStart=/opt/redis/bin/redis-server /opt/redis/redis.conf
ExecRepload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
EOF

# 设置开机启动
systemctl enable redis

# 启动
systemctl start redis

# 4. 说明

# 启动
systemctl start redis
# 关闭
systemctl stop redis
# 重启
systemctl restart redis

配置文件:/opt/redis/redis.conf

# Elasticsearch-8.11.4的安装(企培版不需要安装)

下载地址:https://www.elastic.co/cn/downloads/past-releases#elasticsearch (opens new window)

推荐版本:elasticsearch-8.11.4-linux-x86_64.tar.gz

# 1. 安装

cd /opt/tools
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.11.4-linux-x86_64.tar.gz
tar -zxvf elasticsearch-8.11.4-linux-x86_64.tar.gz
mv /opt/tools/elasticsearch-8.11.4 /opt/elasticsearch

# 创建elastic系统用户
useradd -r elastic
chown -R elastic:elastic /opt/elasticsearch

# 2. 配置

# 配置
sed -i 's/#node.name: node-1/node.name: node-1/' /opt/elasticsearch/config/elasticsearch.yml
sed -i 's/#network.host: 192.168.0.1/network.host: 0.0.0.0/' /opt/elasticsearch/config/elasticsearch.yml
echo 'cluster.initial_master_nodes: ["node-1"]' >> /opt/elasticsearch/config/elasticsearch.yml
echo 'xpack.security.enabled: false' >> /opt/elasticsearch/config/elasticsearch.yml

cat >> /etc/profile << 'EOF'
# elastic
export ES_JAVA_HOME=/opt/elasticsearch/jdk
EOF

# 使配置立即生效
source /etc/profile

# 3. 启动

cat >> /usr/lib/systemd/system/elasticsearch.service << 'EOF'
[Unit]
Description=Elasticsearch

[Service]
User=elastic
LimitNOFILE=65536
LimitNPROC=65536
ExecStart=/opt/elasticsearch/bin/elasticsearch

[Install]
WantedBy=multi-user.target
EOF

# 设置开机启动
systemctl enable elasticsearch

# 启动
systemctl start elasticsearch

# 4. 说明

# 启动
systemctl start elasticsearch
# 关闭
systemctl stop elasticsearch
# 重启
systemctl restart elasticsearch

# 检测
curl -XGET http://localhost:9200/_cluster/health?pretty

# Tengine-3.1.0的安装

下载地址:http://tengine.taobao.org/download.html (opens new window)

推荐版本:tengine-3.1.0.tar.gz

# 1. 安装

# 安装依赖
yum install -y gcc gcc-c++ autoconf automake make pcre-devel openssl openssl-devel 

# 进入安装
cd /opt/tools
wget http://tengine.taobao.org/download/tengine-3.1.0.tar.gz
tar -zxvf tengine-3.1.0.tar.gz
cd tengine-3.1.0 && ./configure --prefix=/opt/nginx --with-http_v2_module
make && make install

# 存放独立域名配置(教培版)
mkdir /opt/nginx/conf/education.d
chown -R roncoo:roncoo /opt/nginx/conf/education.d
# 存放独立域名配置(企培版)
mkdir /opt/nginx/conf/enterprise.d
chown -R roncoo:roncoo /opt/nginx/conf/enterprise.d

# 2. 启动

cat >> /usr/lib/systemd/system/nginx.service << 'EOF'
[Unit]
Description=Nginx
After=network.target

[Service]
Type=forking
LimitNOFILE=65536
LimitNPROC=65536
ExecStart=/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf -p /opt/nginx
ExecReload=/opt/nginx/sbin/nginx -s reload -c /opt/nginx/conf/nginx.conf -p /opt/nginx
ExecStop=/opt/nginx/sbin/nginx -s quit -c /opt/nginx/conf/nginx.conf -p /opt/nginx
PrivateTmp=true

[Install]
WantedBy=multi-user.target
EOF

# 设置开机启动
systemctl enable nginx

# 启动
systemctl start nginx

# 3. 配置nginx.conf

# 删除
rm -f /opt/nginx/conf/nginx.conf

# 新建
cat >> /opt/nginx/conf/nginx.conf << 'EOF'
user  root;
worker_processes auto;

events {
    worker_connections 1024;
    accept_mutex on;
    multi_accept on;
    use epoll;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    keepalive_timeout       60s;
    client_max_body_size    1024m;

    sendfile                on; 
    gzip                    on; 
    gzip_min_length         1024;
    gzip_comp_level         2;
    gzip_buffers            4 32k;
    gzip_types              text/html text/xml text/plain text/css text/javascript application/javascript application/json application/xml;

    upstream eduweb {
        server 127.0.0.1:3000;
    }
    upstream edugateway {
        # (教培版),按需保留
        server 127.0.0.1:9900;
        # (企培版),按需保留
        server 127.0.0.1:8800;
    }
    
    include conf.d/*.conf;
    # 存放独立域名配置(教培版),按需保留
    include education.d/*/*.conf;
    # 存放独立域名配置(企培版),按需保留
    include enterprise.d/*/*.conf;
}
EOF

# 4. 应用配置conf.d

# 创建
mkdir /opt/nginx/conf/conf.d

# 新建
cat >> /opt/nginx/conf/conf.d/www.conf << 'EOF'
server {
    listen 80;
    server_name localhost;
    
    #listen 443 ssl http2;
    #ssl_certificate xxx.pem;
    #ssl_certificate_key xxx.key;
    #ssl_session_timeout 5m;
    #ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    #ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    #ssl_prefer_server_ciphers on;
    
    # nacos
    location /nacos {
       proxy_pass  http://127.0.0.1:8848;
    }     
    # job
    location /job {
       proxy_pass  http://127.0.0.1:9910;
    } 
    # monitor
    location /monitor {
       proxy_pass  http://127.0.0.1:9920;
       proxy_set_header Host $host;
    } 
    # gateway
    location /gateway/ {
       proxy_pass http://edugateway/;
       proxy_set_header Host  $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    # boss
    location /boss {
        root html;
        try_files $uri $uri/ /boss/index.html;
        index    index.html;
    }
    # admin
    location /admin {
        root html;
        try_files $uri $uri/ /admin/index.html;
        index    index.html;
    }
    # crm
    location /crm {
        root html;
        try_files $uri $uri/ /crm/index.html;
        index    index.html;
    }
    # teacher
    location /teacher {
        root html;
        try_files $uri $uri/ /teacher/index.html;
        index    index.html;
    }
    # h5
    location /h5 {
        root html;
        try_files $uri $uri/ /h5/index.html;
        index    index.html;
    }
    # web
    location / {
      proxy_pass  http://eduweb;
      proxy_set_header Host  $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
EOF

# 教培版专用
cat >> /opt/nginx/conf/conf.d/edu.cnf << 'EOF'
    # gateway
    location /gateway/ {    
       proxy_pass http://edugateway/;
       proxy_set_header Host  $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    # admin
    location /admin {
        root html;
        try_files $uri $uri/ /admin/index.html;
        index     index.html;
    }
    # teacher
    location /teacher {
        root html;
        try_files $uri $uri/ /teacher/index.html;
        index    index.html;
    }
    # h5
    location /h5 {
        root html;
        try_files $uri $uri/ /h5/index.html;
        index     index.html;
    }
    # web
    location / {
        proxy_pass http://eduweb;
        proxy_set_header Host  $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
EOF

# 企培版专用
cat >> /opt/nginx/conf/conf.d/ent.cnf << 'EOF'
    # gateway
    location /gateway/ {    
       proxy_pass http://edugateway/;
       proxy_set_header Host  $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    # crm
    location /crm {
        root html;
        try_files $uri $uri/ /crm/index.html;
        index     index.html;
    }
    # h5
    location /h5 {
        root html;
        try_files $uri $uri/ /h5/index.html;
        index     index.html;
    }
    # web
    location / {
        proxy_pass http://eduweb;
        proxy_set_header Host  $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
EOF

# 配置完成,要重启nginx才能生效。
systemctl restart nginx

# 5. 说明

# 启动
systemctl start nginx
# 查看
systemctl stop nginx
# 重启
systemctl restart nginx

# Nodejs-14.21.3的安装

下载地址:https://nodejs.org/dist/ (opens new window)

推荐版本:node-v14.21.3-linux-x64.tar.gz(建议选择长期支持版本(大版本号为偶数)。)

# 1. 安装

cd /opt/tools
wget https://nodejs.org/dist/v14.21.3/node-v14.21.3-linux-x64.tar.gz
tar -xvf node-v14.21.3-linux-x64.tar.gz
mv /opt/tools/node-v14.21.3-linux-x64 /opt/node
chown -R roncoo:roncoo /opt/node

# 2. 配置

cat >> /etc/profile << 'EOF'
# node
export NODE_HOME=/opt/node
export PATH=${NODE_HOME}/bin:${PATH}
EOF

# 使配置立即生效
source /etc/profile

# 验证版本信息
node -v

# 设置软连接
ln -s /opt/node/bin/node /usr/local/bin/
ln -s /opt/node/bin/npm /usr/local/bin/

# 安装pm2
npm install pm2 -g
ln -s /opt/node/bin/pm2 /usr/local/bin/

# 安装yarn
npm install yarn -g
ln -s /opt/node/bin/yarn /usr/local/bin/

# 配置为淘宝源
yarn config set registry https://registry.npmmirror.com/
yarn config get registry

# JDK-21的安装

下载地址:https://www.oracle.com/java/technologies/oracle-java-archive-downloads.html (opens new window)

推荐版本:jdk-21.0.2_linux-x64_bin.tar.gz

# 1. 安装

cd /opt/tools
# 上传到该目录下
tar -zxvf jdk-21.0.2_linux-x64_bin.tar.gz
mv jdk-21.0.2 /opt/java
chown -R roncoo:roncoo /opt/java

# 2. 配置

cat >> /etc/profile << 'EOF'
# java
export JAVA_HOME=/opt/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
EOF

# 使配置立即生效
source /etc/profile

# 添加软连接
ln -s /opt/java/bin/java /usr/local/bin

# 验证版本信息
java -version

# Maven-3.9.5的安装

下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/maven/ (opens new window)

推荐版本:apache-maven-3.9.5-bin.tar.gz

# 1. 安装

cd /opt/tools
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz
tar -zxvf apache-maven-3.9.5-bin.tar.gz
mv apache-maven-3.9.5 /opt/maven
chown -R roncoo:roncoo /opt/maven

# 2. 配置

cat >> /etc/profile << 'EOF'
# maven
export MAVEN_HOME=/opt/maven
export PATH=${MAVEN_HOME}/bin:${PATH}
EOF

# 使配置立即生效
source /etc/profile

# 验证版本信息
mvn -v

# 删除再重新添加
rm -f /opt/maven/conf/settings.xml

# 阿里云
cat >> /opt/maven/conf/settings.xml << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 <mirrors>
  <mirror>  
    <id>aliyun</id>  
    <name>aliyun maven</name>  
    <url>https://maven.aliyun.com/repository/public</url>  
    <mirrorOf>*</mirrorOf>          
  </mirror>
 </mirrors>
</settings>
EOF

# 华为云(若使用华为云服务器建议使用)
cat >> /opt/maven/conf/settings.xml << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 <mirrors>
   <mirror>
     <id>huaweicloud</id>
     <mirrorOf>*</mirrorOf>
     <url>https://mirrors.huaweicloud.com/repository/maven/</url>
   </mirror>
 </mirrors>
</settings>
EOF

# Nacos-2.3.2的安装

下载地址:https://github.com/alibaba/nacos/releases (opens new window)

推荐版本:nacos-server-2.3.2.tar.gz
特别说明:2.x的服务端也兼容1.4.x的客户端,建议使用最新版的服务端

# 1. 安装

cd /opt/tools
wget https://github.com/alibaba/nacos/releases/download/2.3.2/nacos-server-2.3.2.tar.gz
tar zxvf nacos-server-2.3.2.tar.gz
mv nacos /opt/nacos
chown -R roncoo:roncoo /opt/nacos

# 设置权限,避免导入配置没权限
mkdir -p /work/Tomcat/localhost/nacos
chown -R roncoo:roncoo /work

# 3. 配置

sed -i 's/server.tomcat.accesslog.enabled=true/server.tomcat.accesslog.enabled=false/' /opt/nacos/conf/application.properties
sed -i 's/nacos.core.auth.enabled=false/nacos.core.auth.enabled=true/' /opt/nacos/conf/application.properties
sed -i 's/nacos.core.auth.server.identity.key=/nacos.core.auth.server.identity.key=roncoo/' /opt/nacos/conf/application.properties
sed -i 's/nacos.core.auth.server.identity.value=/nacos.core.auth.server.identity.value=roncoo/' /opt/nacos/conf/application.properties
sed -i 's/nacos.core.auth.plugin.nacos.token.secret.key=/nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789/' /opt/nacos/conf/application.properties
echo "spring.datasource.platform=mysql" >> /opt/nacos/conf/application.properties
echo "db.num=1" >> /opt/nacos/conf/application.properties
echo "db.url.0=jdbc:mysql://127.0.0.1:3306/education_nacos?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&autoReconnect=true" >> /opt/nacos/conf/application.properties
echo "db.user.0=roncoo" >> /opt/nacos/conf/application.properties
echo "db.password.0=RonCoo.123" >> /opt/nacos/conf/application.properties

# 配置完成后,需要把SQL脚本导入数据库,SQL脚本位置:nacos/conf/mysql-schema.sql

# 3. 启动

cat >> /usr/lib/systemd/system/nacos.service << 'EOF'
[Unit]
Description=Nacos
After=network.target

[Service]
User=roncoo
Type=forking
ExecStart=/opt/nacos/bin/startup.sh -m standalone
ExecStop=/opt/nacos/bin/shutdown.sh
PrivateTmp=true

[Install]
WantedBy=multi-user.target
EOF
# 注:-m standalone,表示单机模式启动,默认是集群模式启动

# 设置开机启动
systemctl enable nacos

# 启动
systemctl start nacos

# 5. 说明

# 启动
systemctl start nacos
# 关闭
systemctl stop nacos
# 重启
systemctl restart nacos

# 访问地址:http://localhost:8848/nacos/,初始化的账号密码:nacos/nacos  
# 登录控制台,可以直接导入提供的 nacos_config.zip,进行配置初始化,里面的配置按需修改
# 特别注意:修改nacos的密码,建议不要包含有@!等,否则在配置里面需要进行转义
# 特别说明:系统使用的是命名空间ID,不是命名空间名称,这里建议ID和名称设置为一致。

# Seata-2.0.0的安装

下载地址:https://github.com/seata/seata/releases (opens new window)

推荐版本:seata-server-2.0.0.tar.gz

# 1. 安装

cd /opt/tools
wget https://static.roncoos.com/education/seata-server-2.0.0.tar.gz
tar zxvf seata-server-2.0.0.tar.gz
mv seata /opt/seata

# 2. 配置

修改对应的参数:seata/confapplication.yml

# 授权
chown -R roncoo.roncoo /opt/seata

# 3. 启动

cat >> /usr/lib/systemd/system/seata.service << 'EOF'
[Unit]
Description=Seata
After=network.target

[Service]
User=roncoo
ExecStart=/opt/seata/bin/seata-server.sh
Type=forking
WorkingDirectory=/opt/seata/bin

[Install]
WantedBy=multi-user.target
EOF

# 设置开机启动
systemctl enable seata

# 创建日志目录(需要提前创建,否则启动会失败,权限属于roncoo)
mkdir -p /home/roncoo/logs/seata

# 启动
systemctl start seata

# 4. 说明

# 启动
systemctl start seata
# 关闭
systemctl stop seata
# 重启
systemctl restart seata

1. 若需要集群,部署多个seata-server即可实现(原理:因为其注册到nacos,利用nacos实现集群)
2. 若使用db模式,默认的数据库数据库驱动不适配MySQL8.0,需要将./seata/lib/jdbc下的驱动复制到./seata/lib
3. db模式下的脚本地址:https://github.com/seata/seata/tree/v2.0.0/script/server/db

# Job的安装

该应用的功能是提供定时任务服务,为单独的项目:roncoo-job

# 1. 安装

# 打包,需要进入到项目根目录执行该命令
mvn clean package

# 完成,上传target下的压缩文件到服务器,并解压到:/opt
tar zxvf job.tar.gz -C /opt/

# 修改config下的参数配置(按需修改),运行bin里面的脚本即可启动应用
sh /opt/job/bin/job.sh

# Preview(选装)

该应用的功能是提供文档预览服务,为单独的项目:roncoo-preview

# 1. 安装

# 打包,需要进入到项目根目录执行该命令
mvn clean package

# 完成,上传target下的压缩文件到服务器,并解压到:/opt
tar zxvf preview.tar.gz -C /opt/

# 首次运行,需要先运行bin里面的初始化脚本 init.sh
sh /opt/preview/bin/init.sh

# 修改config下的参数配置(按需修改),运行bin里面的脚本即可启动应用
sh /opt/preview/bin/priview.sh

# MinIO安装(选装)

# 1. 安装

mkdir -p /opt/minio
cd /opt/minio
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio

cat >> /opt/minio/minio.conf << 'EOF'
MINIO_ROOT_USER=f8468f81034b1761
MINIO_ROOT_PASSWORD=f8468f81034b1761
MINIO_VOLUMES=/opt/minio/data
MINIO_OPTS="--console-address :9001"
EOF

# 2. 启动

cat >> /usr/lib/systemd/system/minio.service << 'EOF'
[Unit]
Description=MinIO
After=network.target

[Service]
LimitNOFILE=65536
LimitNPROC=65536
EnvironmentFile=/opt/minio/minio.conf
ExecStart=/opt/minio/minio server $MINIO_VOLUMES $MINIO_OPTS

[Install]
WantedBy=multi-user.target
EOF

# 设置开机启动
systemctl enable minio

# 启动
systemctl start minio
上次更新: 5/20/2024, 11:22:47 PM