https://yq.aliyun.com/articles/33286 (Replace the yum source of Centos with the domestic Alibaba Cloud source )
http://blog.csdn.net/inslow/article/details/54177191
Alibaba Cloud is a newly released mirror source. Thanks to the rapid development of Alibaba Cloud, with such a large demand, it will definitely launch its own image source.
Aliyun Linux installation mirror source address: http://mirrors.aliyun.com/
[root@localhost home]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Can you check where the yum source of this machine is?
CentOS system replacement software installation source
Step 1: Back up your original image file so that it can be restored after an error.
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
Step 2: Download the new CentOS-Base.repo to /etc/yum.repos.d/
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
Cent OS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
Change CentOS-Media.repo to have no effect:
enabled=0
Step 3: Run yum makecache to generate the cache
yum clean all
yum makecache
==========================================
[root@node1 data]# wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.5.1-1.x86_64.rpm
--2017-09-22 13:00:12-- https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.5.1-1.x86_64.rpm
Resolving s3-us-west-2.amazonaws.com (s3-us-west-2.amazonaws.com)... failed: Name or service not known.
wget: unable to resolve host address ‘s3-us-west-2.amazonaws.com’
下载yum镜像的时候出现wget失灵的情况,
wget默认安装的分析是DNS的问题
解决办法: vi /etc/resolv.conf
添加如下内容(默认里面什么都没有)
# Generated by NetworkManager (CentOS7 下就只有这句)
nameserver 114.114.114.114
nameserver 8.8.8.8
这样就OK了
在CentOS 7下,手工设置 /etc/resolv.conf 里的DNS,过了一会,发现被系统重新覆盖或者清除了。和CentOS 6下的设置DNS方法不同,有几种方式:
1、使用全新的命令行工具 nmcli 来设置
#显示当前网络连接
#nmcli connection show
NAME UUID TYPE DEVICE
eno1 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eno1
#修改当前网络连接对应的DNS服务器,这里的网络连接可以用名称或者UUID来标识
#nmcli con mod eno1 ipv4.dns "114.114.114.114 8.8.8.8" #enol is the social security name
#Make the dns configuration take effect
#nmcli con up eno1
2. Using the traditional method, manually modify /etc/resolv.conf
- Modify the /etc/NetworkManager/NetworkManager.conf file and add the "dns=none" option to the main section:
[main]
plugins=ifcfg-rh
dns=none
- NetworkManager reloads the modified configuration above
# systemctl restart NetworkManager.service
- Manually modify /etc/resolv.conf
nameserver 114.114.114.114
nameserver 8.8.8.8
For details, see:
# man NetworkManager.conf
# man nmcli