鼎鼎知识库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

安装 .NET Core

  • 查看SDK: dotnet --list-sdks
  • 查看运行时:dotnet --list-runtimes
  • 把Microsoft Package Signing Key添加到信任列表并安装
sudo wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb 

  • 安装运行时组合 sudo apt-get update;\ sudo apt-get install -y apt-transport-https && \ sudo apt-get update && \ sudo apt-get install -y aspnetcore-runtime-3.0
  • 如果只安装 .NET Core运行时,一般用的就是这个 sudo apt-get install -y dotnet-runtime-3.0

Ubuntu上使用Nginx

  • 更新apt: sudo apt update
  • 安装Nginx: sudo apt install nginx
  • 查看Nginx服务:sudo ufw app list Nginx Full Nginx HTTP Nginx HTTPS OpenSSH
  • 让防火墙允许Nginx:sudo ufw allow ‘NginxHTTP’
  • 查看防火墙状态 sudo ufw status sudo ufw enable sudo ufw status
  • 查看Nginx的状态:sudo systemctl status nginx
  • 获取公网IP: curl -4 icanhazip.com
  • 查看Nginx的登录页:http://ip
  • 停止服务:sudo systemctl stop nginx
  • 开始服务:sudo systemctl start nginx
  • 重启服务: sudo systemctl restart nginx
  • 随机启动的启用和禁用: sudo systemctl enable/disable nginx
  • 手动让修改文件生效:sudo systemctl reload nginx

Nginx支持多个域名

  • 默认文件夹:/var/www/html
  • 创建新目录:suoo mkdir -p /var/www/example.com/html
  • 给新目录分配当前用户的权限:sudo chown -R $USR:$USR /var/www/example.com/html 另外一个修改目录的读写权限: sudo chmod 666 some.txt
  • 确认是否有权限:sudo chmod -R 755 /var/www/example.com
  • 添加网页:/var/www/example.com/html/index.html
  • 需要为Serverblock添加新目录,即支持多个域名。来到/etc/nginx/sites-available/example.com ``` server { listen 80; listen [::]:80;

root /var/www/example.com/html index index.html index.htm index.nginx-debian.html

server_name example.com www.example.com

location / {

try_files $uri $uri/ = 404;

} }

- 让Nginx可以读取到上面的文件:sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
- 修改配置文件,防止hash bucket memory problem。来到:/etc/nginx/nginx.conf

http { server_names_hash_bucket_size 64; }


# 安装MySQL 5.7

- 创建目录:sudo mkdir tmp
- 进入目录:cd tmp
- 下载deb文件:curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb 
- 安装:sudo dpkg -i ...deb
- 安装过程选择mysql-5.7
- sudo apt-get update
- 真正安装MySQL的服务器版本:sudo apt-get install mysql-server
- 登录:mysql -u root -p
- 创建用户

CREATE USER ‘dd’@‘%’ IDENTIFIED BY ‘dd@123’

- 授权用户

GRANT ALL PRIVILEGES ON . TO ‘dd’@‘%’

- 让授权生效

FLUSH PRIVILEGES;

- 修改配置文件允许远程: /etc/mysql/mysql.d/mysqld.cnf
- 修改目录权限:sudo chmod 666 mysqld.cnf
- 修改配置文件

bind-address=0.0.0.0

- 重启服务:sudo systemctl restart/start/stop/status mysql.service
- 测试连接

ping 192.168.8.120 mysql -u root ph 192.168.8.120 -p mysql -u root -p


# 安装Redis

- 更新软件中心:sudo apt update
- 安装:sudo apt install redis-server
- 配置文件:/etc/redis/redis.conf
- 修改配置文件权限:sudo chmod 666 redis.conf
- 重启:sudo systemctl restart redis.service
- 查看状态:sudo systemctl status redis
- 启用禁用随机启动:sudo systemctl enable/disable redis
- 客户端登录:

redis-cli ping set test “ok” get test exit

- 修改配置文件密码

requriepass teche123


# 准备

- 服务器地址:192.168.8.109:8080
- 让模块和服务器都在一个局域网
- 查看局域网内模块的IP:192.168.8.108:82,用户名root,密码abc123。
- 连接MySQL数据库:192.168.8.109 3306 dd dd@123
- Redis数据库:127.0.0.1 teche123

# 创建主数据库teche

数据库名:teche 字符集:utf8mb4--UTF-8 Unicode 排序规则:utf8mbs_general_ci


# 创建用户数据库techeusr

数据库名:techeusr 字符集:utf8mb4--UTF-8 Unicode 排序规则:utf8mbs_general_ci


# 创建定时任务数据库quartznet

- 创建数据库

数据库名:quartznet 字符集:utf8mb4--UTF-8 Unicode 排序规则:utf8mbs_general_ci


- 执行语句

By: Ron Cordell - roncordell

I didn’t see this anywhere, so I thought I’d post it here. This is the script from Quartz to create the tables in a MySQL database, modified to use INNODB instead of MYISAM.

make sure you have UTF-8 collaction for best .NET interoperability

CREATE DATABASE quartznet CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS; DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS; DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE; DROP TABLE IF EXISTS QRTZ_LOCKS; DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS; DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS; DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS; DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS; DROP TABLE IF EXISTS QRTZ_TRIGGERS; DROP TABLE IF EXISTS QRTZ_JOB_DETAILS; DROP TABLE IF EXISTS QRTZ_CALENDARS;

CREATE TABLE QRTZ_JOB_DETAILS( SCHED_NAME VARCHAR(60) NOT NULL, JOB_NAME VARCHAR(60) NOT NULL, JOB_GROUP VARCHAR(60) NOT NULL, DESCRIPTION VARCHAR(250) NULL, JOB_CLASS_NAME VARCHAR(250) NOT NULL, IS_DURABLE BOOLEAN NOT NULL, IS_NONCONCURRENT BOOLEAN NOT NULL, IS_UPDATE_DATA BOOLEAN NOT NULL, REQUESTS_RECOVERY BOOLEAN NOT NULL, JOB_DATA BLOB NULL, PRIMARY KEY (SCHED_NAME,JOB_NAME,JOB_GROUP)) ENGINE=InnoDB;

CREATE TABLE QRTZ_TRIGGERS ( SCHED_NAME VARCHAR(60) NOT NULL, TRIGGER_NAME VARCHAR(60) NOT NULL, TRIGGER_GROUP VARCHAR(60) NOT NULL, JOB_NAME VARCHAR(60) NOT NULL, JOB_GROUP VARCHAR(60) NOT NULL, DESCRIPTION VARCHAR(250) NULL, NEXT_FIRE_TIME BIGINT(19) NULL, PREV_FIRE_TIME BIGINT(19) NULL, PRIORITY INTEGER NULL, TRIGGER_STATE VARCHAR(16) NOT NULL, TRIGGER_TYPE VARCHAR(8) NOT NULL, START_TIME BIGINT(19) NOT NULL, END_TIME BIGINT(19) NULL, CALENDAR_NAME VARCHAR(60) NULL, MISFIRE_INSTR SMALLINT(2) NULL, JOB_DATA BLOB NULL, PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), FOREIGN KEY (SCHED_NAME,JOB_NAME,JOB_GROUP) REFERENCES QRTZ_JOB_DETAILS(SCHED_NAME,JOB_NAME,JOB_GROUP)) ENGINE=InnoDB;

CREATE TABLE QRTZ_SIMPLE_TRIGGERS ( SCHED_NAME VARCHAR(60) NOT NULL, TRIGGER_NAME VARCHAR(60) NOT NULL, TRIGGER_GROUP VARCHAR(60) NOT NULL, REPEAT_COUNT BIGINT(7) NOT NULL, REPEAT_INTERVAL BIGINT(12) NOT NULL, TIMES_TRIGGERED BIGINT(10) NOT NULL, PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)) ENGINE=InnoDB;

CREATE TABLE QRTZ_CRON_TRIGGERS ( SCHED_NAME VARCHAR(60) NOT NULL, TRIGGER_NAME VARCHAR(60) NOT NULL, TRIGGER_GROUP VARCHAR(60) NOT NULL, CRON_EXPRESSION VARCHAR(120) NOT NULL, TIME_ZONE_ID VARCHAR(80), PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)) ENGINE=InnoDB;

CREATE TABLE QRTZ_SIMPROP_TRIGGERS (

SCHED_NAME VARCHAR(60) NOT NULL,
TRIGGER_NAME VARCHAR(60) NOT NULL,
TRIGGER_GROUP VARCHAR(60) NOT NULL,
STR_PROP_1 VARCHAR(512) NULL,
STR_PROP_2 VARCHAR(512) NULL,
STR_PROP_3 VARCHAR(512) NULL,
INT_PROP_1 INT NULL,
INT_PROP_2 INT NULL,
LONG_PROP_1 BIGINT NULL,
LONG_PROP_2 BIGINT NULL,
DEC_PROP_1 NUMERIC(13,4) NULL,
DEC_PROP_2 NUMERIC(13,4) NULL,
BOOL_PROP_1 BOOLEAN NULL,
BOOL_PROP_2 BOOLEAN NULL,
TIME_ZONE_ID VARCHAR(80) NULL,
PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP),
FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) 
REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP))

ENGINE=InnoDB;

CREATE TABLE QRTZ_BLOB_TRIGGERS ( SCHED_NAME VARCHAR(60) NOT NULL, TRIGGER_NAME VARCHAR(60) NOT NULL, TRIGGER_GROUP VARCHAR(60) NOT NULL, BLOB_DATA BLOB NULL, PRIMARY KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP), INDEX (SCHED_NAME,TRIGGER_NAME, TRIGGER_GROUP), FOREIGN KEY (SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP) REFERENCES QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP)) ENGINE=InnoDB;

CREATE TABLE QRTZ_CALENDARS ( SCHED_NAME VARCHAR(60) NOT NULL, CALENDAR_NAME VARCHAR(60) NOT NULL, CALENDAR BLOB NOT NULL, PRIMARY KEY (SCHED_NAME,CALENDAR_NAME)) ENGINE=InnoDB;

CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS ( SCHED_NAME VARCHAR(60) NOT NULL, TRIGGER_GROUP VARCHAR(60) NOT NULL, PRIMARY KEY (SCHED_NAME,TRIGGER_GROUP)) ENGINE=InnoDB;

CREATE TABLE QRTZ_FIRED_TRIGGERS ( SCHED_NAME VARCHAR(60) NOT NULL, ENTRY_ID VARCHAR(140) NOT NULL, TRIGGER_NAME VARCHAR(60) NOT NULL, TRIGGER_GROUP VARCHAR(60) NOT NULL, INSTANCE_NAME VARCHAR(60) NOT NULL, FIRED_TIME BIGINT(19) NOT NULL, SCHED_TIME BIGINT(19) NOT NULL, PRIORITY INTEGER NOT NULL, STATE VARCHAR(16) NOT NULL, JOB_NAME VARCHAR(60) NULL, JOB_GROUP VARCHAR(60) NULL, IS_NONCONCURRENT BOOLEAN NULL, REQUESTS_RECOVERY BOOLEAN NULL, PRIMARY KEY (SCHED_NAME,ENTRY_ID)) ENGINE=InnoDB;

CREATE TABLE QRTZ_SCHEDULER_STATE ( SCHED_NAME VARCHAR(60) NOT NULL, INSTANCE_NAME VARCHAR(60) NOT NULL, LAST_CHECKIN_TIME BIGINT(19) NOT NULL, CHECKIN_INTERVAL BIGINT(19) NOT NULL, PRIMARY KEY (SCHED_NAME,INSTANCE_NAME)) ENGINE=InnoDB;

CREATE TABLE QRTZ_LOCKS ( SCHED_NAME VARCHAR(60) NOT NULL, LOCK_NAME VARCHAR(40) NOT NULL, PRIMARY KEY (SCHED_NAME,LOCK_NAME)) ENGINE=InnoDB;

CREATE INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS(SCHED_NAME,REQUESTS_RECOVERY); CREATE INDEX IDX_QRTZ_J_GRP ON QRTZ_JOB_DETAILS(SCHED_NAME,JOB_GROUP);

CREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP); CREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS(SCHED_NAME,JOB_GROUP); CREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS(SCHED_NAME,CALENDAR_NAME); CREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP); CREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE); CREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_STATE); CREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_GROUP,TRIGGER_STATE); CREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS(SCHED_NAME,NEXT_FIRE_TIME); CREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS(SCHED_NAME,TRIGGER_STATE,NEXT_FIRE_TIME); CREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME); CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE); CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS(SCHED_NAME,MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE);

CREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME); CREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,INSTANCE_NAME,REQUESTS_RECOVERY); CREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_NAME,JOB_GROUP); CREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,JOB_GROUP); CREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); CREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME,TRIGGER_GROUP);

commit;


# 搭建网站,服务器指向

- 修改模块的服务器指向:`192.168.8.109:8080/ebx-bishop/data/carry`
- 通过软件重启模块
- 创建目录:`sudo mkdir -p /var/www/znzm`
- 为登录用户配权限:`sudo chown dingding:dingding /var/www/znzm`
- 取消`Program`中的代码注释,修改`Startup`中有关`Quartz`的配置,发布网站
- 给目录分配权限:`sudo chmod -R 777 /var/www`
- 把发布网站拷贝到服务器的`znzm`目录。使用FileZilla。
- 修改`appsettings.json`文件

192.168.8.109 cloudgo:0, shixugo:0

- 运行网站
- 确认`teche`数据库
- 在'kaiguanapplication'中增加一条记录,名称为`照明`
- 确认`techeusr`数据库
- 确认`redis`数据库

打开客户端:redis-cli 地址:127.0.0.1:6379 对外地址:192.168.8.109:6379 teche123 登录:auth teche123 查看键的数量:dbsize 列出所有的key:keys (当key多的时候不要轻易用) 列出某个key: keys apple 获取某个键值:get … 让外界可访问:#bind 127.0.0.1 protected-mode:no 重启:sudo systemctl restart redis 查看状态:sudo systemctl status redis 诺德:option.Configuration = $“{Configuration[“App:redis”]}:6321,password=_ebx_cnto_r_srv”;

- 确认`quartznet`

诺德:Port=3306;Database=quartznet;Uid=root;Pwd=lcDb_!@34%^_Mantunsci;SslMode=none 胶州:Port=3306;Database=quartznet;Uid=dd;Pwd=dd@123;SslMode=none

- 关闭网站,把`Program`中的种子数据部分注释掉
- 网站默认账号

管理员:13800000000 TecheFwd2018 设备工作人员:shebei 888888 ```

  • 登录网站:192.168.8.109:8080
  • 管理员分配菜单权限
  • 创建项目楼层区域电箱开关:利群胶州购物广场
  • 测试可视化:先把可视化删除,再进入