centos7 服务器搭建

1. 查看 centos 版本

cat /etc/redhat-release

CentOS Linux release 7.9.2009 (Core)
2 .查看 ip地址

ip addr
sudo yum install net-tools -y

3. 是否能够上网

ping www.baidu.com
ping 114.114.114.114
sudo systemctl restart network

4. DNS

更新DNS配置
编辑/etc/resolv.conf文件,确保其中包含有效的DNS服务器,例如Google的公共DNS:

sudo vi /etc/resolv.conf
1
添加以下行:

nameserver 8.8.8.8
nameserver 8.8.4.4

yum 指令

sudo yum check-update # 列出所有可更新的软件包

查询 yum 源
sudo yum repolist
yum list
yum provides ifconfig
搜索软件包
sudo yum search epel
#查看更新后的yum源
yum repolist

2、配置EPEL(扩展)源
有些国外的软件在国内的yum源中不一定能找到,所以Linux提供了EPEL(扩展)源,里面都是些国外的软件。

5. 更新YUM仓库源为阿里云镜像源:

Cannot find a valid baseurl for repo: base/7/x86_64
参考文档
CentOS yum源设置为国内aliyun yum源
https://developer.aliyun.com/article/1523301?spm=5176.26934562.main.2.16c938e4ys9prQ

CentOS 镜像
https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.4b2d1b11s6VkHv

备份

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

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


sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/rep
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值