C++远端开发环境安装(centos7)
使用VMWare安装centos7
启用网卡设备
修改文件/etc/sysconfig/network-scripts/ifcfg-ens33中的ONBOOT=yes
重启网络服务 systemctl restart network
配置yum仓库
直接将如下内容覆盖原有的/etc/yum.repos.d/CentOS-Base.repo文件
清理yum缓存
yum clean all
刷新yum
yum update
注意:本机是X86_64并且是centos7环境
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#[base]
name=CentOS-7 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/os/x86_64/http://mirrors.aliyuncs.com/centos/7/os/x86_64/http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#released updates
[updates]
name=CentOS-7 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/updates/x86_64/http://mirrors.aliyuncs.com/centos/7/updates/x86_64/http://mirrors.cloud.aliyuncs.com/centos/7/updates/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/extras/x86_64/http://mirrors.aliyuncs.com/centos/7/extras/x86_64/http://mirrors.cloud.aliyuncs.com/centos/7/extras/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/centosplus/x86_64/http://mirrors.aliyuncs.com/centos/7/centosplus/x86_64/http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7#contrib - packages by Centos Users
[contrib]
name=CentOS-7 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/contrib/x86_64/http://mirrors.aliyuncs.com/centos/7/contrib/x86_64/http://mirrors.cloud.aliyuncs.com/centos/7/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
安装wget
yum install -y wget
安装gcc
新建一个目录并且进入该目录
mkdir ~/software;cd ~/software
下载gcc安装包
wget https://ftp.gnu.org/gnu/gcc/gcc-10.5.0/gcc-10.5.0.tar.gz
解压安装包
tar -xvf gcc-10.5.0.tar.gz
进入解压后的文件夹
cd gcc-10.5.0
下载gcc 依赖项
yum install make bzip2 curl file gcc gcc-c++ glibc-devel glibc-static libmpc-devel mpfr-devel libstdc++-devel libatomic libatomic-devel perl-ExtUtils-MakeMaker perl-Test-Simple perl-File-Temp perl-Time-HiRes perl-Path-Tiny perl-Getopt-Long perl-File-Copy-Recursive perl-Module-BuildTiny texinfo bison flex libmpc libmpfr libgmp zlib-devel
下载前置依赖项
./contrib/download_prerequisites
配置gcc
./configure --prefix=/usr/local --enable-bootstrap --enable-languages=c,c++,fortran --disable-multilib --enable-shared --with-system-zlib --without-included-gettext
编译gcc
make -j$(nproc)
注意:若编译过程中出现其他报错,一般是依赖项错误,可以自行根据错误信息检索解决方法
安装gcc