CentOS6联网、YUM库配置信息

119 阅读3分钟

@TOC

1. 联网配置信息

[root@centos6 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
NAME="System eth0"
IPADDR=192.168.37.6
#网关
GATEWAY=192.168.37.2
#DNS
DNS1=114.114.114.114
PREFIX=24

[root@centos6 ~]# /etc/init.d/network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining if ip address 192.168.37.6 is already in use for device eth0...
                                                           [  OK  ]
[root@centos6 ~]# ping baidu.com -c 2
PING baidu.com (220.181.38.148) 56(84) bytes of data.
64 bytes from 220.181.38.148: icmp_seq=1 ttl=128 time=6.75 ms
64 bytes from 220.181.38.148: icmp_seq=2 ttl=128 time=7.19 ms

--- baidu.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1009ms
rtt min/avg/max/mdev = 6.755/6.972/7.190/0.232 ms

2.linux克隆虚拟机出现问题bringing up interface eth0:device eth0

[root@centos6 yum.repos.d]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining if ip address 192.168.37.6 is already in use for device eth0...
                                                           [  OK  ]
Bringing up interface eth1:  Device eth1 does not seem to be present, delaying initialization.
                                                           [FAILED]

#解决办法

此问题是因为我有两个网络配置文件冲突所造成

[root@centos6 yum.repos.d]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
TYPE=Ethernet
UUID=df653bc8-b366-48ea-996d-a3e3dda7f28c	#删除UUID
ONBOOT=yes
BOOTPROTO=none
HWADDR=00:0C:29:E8:7D:BB	#删除HWADDR
NAME="System eth0"
IPADDR=192.168.37.6
GATEWAY=192.168.37.2
DNS1=114.114.114.114
PREFIX=24

#删除网卡2配置文件
[root@centos6 yum.repos.d]# rm -rf /etc/sysconfig/network-scripts/ifcfg-eth1
#重启网络就可以了
[root@centos6 yum.repos.d]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining if ip address 192.168.37.6 is already in use for device eth0...
                                                           [  OK  ]

或者执行【待测试】

[root@centos6 ~]# rm -rf /etc/udev/rules.d/70-persistent-net.rules
[root@centos6 ~]# reboot
[root@centos6 ~]# service network restart

3.YUM解决办法:

参考阿里云网站: developer.aliyun.com/mirror/ 在这里插入图片描述

#创建文件夹
[root@centos6 ~]# mkdir -p /etc/yum.repos.d/bak
#把/yum.repo.d/目录下文件移到yum.repos.d/bak下
[root@centos6 ~]# mv /etc/yum.repos.d/* /etc/yum.repos.d/bak

#替换为阿里云Vault镜像
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-6.10.repo

#epel阿里云
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-archive-6.repo

#查看一下
[root@centos6 ~]# ls /etc/yum.repos.d/
bak  CentOS-Base.repo	epel.repo
#清理缓存
[root@centos6 ~]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Cleaning repos: base extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
#建立缓存
[root@centos6 ~]# yum makecache
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Determining fastest mirrors
base                                                             | 3.7 kB     00:00     
base/group_gz                                                    | 242 kB     00:00     
base/filelists_db                                                | 6.4 MB     00:00     
base/primary_db                                                  | 4.7 MB     00:00     
base/other_db                                                    | 2.8 MB     00:00     
extras                                                           | 3.4 kB     00:00     
extras/filelists_db                                              |  24 kB     00:00     
extras/prestodelta                                               | 2.2 kB     00:00     
extras/primary_db                                                |  29 kB     00:00     
extras/other_db                                                  |  14 kB     00:00     
updates                                                          | 3.4 kB     00:00     
updates/filelists_db                                             | 8.4 MB     00:00     
updates/prestodelta                                              | 357 kB     00:00     
updates/primary_db                                               |  12 MB     00:01     
updates/other_db                                                 | 479 kB     00:00  
Metadata Cache Created

4.busybox

问题1

#提示不安全、下图中有详细信息
[root@centos6 data]# wget https://busybox.net/downloads/busybox-1.30.0.tar.bz2
--2022-04-03 14:23:34--  https://busybox.net/downloads/busybox-1.30.0.tar.bz2
Resolving busybox.net... 140.211.167.122
Connecting to busybox.net|140.211.167.122|:443... connected.
ERROR: cannot verify busybox.net’s certificate, issued by “/C=US/O=Let's Encrypt/CN=R3”:
  Issued certificate has expired.
To connect to busybox.net insecurely, use ‘--no-check-certificate’.		#连接到busybox。net不安全,请使用“--无检查证书”。

#需要加选项‘--无检查证书’
[root@centos6 data]# wget --no-check-certificate https://busybox.net/downloads/busybox-1.30.0.tar.bz2
--2022-04-03 14:27:03--  https://busybox.net/downloads/busybox-1.30.0.tar.bz2
Resolving busybox.net... 140.211.167.122
Connecting to busybox.net|140.211.167.122|:443... connected.
WARNING: cannot verify busybox.net’s certificate, issued by “/C=US/O=Let's Encrypt/CN=R3”:
  Issued certificate has expired.
HTTP request sent, awaiting response... 200 OK
Length: 7586319 (7.2M) [application/x-bzip2]
Saving to: “busybox-1.30.0.tar.bz2”

100%[==============================================>] 7,586,319    155K/s   in 54s     

2022-04-03 14:27:57 (138 KB/s) - “busybox-1.30.0.tar.bz2” saved [7586319/7586319]

#下载完成
[root@centos6 data]# ls
busybox-1.30.0.tar.bz2  lost+found

问题2

在这里插入图片描述

这个报错缺少对应的包:

  centos :

    ncurses-devel

  Ubuntu:

    libncurses5-dev

yum install ncurses-devel -y