win10-wsl2-c++-go环境

销毁first · · 1770 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

wsl环境配置

1.下载windows易升:https://support.microsoft.com/zh-cn/help/3159635/windows-10-update-assistant

2.开启应用商店:https://www.cnblogs.com/gitwow/p/10344374.html

3.启动关闭windows功能,打开Hyper-V、容器、虚拟机平台、适用于Linux的Windows子系统

4.官方教程456步:https://docs.microsoft.com/zh-cn/windows/wsl/install-win10#step-4---download-the-linux-kernel-update-package

5.设置windows Terminal的配置文件,给ubuntu添加配置:"startingDirectory": "//wsl$/Ubuntu-20.04/home/hhp"

开发环境配置

参考文档

https://zhuanlan.zhihu.com/p/93457173

配置国内源

cp /etc/apt/sources.list /etc/apt/sources.list.bak

sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

sed -i 's/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

apt-get update

apt-get upgrade

设置中文环境

# 安装中文支持

apt-get install -y language-pack-zh-hans

# 设置默认语言

update-locale LANG=zh_CN.UTF-8

安装依赖

apt-get install -y make libtool gcc g++ cmake git vim openssh-server bzip2 texinfo net-tools rsync pkg-config

apt-get install -y protobuf-compiler-grpc python zstd bison curl lsof nginx  netcat unzip lrzsz zip

# 修改 git 默认编辑器为 vim

git config --global core.editor vim

# 忽略权限变化

git config --global core.filemode false

 开启ssh

vim /etc/ssh/sshd_config

PasswordAuthentication yes

PermitRootLogin yes

UsePAM no

ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key

ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key

service ssh restart

 配置C++环境

略:c++环境还是用docker容器

apt-get install -y ninja-build gcc g++ make libtool cmake ragel libhwloc-dev libnuma-dev libpciaccess-dev libcrypto++-dev libboost-all-dev libxml2-dev xfslibs-dev libgnutls28-dev liblz4-dev libsctp-dev libprotobuf-dev protobuf-compiler python3 systemtap-sdt-dev libyaml-cpp-dev libc-ares-dev stow libfmt-dev diffutils valgrind

apt-get install -y git vim openssh-server ctags bzip2 texinfo net-tools rsync pkg-config

apt-get install -y libasio-dev libevent-dev libspdlog-dev libpq-dev libpqxx-dev libmysqlclient-dev libpoco-dev libsqlite3-dev libjsoncpp-dev libssl-dev libgrpc-dev libgrpc++-dev protobuf-compiler-grpc libbison-dev libcppunit-dev libleveldb-dev libfastjson-dev libprotoc-dev libuv1-dev libnghttp2-dev libgmock-dev rapidjson-dev libsnappy-dev libbson-dev libmsgpack-dev libbenchmark-dev librestbed-dev libwebsocketpp-dev libcds-dev librabbitmq-dev librdkafka-dev libmongoclient-dev libhiredis-dev libmemcached-dev libczmq-dev libdouble-conversion-dev  libgoogle-glog-dev  libgflags-dev  libiberty-dev  liblzma-dev  zlib1g-dev  binutils-dev  libjemalloc-dev  libunwind-dev  libzookeeper-mt-dev  libtinyxml2-dev  libtbb-dev  librocksdb-dev  libopenblas-dev  liblapack-dev  libjson-c-dev  libcurlpp-dev  libjwt-dev  libbz2-dev  libthrift-dev  libmstch-dev  libzstd-dev  libreadline-dev  libgoogle-perftools-dev  libx264-dev  libx265-dev  libde265-dev  libfaac-dev  thrift-compiler  rocksdb-tools  flex  python  gperf  zstd  bison curl sudo lsof nginx netcat  unzip lrzsz zip lksctp-tools numactl

apt-get install -y  libutfcpp-dev nlohmann-json3-dev  python3-pip

配置golang环境

下载: https://golang.org/dl/go1.15.6.linux-amd64.tar.gz

cd到挂载盘下载目录

安装: tar -C /usr/local -xzf go1.15.6.linux-amd64.tar.g

设置:

创建目录:H:/ubuntu20/golang

切换root用户执行

cat >> /etc/profile.d/golang.sh << EOF

export GOPROXY=https://goproxy.cn,direct

export GOPATH=/mnt/h/ubuntu20/golang

export GOSUMDB=off

export GO111MODULE=on

export PATH=\$PATH:\$GOPATH/bin:/usr/local/go/bin

EOF

重启windows Terminal,查看go环境

goland配置

- 参照:https://blog.csdn.net/fkewksai/article/details/83062157

- 配置deployment

- 配置文件自动上传

- 上传完成后,在linux系统下,执行make等

- 调试参照:https://www.jianshu.com/p/4b28efa3dfe2

- 调试执行 (暂时不用):dlv。。。


有疑问加站长微信联系(非本文作者)

本文来自:简书

感谢作者:销毁first

查看原文:win10-wsl2-c++-go环境

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1770 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传