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 · JQ

screen使用详解

screen使用详解 Screen是一个全屏窗口管理器,它在多个进程之间多路复用物理终端。每个虚拟终端都提供DEC VT100终端的功能,此外,还提供 ANSI X3.64 (ISO 6429) 和 ISO 2022 标准的多项控制功能(例如,插入/删除行和支持多个字符集)。 每个虚拟终端都有一个回滚历史缓冲区和一个复制和粘贴机制,允许用户在窗口之间移动文本区域。当screen被调用时,它会创建一个带有 shell(或指定命令)的窗口,以便你可以像往常一样使用该程序。然后,您可以随时创建包含其他程序(包括更多 shell)的新(全屏)窗口、终止当前窗口、查看活动窗口列表、打开和关闭输出日志记录、在窗口之间复制文本、查看回滚历史记录、在窗口之间切换等。所有窗口都完全独立于彼此运行其程序。 安装screen screen是默认的gun utils,很多linux系统默认都安装了,如果没有可使用如下命令安装 # debian based apt install screen # redhat based yum install screen # or dnf install screen # 检查screen版本 root@hcss-ecs-279f:~# screen -v Screen version 4.09.00 (GNU) 30-Jan-22 使用screen 使用screen命令不带任何参数即可新建打开一个session。 每个session都有如[pid.sessionname]的命名,其中pid为唯一生成的id,而默认生成的sessionname由tty和host名组成。 session有两种状态: Attached 正在使用的激活态 Detached 后台运行的非激活态 如下,使用screen -ls查看session列表,会发现一个pid为1489名为pts-3.hcss-ecs-279f的session,状态为Attached。 root@hcss-ecs-279f:~# screen -ls There is a screen on: 1489.pts-3.hcss-ecs-279f (04/09/2025 04:45:13 PM) (Attached) 1 Socket in /run/screen/S-root. root@hcss-ecs-279f:~# 命名session 为了便于管理,可以使用-S选项来指定session名称,如下新建了一个名为toby的session ...

四月 9, 2025 · JQ

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 · JQ

tinc异地组网使用实例

tinc异地组网使用实例 tinc是一个组建虚拟专用网络(VPN)的工具,通过隧道及加密技术在互联网上点与点之间创建专有网络。tinc 在网络层工作,因此无需对现有软件进行修改和配置。其数据通讯经过加密和压缩,能避免敏感数据和隐私的泄露。 vps主机安装设置tinc debian系统 公网ip 12.23.34.45 vpn名称 bbq vpn主机名 tcb vpn ip 10.0.0.11 安装tinc 使用apt install tinc -y安装tinc ➜ ~ apt install tinc -y Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: liblzo2-2 The following NEW packages will be installed: liblzo2-2 tinc 0 upgraded, 2 newly installed, 0 to remove and 6 not upgraded. Need to get 261 kB of archives. After this operation, 831 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian bookworm/main amd64 liblzo2-2 amd64 2.10-2 [56.9 kB] Get:2 http://deb.debian.org/debian bookworm/main amd64 tinc amd64 1.0.36-2+b2 [204 kB] Fetched 261 kB in 0s (2,189 kB/s) Selecting previously unselected package liblzo2-2:amd64. (Reading database ... 56790 files and directories currently installed.) Preparing to unpack .../liblzo2-2_2.10-2_amd64.deb ... Unpacking liblzo2-2:amd64 (2.10-2) ... Selecting previously unselected package tinc. Preparing to unpack .../tinc_1.0.36-2+b2_amd64.deb ... Unpacking tinc (1.0.36-2+b2) ... Setting up liblzo2-2:amd64 (2.10-2) ... Setting up tinc (1.0.36-2+b2) ... Created symlink /etc/systemd/system/multi-user.target.wants/tinc.service → /lib/systemd/system/tinc.service. Processing triggers for man-db (2.11.2-2) ... Processing triggers for libc-bin (2.36-9+deb12u9) ... 新建vpn配置目录 以vpn名称新建配置目录 ...

三月 31, 2025 · jqx

使用Cloudflare Zero Trust实现网页登录SSH

使用Cloudflare Zero Trust实现网页登录SSH 首先登录https://one.dash.cloudflare.com/ 网络->Tunnels,创建隧道,隧道类型选择Cloudflared,隧道名自定义hhssh。 按照提示安装cloudflared并连接隧道,vps在这里选择debian,然后按照提示安装cloudflared并运行。 curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared.deb && sudo cloudflared service install eyJhIjoiOWRmMjczNGM3NjI3ZTNiMmZh 连接成功后,页面下方 Connectors 会显示当前已连接的设备。 下一步,开始设置公共主机名。 子域中自定义hhssh,域选择自有域名,路径(path)留空,服务类型选择SSH,URL里填写localhost:22,其中22为服务器ssh端口,按照实际情况设置,保存隧道。 Access->应用程序,添加应用程序。 应用程序类型选择 自托管,基本信息中应用程序名设置为hhssh,会话持续时长默认24小时,可自定义。 点击添加公共主机名,同上述Tunnels域名设置即可,点击下一步,在最后高级设置中,浏览器呈现设置中选择SSH保存设置。 下来设置邮箱验证策略,Access->策略,添加策略。 策略名自定义emailauth,操作为允许(allow),添加规则中,选择器设置为Emails,值中填写自己用来接收验证码的邮箱地址,保存。 Access->应用程序,选择刚建立的hhss,右侧三点菜单,编辑配置,在策略tab中,点击选择现有策略,勾选刚才新建的emailauth即可。 通过域名hhssh.0x8.net来登录页面,会提示输入邮箱接收验证码,输入验证码后即可按提示输入服务器账号密码来登录ssh。 享受你的webssh之旅吧!

一月 23, 2025 · jqx