3、ssh、jupyter、vscode在Linux部署

这里写目录标题

1、ssh

复制代码
# ssh 安装 
apt-get update
apt-get install openssh-server -y
apt-get install openssh-client -y
apt-get install ssh -y
apt-get install vim -y
passwd
vim /etc/ssh/sshd_config
# 在sshd_config 中加入一下代码, 注意单词拼写
        PermitRootLogin yes
        port=22       
        PubkeyAuthentication yes
        PasswordAuthentication yes
service ssh restart 

开机启动

链接:https://blog.csdn.net/qq_38603541/article/details/124028994

1、正常我们在linux操作系统内设置服务自启动的方法一般都是使用systemctl。

systemctl enable ssh

2、但是,一般在docker容器内我们一般不这么干,因为容器内没有systemctl权限......

4、在 /root 目录下新建一个 start_ssh.sh文件,并给予该文件可执行权限。

复制代码
touch /root/start_ssh.sh
vim /root/start_ssh.sh
chmod +x /root/start_ssh.sh

5、start_ssh.sh 脚本的内容,如下:

shell 复制代码
#!/bin/bash
 
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
echo "[$LOGTIME] startup run..." >>/root/start_ssh.log
service ssh start >>/root/start_ssh.log
#service mysql start >>/root/star_mysql.log   //其他服务也可这么实现

5、将start_ssh.sh脚本添加到启动文件中

vim /root/.bashrc

shell 复制代码
# startup run
if [ -f /root/ssh/start_ssh.sh ]; then
     bash /root/ssh/start_ssh.sh >/root/ssh/error.log 2>&1
fi

重启ssh服务

service ssh restart

systemctl restart sshd

2、Jupyter

复制代码
#安装jupyter
pip install jupyter

#生成jupyter配置文件,这个会生成配置文件.jupyter/jupyter_notebook_config.py
jupyter notebook --generate-config

#使用python交互窗口生成密码
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password: 
Verify password: 
Out[2]: 'sha1:******'

#去配置文件.jupyter/jupyter_notebook_config.py中修改以下参数
c.NotebookApp.ip='*'                          #绑定所有地址
c.NotebookApp.password = u'刚才生成的密码'
c.NotebookApp.open_browser = False            #启动后是否在浏览器中自动打开
c.NotebookApp.port =8888                      #指定一个访问端口,默认8888,注意和映射的docker端口对应

#启动jupyter 服务
cd  /你想要保存脚本的路径
jupyter notebook --allow-root

#后台运行jupyter notebook
jupyter notebook --allow-root > jupyter.log 2>&1 &
# 关闭
ps -axu | grep jupyter 
kill -9 PID

3、vscode网页版

项目地址:https://github.com/coder/code-server?tab=readme-ov-file

bash 复制代码
使用安装 脚本,其中 自动化大部分流程。如果出现以下情况,则该脚本使用系统包管理器 可能。
如果使用安装脚本,则可以预览安装过程中发生的情况 过程:

curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
要安装,请运行:
curl -fsSL https://code-server.dev/install.sh | sh

#运行
export PASSWORD="配置一个密码"
code-server --port 8888 --host 0.0.0.0 --auth password
参考博客:https://blog.csdn.net/muxuen/article/details/130334319

如何在VSCode中添加Python解释器

步骤1:安装Python插件

在开始之前,你需要在VSCode中安装Python插件。以下是如何做到这一点的步骤:

  1. 打开VSCode。
  2. 点击左侧工具栏上的Extensions按钮(四个方块组成的图标)。
  3. 在搜索框中输入"Python"。
  4. 在搜索结果中找到"Python",点击"Install"按钮。

步骤2:打开命令面板

接下来,你需要打开VSCode的命令面板。可以通过以下步骤实现:

  1. 在VSCode中,按F1键或组合键Ctrl+Shift+P打开命令面板。

步骤3:选择Python解释器

在命令面板中,你可以选择Python解释器。以下是操作步骤:

  1. 在命令面板中,输入"Python: Select Interpreter"并回车。
  2. 在弹出的列表中,选择你希望使用的Python解释器。
    链接:https://blog.csdn.net/Dontla/article/details/112655378
相关推荐
埃博拉酱11 天前
VS Code Remote SSH 连接 Windows 服务器卡在"下载 VS Code 服务器":prcdn DNS 解析失败的诊断与 BITS 断点续传
windows·ssh·visual studio code
zhangfeng113312 天前
趋动云 如何ssh登录 服务区 项目server
运维·人工智能·ssh
Hello World . .12 天前
Linux:线程间通信
linux·开发语言·vscode
被制作时长两年半的个人练习生12 天前
claude code for vscode 配置 qwen3.5
ide·vscode·claude code·qwen3.5
开发者小天12 天前
python中使用jupyter notebook 绘制正态分布直方图 密度图 小提琴图 模仿企鹅喙长分布图
开发语言·python·jupyter
圣心12 天前
Visual Studio Code 中的 AI 智能操作
ide·人工智能·vscode
吹牛不交税12 天前
关于vscode左侧资源管理器目录层级疑似异常的问题
ide·vscode·编辑器
嵌入小生00712 天前
线程间通信---嵌入式(Linux)
linux·c语言·vscode·嵌入式·互斥锁·线程间通信·信号量
txzz888812 天前
CentOS-Stream-10 Secure Shell服务器
linux·centos·ssh·secure shell·ssh服务器
琛説12 天前
彻底解决 Codex / Copilot 修改中文乱码【含自动化解决方案】
vscode·copilot·codex