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端口说明
端口 | 说明 |
---|---|
1883 | MQTT 协议端口 |
8080 | HTTP API 端口 |
8083 | MQTT/WebSocket 端口 |
8883 | MQTT/SSL 端口 |
18083 | Dashboard 管理控制台端口 |