xshell 隧道 jupyter
时间: 2023-11-06 17:57:04 浏览: 187
xshell可以通过设置隧道来连接Jupyter Notebook。首先,在xshell界面上安装Jupyter Notebook,并可以选择将其安装在anaconda虚拟环境中。然后,在xshell的会话设置中添加隧道,将目标端口设置为8888,侦听端口可以随意选择,比如1234。接下来,启动Jupyter Notebook,并在浏览器中登录127.0.0.1:1234。最后,在启动页面将token粘贴过去即可成功连接。
相关问题
用xshell建jupyternotebook
在使用XShell连接到远程服务器并建立Jupyter Notebook环境,通常需要几个步骤:
1. **安装XShell**: XShell是一个终端仿真程序,如果你还没有安装,可以从其官方网站下载并安装。
2. **登录远程服务器**: 在XShell中输入远程服务器的IP地址或域名,然后输入用户名和密码进行登录。
3. **配置SSH隧道(可选)**: 如果你的服务器不直接开放Jupyter Notebook的访问端口,你可以通过SSH隧道(如LocalPortForwarding)将本地的一个端口映射到服务器的Jupyter Notebook端口。在XShell的"Session" -> "Tunnels"中设置这个映射。
4. **安装Jupyter Notebook**: 在服务器上,打开终端(或通过SSH连接),使用`sudo apt-get install jupyter notebook` 或 `pip install jupyter notebook` (取决于操作系统和Python版本)命令安装Jupyter Notebook。
5. **启动Jupyter Notebook**: 安装完成后,使用命令`jupyter notebook --no-browser --ip=0.0.0.0` 启动Jupyter Notebook。`--no-browser` 表示不自动打开浏览器,`--ip=0.0.0.0` 让笔记本能在所有网络接口上监听。
6. **访问Jupyter Notebook**: 如果使用了SSH隧道,你应该能在本地的某个指定端口看到Jupyter Notebook的界面,如果没有隧道,通常可以在服务器的本地IP地址加上默认的5000端口访问(如`http://localhost:8888`或通过SSH的端口映射)。
xshell隧道 浏览器
### 如何使用 Xshell 设置隧道连接浏览器
为了使本地计算机能够访问远程服务器上运行的服务(如TensorBoard),可以利用Xshell配置SSH隧道来实现端口转发。以下是具体方法:
#### 配置动态应用层网关(DAG)
创建新的会话或编辑现有会话,在“连接”选项卡下的高级设置里找到“DAG代理”,勾选启用SOCKS v5 DAG代理并指定一个未被占用的本地监听端口号,比如1080。
```bash
ssh -D 1080 user@remote_host_ip_address
```
此命令将在本机开启 SOCKS5 代理服务[^2]。
#### 使用HTTP/HTTPS请求转发至目标地址
如果目的是让特定Web应用程序可通过浏览器安全地浏览,则应采用局部端口转发方式。假设远程机器上的TensorBoard正在监听`http://localhost:6006`:
- 打开Xshell新建会话或者选择已有会话;
- 进入“隧道”标签页点击添加按钮;
- 类型选择为“本地”,源主机留空表示任何来源都允许访问该隧道;
- 将本地端口设为你希望使用的任意可用数值,例如7007;
- 目标主机填写成 `127.0.0.1` 并把远端端口设定为目标程序实际使用的端口数即6006;
完成上述操作保存更改后即可尝试通过 http://127.0.0.1:7007 访问远程部署的应用界面。
#### 测试连通性
确保防火墙规则允许必要的流量传输,并验证所配置的各项参数无误之后,就可以在个人电脑上的网络设置中配置相应的代理或是直接输入映射后的URL进行测试了。
阅读全文
相关推荐














