网站首页 > 精选文章 正文
背景
目前在公司运维开发中逐步使用golang作为首选语言,同时使用vscode+插件作为开发环境,最近的一个项目就是用beego开发的,目前使用的数据量和goroutine都比较大了,办公机已经开始变得比较卡,所以今天研究一下vscode的remote ssh+golang环境设置。
Centos7 Server 配置
安装go环境
# wget https://dl.google.com/go/go1.12.7.linux-amd64.tar.gz
# tar -C /usr/local -xzf go1.12.7.linux-amd64.tar.gz
# echo 'export PATH=$PATH:/usr/local/go/bin' > /etc/profile.d/golang.sh
升级git2.x,vscode推荐用git 2.x
# yum remove git -y
# yum install -y https://centos7.iuscommunity.org/ius-release.rpm
# yum -y install git2u-all gitflow
# git version
git version 2.16.5
配置用户环境
# useradd xxx
# passwd xxx 这里配置用户xxx的密码
# su - xxx
$ mkdir -p go/{src,bin,pkg}
$ echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.bash_profile
$ echo 'export GOPATH=$HOME/go' >> ~/.bash_profile
配置git https免密
$ echo 'https://username:password@gitlab.domain' > ~/.git-credentials
$ git config --global credential.helper store --file ~/.git-credentials
下面配置git让其和windows git提示符一致,如果不需要可以跳过
$ wget -O .git-completion.bash https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
$ wget -O .git-prompt.sh https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
$ echo 'export ~/.git-completion.bash' >> ~/.bashrc
$ echo 'export ~/.git-prompt.sh' >> ~/.bashrc
$ echo "export PS1='\[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$ '" >> ~/.bashrc
部署代码和工具
$ cd go/src/
$ git clone https://gitlab.domain/xxx/projectname
$ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh # install dep tool
$ go get github.com/beego/bee # install beego bee
$ cd projectname
$ dep ensure # run dep ensure download dependency
办公机配置
配置ssh免密登录
# 在办公机上运行
ssh-copy-id xxx@centos7_server_ip
vscode配置
- 安装vscode-remote-extensionpack
2. 配置ssh server
3. 安装扩展
?
好了,现在开始coding
猜你喜欢
- 2025-01-14 “告别 Neovim!为什么我投奔了刚开源的 Zed 编辑器?”
- 2025-01-14 安装 Go 和VSCode并配置环境详细记录
- 2025-01-14 用好这14个vscode必用插件
- 2025-01-14 VS Code当中的15个神仙插件,值得收藏
- 2025-01-14 使用 vscode 把 markdown 转换成带目录的 pdf
- 2025-01-14 苹果Mac用户狂喜!ChatGPT深度集成应用,最后再藏AGI彩蛋
- 2025-01-14 装上这10个vscode插件,python才真的是无敌的存在
- 2025-01-14 微软悄悄发布了 Web 版的 VSCode
- 2025-01-14 Vue3+TSX手撸Element Tree升级版
- 2025-01-14 程序员请收好:10个非常有用的 Visual Studio Code 插件
- 05-3022《Vue 入门教程》VueRouter 路由嵌套
- 05-30前端面试题-Vue 项目中,你做过哪些性能优化?
- 05-30超简 Vue3+elementPlus 后台管理系统
- 05-30还有前端不知道Electron的?手把手教你把Vue项目打包成桌面程序
- 05-30Nuxt最简入门,让vue项目快速被搜索引擎收录
- 05-30Mac上最美最好用软件系列
- 05-30AI编程小白必备|Cursor安装及配置教程
- 05-30好玩儿的编程语言——文言文编程语言
- 最近发表
- 标签列表
-
- 向日葵无法连接服务器 (32)
- git.exe (33)
- vscode更新 (34)
- dev c (33)
- git ignore命令 (32)
- gitlab提交代码步骤 (37)
- java update (36)
- vue debug (34)
- vue blur (32)
- vscode导入vue项目 (33)
- vue chart (32)
- vue cms (32)
- 大雅数据库 (34)
- 技术迭代 (37)
- 同一局域网 (33)
- github拒绝连接 (33)
- vscode php插件 (32)
- vue注释快捷键 (32)
- linux ssr (33)
- 微端服务器 (35)
- 导航猫 (32)
- 获取当前时间年月日 (33)
- stp软件 (33)
- http下载文件 (33)
- linux bt下载 (33)