当前位置: 首页 > article >正文

L0G1000 Linux 基础知识

1.创建虚拟机

构建完成后

 按需启动,本次启动30分钟,启动完成后出现下图界面。

点击进入开发机,出现初始界面。

 

 2. 配置SSH密钥进行SSH远程连接

2.1打开Windows PowerShell,利用

ssh-keygen -t rsa

输入命令后一路回车就可以了,这里的密钥默认情况下是生成在~/.ssh/目录下的,~表示的是家目录,如果是windows就是C:\Users\{your_username}\。在powerShell中可以使用Get-Content命令查看生成的密钥,如果是linux操作系统可以使用cat命令。

然后我们回到开发机平台,在首页点击配置SSH Key,接着点击添加SSH公钥

2.2端口映射

端口映射是一种网络技术,它可以将外网中的任意端口映射到内网中的相应端口,实现内网与外网之间的通信。通过端口映射,可以在外网访问内网中的服务或应用,实现跨越网络的便捷通信。

那么我们使用开发机为什么要进行端口映射呢?

因为在后续的课程中我们会进行模型web_demo的部署实践,那在这个过程中,很有可能遇到web ui加载不全的问题。这是因为开发机Web IDE中运行web_demo时,直接访问开发机内 http/https 服务可能会遇到代理问题,外网链接的ui资源没有被加载完全。

 

在powdshell中输入

ssh -p 端口号 root@ssh.intern-ai.org.cn -CNg -L {本地机器_PORT}:127.0.0.1:{开发机_PORT} -o StrictHostKeyChecking=no

可以实现端口映射。现在以hello_world.py为例进行测试端口映射。

import socket
import re
import gradio as gr
 
# 获取主机名
def get_hostname():
    hostname = socket.gethostname()
    match = re.search(r'-(\d+)$', hostname)
    name = match.group(1)
    
    return name
 
# 创建 Gradio 界面
with gr.Blocks(gr.themes.Soft()) as demo:
    html_code = f"""
            <p align="center">
            <a href="https://intern-ai.org.cn/home">
                <img src="https://intern-ai.org.cn/assets/headerLogo-4ea34f23.svg" alt="Logo" width="20%" style="border-radius: 5px;">
            </a>
            </p>
            <h1 style="text-align: center;">☁️ Welcome {get_hostname()} user, welcome to the ShuSheng LLM Practical Camp Course!</h1>
            <h2 style="text-align: center;">😀 Let’s go on a journey through ShuSheng Island together.</h2>
            <p align="center">
                <a href="https://github.com/InternLM/Tutorial/blob/camp3">
                    <img src="https://oss.lingkongstudy.com.cn/blog/202410081252022.png" alt="Logo" width="50%" style="border-radius: 5px;">
                </a>
            </p>

            """
    gr.Markdown(html_code)

demo.launch()

 在终端运行python hello_world.py,提示没有安装gradio.

pip install gradio==4.29.0

安装依赖

在运行python hello_world.py

运行出错。需要配置 端口映射

在powershell中输入

 


http://www.kler.cn/news/360636.html

相关文章:

  • 长短期记忆网络(Long Short-Term Memory,LSTM)
  • 跨境电商批量自养号测评是怎么做到的?
  • 鸿蒙开发案例:绘制中国象棋棋盘与棋子的技术教程
  • 为什么springboot项目更多的选择了SpringSecurity,而不是Shiro?
  • 【WebLogic】WebLogic 14c控制台密码文件权限问题分享
  • 2019年计算机网络408真题解析
  • CFG 蒸馏:On Distillation of Guided Diffusion Models
  • 【景观生态学实验】实验四 景观指数计算
  • multi-Head Attention
  • Vue--》掌握自定义依赖引入的最佳实践
  • blender 理解 积木组合 动画制作 学习笔记
  • C# 数据集
  • sql server xml
  • Egg.js使用ejs快速自动生成resetful风格的CRUD接口
  • 数据门户:企业数字化转型的关键作用
  • Oracle里面,with ... as 用法介绍
  • 软考系统分析师知识点十三:软件需求工程
  • 【论文笔记】Adversarial Diffusion Distillation
  • Flux.using 使用说明书
  • LeetCode第101题. 对称二叉树