1. 程式人生 > >redhat7.5上安裝gcc編譯器

redhat7.5上安裝gcc編譯器

1、背景 在redhat7.5上安裝python3,執行命令./configure時,出現如下報錯:configure: error: no acceptable C compiler found in $PATH 這個報錯,說明沒有安裝合適的編譯器gcc,這時就需要安裝或者升級gcc及其它依賴包 2、使用yum命令直接聯網安裝gcc yum install gcc -y 執行命令後,報如下錯: This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. 這是因為redhat7.5自帶的yum源需要註冊,但是並沒有購買redhat7.5的服務。網上發現說可以用centos的yum包替換。也就是說,需要重新安裝yum包 3、解除安裝redhat上預設安裝的yum

1)檢視原來安裝的yum 這裡寫圖片描述 2)解除安裝yum rpm -qa|grep yum|xargs rpm -e –nodeps 3)再次檢視,驗證是否已下載乾淨 rpm -qa|grep yum 4)獲取centos的yum包 http://mirrors.163.com/centos/7/os/x86_64/Packages/ http://centos.ustc.edu.cn/centos/7/os/x86_64/Packages/ 如上兩個地址,可以獲取yum安裝包(如下5個安裝包是從上面第2個地址獲取的) 這裡寫圖片描述 5)上傳這5個yum包到目錄/home/dbc/yum-centos/下 這裡寫圖片描述 6)執行命令:rpm -ivh *.rpm 一次性安裝依賴包 7)新建配置檔案/etc/yum.repos.d/CentOS-Base.repo,並輸入如下內容:

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 - 163.com

released updates

[updates] name=CentOS-$7 - Updates - 163.com

additional packages that may be useful

[extras] name=CentOS-$7 - Extras - 163.com

additional packages that extend functionality of existing packages