zoukankan      html  css  js  c++  java
  • VS Code 搭建远程调试Shell环境(Remote Linux)

    安装Remote Development插件

    1. 在本机安装Remote Development
    2. 重启VS Code,看到左侧导航新增:『远程资源管理器』
    3. 在『远程资源管理器』连接服务器,略

    安装语法提示插件:shellman

    • 本机安装shellman,略

    安装格式化插件:shell-format(右键 -> 格式化文档(Ctrl + Alt + L))

    1. 在远程服务器上,VS Code安装shell-format
    2. 服务器安装:shfmt(shell-format依赖于安装shfmt)
    3. 网速好会自动安装shfmt,否则手动安装,查看:4
    4. 进入安装shfmt,下载shfmt_v3.0.1_linux_amd64,复制到服务器,并在服务器执行
    # 把shfmt_v3.0.1_linux_amd64移动到/root/.vscode-server/extensions/foxundermoon.shell-format-7.0.1/bin(具体路径可在VS Code查看)
    mv shfmt_v3.0.1_linux_amd64 /root/.vscode-server/extensions/foxundermoon.shell-format-7.0.1/bin
    
    # 添加权限
    chmod a+x /root/.vscode-server/extensions/foxundermoon.shell-format-7.0.1/bin/shfmt_v3.0.1_linux_amd64
    

    安装语法错误检查插件:shellcheck

    • 在远程服务器上,VS Code安装shell-format

    安装语法错误检查插件:Code Runner

    • 在远程服务器上,VS Code安装Code Runner

    配置免密码登录

    1. 在本机上生成ssh秘钥:
    ssh-keygen -t rsa -b 4096 
    
    1. 在服务器上把公钥(路径为:C:Users<UserName>.sshid_rsa.pub)写入.ssh/authorized_keys

    2. 设置权限

    chmod 700 .ssh
    chmod 600 .ssh/authorized_keys
    
    1. 在VS Code编辑配置文件(config):
    Host yourdomain.com
      HostName yourdomain.com
      User root
      IdentityFile C:Users<UserName>.sshid_rsa
    
  • 相关阅读:
    oh forever love~
    PostgreSQL数据库忘记密码的解决方案
    vue
    无法启动postgresql的错误
    Goaccess解析nginx日志备忘
    pg备份恢复与设置编码
    django+uwsgi+nginx+postgresql备忘
    Git 直接推送到生产服务器
    为了性能, 数据操作尽量在数据库层面进行
    简单理解call_user_func和call_user_func_array两个函数
  • 原文地址:https://www.cnblogs.com/testopsfeng/p/13945846.html
Copyright © 2011-2022 走看看