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
相关推荐
sunoo-2294 小时前
【Linux 系统编程】学习第七天:线程属性 | 互斥锁 | 死锁 | 信号量 核心知识点 + 踩坑实战
linux·c语言·笔记·vscode·学习
Zkaisen4 小时前
【Gitee】SSH 公钥、GPG 公钥、私人令牌的区别
运维·gitee·ssh
铁手飞鹰4 小时前
VSCode Python .embed 嵌入式环境黄色波浪线问题
ide·vscode·python
吴可可1235 小时前
VSCode助力机械臂轨迹开发
vscode
意法半导体STM326 小时前
【官方原创】LAT1695转换STM32CubeIDE工程到STM32CubeIDE for Visual Studio Code
vscode·stm32·单片机·嵌入式硬件
Molesidy6 小时前
【Embedded Development】基于VSCode+IAR插件的IAR工程开发环境的搭建
ide·vscode·编辑器
dozenyaoyida9 小时前
无外网 Linux 服务器离线安装 VS Code Remote-SSH 指南(新版双包机制 + commit 一致)
ssh·vs code·嵌入式开发·clangd·离线安装·remote-ssh
BugShare10 小时前
告别来回切换,Navop:一站式整合数据库、SSH、终端与 AI 的开发运维工作台
运维·数据库·ssh
郴墨11 小时前
Ubuntu 24.04 配置大量ip及ssh远程
tcp/ip·ubuntu·ssh