CentOS6、CentOS7配置Base源和epel源

本文详细介绍了在CentOS系统中常见的配置问题及解决方案,包括处理YUM安装软件时的网络错误,配置Base源和EPEL源,解决iptables相关问题,以及hping3的编译错误修复。通过具体步骤指导,帮助读者有效解决CentOS系统中的网络配置、软件源和安全设置等问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://www.cnblogs.com/fawaikuangtu123/p/8027274.html 

1.用yum安装软件报错

1

2

3

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os

error was 14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'

# 这种错误是因为网络问题,没有配置/etc/resolv.conf,在这个文件里写入nameserver 8.8.8.8即可.

2.在CentOS6上配置Base源

1

2

3

4

5

6

7

8

9

# 备份你的原镜像文件,出错后还可以恢复

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

# 下载新的CentOS-Base.repo到/etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

 

yum makecache  # 生成缓存

yum clean all  # 清除缓存

chkconfig NetworkManager off

service NetworkManager stop

3.在CentOS6上配置EPEL源

1

2

3

4

5

6

7

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

yum repolist  # 验证是否成功

# 如果出错,就编辑vi epel.repo,取消baseurl的注释,将mirrorlist行注释,就差不多了.

 

# Centos7同理

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

4.CentOS6关停iptables

1

2

3

4

iptables -F

/etc/init.d/iptables save

chkconfig iptables off

service iptables stop

5.hping3解决编译报错问题

1

2

3

4

5

6

7

8

9

10

在安装完gcc后,编译报错,需要编辑bytesex.h文件,添加一行

vim bytesex.h

#if      defined(__i386__) \

        || defined(__x86_64__) \

        || defined(__alpha__) \

 

# hping3命令用法详解:http://www.searu.org/16384.html

# hping3命令:http://man.linuxde.net/hping3

# hping的使用方式:http://blog.youkuaiyun.com/lhl_blog/article/details/19572631

# iftop的安装和简单使用:https://www.cnblogs.com/chaichuan/p/4442610.htm

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值