Clion配置Docker容器gcc工具链

This commit is contained in:
游由 2021-06-03 11:26:55 +08:00
commit 7739b5e281
4 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,44 @@
# docker容器配置
## 新建容器
```powershell
docker pull centos:7 # 获取centos7的镜像
docker run -it -d --privileged=true --name centos -p 2222:22 centos:7 /usr/sbin/init # 启用内核权限 绑定容器ssh的22端口到主机的2222端口
docker exec -it centos bash # 进入容器
```
## 修改已有容器配置
Windows下wsl2的容器配置文件目录`\\wsl$\docker-desktop-data\version-pack-data\community\docker\containers\[hash_of_the_container]`。修改该目录下的配置文件再重启容器即可。
# 容器环境配置
```shell
yum upgrade # 新容器需要更新仓库
yum update
yum install vim gcc gcc-c++ gdb make initscripts openssh-server openssh-clients wget svn # 安装包
cd ~
wget https://github.com/Kitware/CMake/releases/download/v3.20.3/cmake-3.20.3-linux-x86_64.sh # 下载cmake
./cmake-3.20.3-linux-x86_64.sh --prefix=/usr/local # 安装cmake
mv /usr/local/cmake-3.20.3-linux-x86_64/ /usr/local/cmake/
echo "export PATH=\$PATH:/usr/local/cmake/bin" >> ~/.bashrc # 配置环境变量
source ~/.bashrc # 启用环境变量
service sshd status # ssh服务状态
service sshd start # 启动ssh服务
passwd root # 更改root用户密码
```
# Clion设置
## SSH配置
文件->设置->构建、执行、部署->工具链->添加->远程主机,凭据旁的设置添加服务器。
![image-20210603111732713](images/image-20210603111732713.png)
## 工具链设置
![image-20210603111816201](images/image-20210603111816201.png)
## CMake设置
![image-20210603111842236](images/image-20210603111842236.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB