温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何在ubuntu 1h3g云主机上安装vscodeonline

发布时间:2021-11-16 11:22:06 来源:亿速云 阅读:149 作者:小新 栏目:云计算

这篇文章主要介绍了如何在ubuntu 1h3g云主机上安装vscodeonline,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

基础

一些变量

MIRROR_PATH="http://default-8g95m46n2bd18f80.service.tcloudbase.com/d/demos"
# the code-server web ide
CODE_SERVER_PATH=${MIRROR_PATH}/codeserver

安装codeserver

脚本被做成融合成安装pai和openfaas的风格,按standalone方式安装,以root身份运行。你可以集成自己需要的语言和插件服务到这个IDE,以做到尽量开箱即用。

# install codeserver
installCodeserver() {

    echo "=====================codeserver install progress======================="
    msg=$(mkdir -p ~/.local/lib/code-server-3.5.0
    wget --no-check-certificate -qO- ${CODE_SERVER_PATH}/v3.5.0/code-server-3.5.0-linux-amd64.tar.gz > /tmp/code-server-3.5.0-linux-amd64.tar.gz && tar  -xvf /tmp/code-server-3.5.0-linux-amd64.tar.gz -C ~/.local/lib/code-server-3.5.0 --strip-components=1
    rm -rf /tmp/code-server-3.5.0-linux-amd64.tar.gz
    ln -s ~/.local/lib/code-server-3.5.0/bin/code-server ~/.local/bin/code-server
    PATH="~/.local/bin:$PATH"

   # systemd service start
    rm -rf ~/.config/code-server/config.yaml
    cat << 'EOF' > ~/.config/code-server/config.yaml

bind-addr: 0.0.0.0:5000
auth: password
password: pleasecorrectme
cert: false
EOF

   # systemd service start
    rm -rf /etc/systemd/system/code-server.service
    cat << 'EOF' > /etc/systemd/system/code-server.service

[Unit]
Description=code-server
After=network.target

[Service]
Type=exec
ExecStart=~/.local/bin/code-server
Restart=always
User=root

[Install]
WantedBy=default.target
EOF

    systemctl daemon-reload && systemctl enable code-server
    systemctl start code-server 2>&1)
    status=$?
    updateProgress 95 "$msg" "$status" "code-server install"
}

安装完成后记得修改~/.config/code-server/config.yaml下的密码,端口为5000。如果你要用上证书,就最好搭配脚本中的nginx+certbot申请的那个。cert: false也可以用假的localhost的那个,但是基本没有什么用。


其实,利用那个remote-container,可以把openfaas-cli跟vscode连起来,利用工程源文件下的yml模板(.pai.yml,openfaas-cli.yml,etc...)文件打造一个带开发部署的工程资源组织文件,形成remote-openfaas效果:多环境多语言下,需要频繁切换环境,一次开发总是跟一次塔环境开始的,这也是vagrant和docker对于开发的意义(以前是vm,没有模板机制),而docker用于开发也用于部署。以后一套APP天然就有一个online webide守护,自带开发环境了。

感谢你能够认真阅读完这篇文章,希望小编分享的“如何在ubuntu 1h3g云主机上安装vscodeonline”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI