基于centos7.6的物联网构建(二)jupyter与MQTT

1.为服务器安装 jupyter 方便远程调试

1.1 pip 安装

pip3 install jupyter mysql-connector

1.2 配置 jupyter

生成配置文件

# root
jupyter notebook --generate-config --allow-root

# 非root
jupyter notebook --generate-config

生成的配置文件在 /root/.jupyter/ 目录下(根据你的Linux账号而定)

修改配置文件

vi /root/.jupyter/jupyter_notebook_config.py

然后修改以下配置(去掉#号,并修改):

# 允许所有IP访问
c.NotebookApp.ip = '*'
#允许用户以root用户身份运行
c.NotebookApp.allow_root = True
# 启动时是否自动打开浏览器
c.NotebookApp.open_browser = False
# 指定端口号
c.NotebookApp.port = 8888
# jupyter的工作目录
c.ContentsManager.root_dir = '/root/jupyter_run/'

设置密码

jupyter notebook password

启动

jupyter notebook
nohup jupyter notebook > /root/www/logs/jupyter.log 2>&1 &
nohup python3 /root/www/jupyter_run/wx_access_token_loop.py > /root/www/logs/wx_access_token_loop.log 2>&1 &
nohup python3 /root/www/jupyter_run/baidu_access_token_loop.py > /root/www/logs/baidu_access_token_loop.log 2>&1 &
#后台保持
/dev/null
nohup jupyter notebook > /dev/null 2>&1 &
nohup python3 /root/www/jupyter_run/wx_access_token_loop.py > /dev/null 2>&1 &
nohup python3 /root/www/jupyter_run/baidu_access_token_loop.py > /dev/null 2>&1 &

此时,就可以打开浏览区,输入ip:8888进入 jupyter 界面

2.安装git

yum -y install git

3.SSL证书管理

3.1创建文件夹存放SSL根文件

mkdir ssl_certificate

存入根文件
*.key, *.pem

3.2修改nginx配置文件

vi /etc/nginx/nginx.conf
# Settings for a TLS enabled server.

    server {
        listen       443 ssl http2;
        listen       [::]:443 ssl http2;
        server_name  *;
        root         /usr/share/nginx/html;

        ssl_certificate "/root/www/ssl_certificate/*.pem";
        ssl_certificate_key "/root/www/ssl_certificate/*.key";
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;
    }

4.部署MQTT

4.1下载emqx

wget https://www.emqx.com/zh/downloads/broker/5.8.2/emqx-5.8.2-el7-amd64.tar.gz
或
wget https://zedutech.top/static/apps/emqx-5.8.2-el7-amd64.tar.gz

4.2安装

mkdir -p emqx && tar -zxvf emqx-* -C emqx

4.3启动

./emqx/bin/emqx start

4.4端口说明

端口说明
1883MQTT 协议端口
8080HTTP API 端口
8083MQTT/WebSocket 端口
8883MQTT/SSL 端口
18083Dashboard 管理控制台端口
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dai_ding

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值