centos7安装g++
时间: 2023-10-28 22:07:11 浏览: 194
好的,安装g++可以按照以下步骤进行:
1. 打开终端,输入以下命令更新yum源:
```
sudo yum update
```
2. 安装gcc和g++:
```
sudo yum install gcc-c++
```
3. 安装完成后,可以通过以下命令检查g++版本:
```
g++ --version
```
相关问题
centos7安装g++命令
在CentOS 7中安装g++命令,可以通过以下步骤实现:
1. 打开终端,使用root用户登录系统。
2. 输入以下命令更新系统软件包列表:sudo yum update
3. 输入以下命令安装g++:sudo yum install gcc-c++
4. 等待安装完成后,输入以下命令检查g++版本:g++ --version
注意:在安装过程中,可能需要输入y确认安装。
centos 离线安装g++
### CentOS 上离线安装 g++ 编译器
#### 准备工作
为了确保顺利进行离线安装,需提前准备所有必要的 RPM 包及其依赖项。建议创建一个包含所需文件的本地仓库。
#### 获取 RPM 包
从与当前系统架构匹配且版本兼容的源获取 `gcc-c++.rpm` 文件以及其他必需组件。这些通常包括但不限于:
- gcc.rpm
- cpp.rpm
- libstdc++.rpm
- binutils.rpm
- glibc-devel.rpm
- kernel-header.rpm
上述提及到的相关RPM包均应确保其版本号同CentOS 7相适应[^2]。
#### 创建本地yum库
将收集好的 rpm 软件包放置于同一目录内,并利用 createrepo 工具构建 yum 源:
```bash
createrepo /path/to/your/rpm/files/
```
#### 配置YUM优先级插件
编辑 `/etc/yum/pluginconf.d/priorities.conf` 文件设置本地 YUM 库具有最高优先级,防止在线更新覆盖已安装程序。
#### 执行安装操作
连接至目标服务器并切换到 root 用户权限后,在终端输入以下命令完成实际部署过程:
```bash
yum install --disablerepo=* --enablerepo=localrepo gcc-c++
```
这里假设已经把之前建立起来的那个本地 repo 命名为 "localrepo"。
阅读全文
相关推荐













