vps配置jupyterlab远程访问服务

vps配置jupyterlab远程访问服务 撸了个小鸡鸡,打算用来做jupyter server,在此记录下此次配置全过程。 安装JupyterLab # 更新系统 apt update&&apt upgrade -y # 安装python apt install python3 #安装JpyterLab和中文语言 pip3 install jupyterlab jupyterlab-language-pack-zh-CN 配置jupyterlab 生成配置文件,存放路径为.jupyter/jupyter_lab_config.py root@hcss-ecs-279f:~# jupyter lab --generate-config Writing default config to: /root/.jupyter/jupyter_lab_config.py 编辑配置文件vi .jupyter/jupyter_lab_config.py,参考以下配置 # 允许任意IP访问 c.ServerApp.allow_origin = '*' c.ServerApp.ip = '0.0.0.0' # 自定义端口号 c.ServerApp.port = 8888 # 允许root运行 c.ServerApp.allow_root = True 下来设置访问密码 root@hcss-ecs-279f:~# jupyter lab password Enter password: Verify password: [JupyterPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_server_config.json 然后就可以使用jupyter lab来运行服务。 root@hcss-ecs-279f:~# jupyter lab ... ... [I 2025-04-10 10:41:35.533 ServerApp] jupyterlab | extension was successfully loaded. [I 2025-04-10 10:41:35.536 ServerApp] notebook | extension was successfully loaded. [I 2025-04-10 10:41:35.537 ServerApp] Serving notebooks from local directory: /root [I 2025-04-10 10:41:35.537 ServerApp] Jupyter Server 2.15.0 is running at: [I 2025-04-10 10:41:35.537 ServerApp] http://hcss-ecs-279f:9876/lab [I 2025-04-10 10:41:35.537 ServerApp] http://127.0.0.1:9876/lab ... ... 按提示通过IP:9876方式来远程访问JupyterLab服务即可。 ...

四月 10, 2025 · JQX

Debian12安装fail2ban加固服务器安全

Debian12安装fail2ban加固服务器安全 fail2ban 是一款用于保护服务器免受暴力破解攻击的工具,通过监控日志文件检测恶意行为,并自动触发防火墙规则封禁可疑 IP。 Debian12下安装fail2ban过程如下: 先安装必备软件 apt install git python3 python3-setuptools 从源码安装fail2ban git clone https://github.com/fail2ban/fail2ban.git cd fail2ban sudo python setup.py install systemd设置fail2ban服务 cd fail2ban cp ./build/fail2ban.service /etc/systemd/system/ systemctl enable fail2ban systemctl start fail2ban 检查服务状态 root@box:~# systemctl status fail2ban.service * fail2ban.service - Fail2Ban Service Loaded: loaded (/etc/systemd/system/fail2ban.service; enabled; preset: enabled) Active: active (running) since Tue 2025-04-08 02:54:18 CDT; 12min ago Docs: man:fail2ban(1) Process: 2066 ExecStartPre=/bin/mkdir -p /run/fail2ban (code=exited, status=0/SUCCESS) Main PID: 2067 (fail2ban-server) Tasks: 3 (limit: 352) Memory: 12.8M CPU: 195ms CGroup: /system.slice/fail2ban.service `-2067 /usr/bin/python3 /usr/local/bin/fail2ban-server -xf start Apr 08 02:54:18 box systemd[1]: Starting fail2ban.service - Fail2Ban Service... Apr 08 02:54:18 box systemd[1]: Started fail2ban.service - Fail2Ban Service. Apr 08 02:54:19 box fail2ban-server[2067]: Server ready ssh配置实例,新建/etc/fail2ban/jail.local文件,内容如下: ...

四月 8, 2025 · JQX

树莓派显示天气信息RARP

在此介绍一个国外网友的树莓派项目RARP,Weather According to Raspberry Pi 顾名思义,Weather According to Raspberry Pi是一个有关天气信息的项目,该项目通过采集Raspberry Pi和Sense HAT的数据,来显示相关的天气信息,比如温度、湿度、压力等 项目地址http://coded2.herokuapp.com/weather/ 代码国内下载地址</res/warp_final.zip> 下载后解压,得到main.py和gauge2.html两个文件,其中main.py需要Python3运行,gauge2.html是最终的显示文件 安装相关软件 sudo apt-get install python3 sudo apt-get install python3-pip pip3 install flask 打开Sense HAT仿真器,在程序菜单中,打开后如下图示: 下来,运行下载的python脚本 python3 main.py 正常情况下,会提示一个端口为5000的web服务正在运行 在浏览器中浏览localhost:5000或者127.0.0.1:5000,最终的浏览如下图 三个图表分别显示温度、压力和湿度,这三者的信息均来自Sense HAT 模拟器而不是真正的Sense HAT硬件。 如果需要采集Sense HAT扩展板的数据,需要将Sense HAT附加板和Raspberry Pi相连,具体信息参考官网 https://www.raspberrypi.org/products/sense-hat/ 然后修改代码,打开main.py文件,找到如下行 from sense_emu import SenseHat 修改为 from sense_hat import SenseHat 保存后,重新运行python3 main.py,此时采集的数据就来自真实的SenseHAT硬件。

五月 25, 2017 · JQX