0
点赞
收藏
分享

微信扫一扫

CentOS7常用命令使用示例

云上笔记 2022-04-20 阅读 61
centos

CentOS7常用命令使用示例

修改主机名

vim /etc/hostname  #配置文件修改,方法一

hostnamectl set-hostname neame  #设置完需要重启,方法二

关闭防火墙

systemctl stop firewalld #临时关闭

systemctl disable firewalld#永久关闭,禁止开机启动防火墙

CentOS 7 网卡配置

① 查看虚拟机网络信息
在这里插入图查看虚拟机网络信息片描述
在这里插入图片描述
②进入虚拟机

  ip addr 查看网卡信息

在这里插入图片描述

③选择要编辑的网卡进入vi

   vi /etc/sysconfig/network-scripts/ifcfg-ens33

在这里插入图片描述

④重启网络服务

systemctl restart network

CentOS更换yum源

①阿里云yum源:

使用之前请确保已经安装wget,如未安装请执行下面一条命令来安装 yum install -y wget

yum install -y wget

(1)备份当前yum源防止出现意外还可以还原回来

cd /etc/yum.repos.d/
cp /CentOS-Base.repo /CentOS-Base-repo.bak

(2)使用wget下载阿里yum源repo文件

wget http://mirrors.aliyun.com/repo/Centos-7.repo

(3) 清理旧包

yum clean all

(4)把下载下来阿里云repo文件设置成为默认源

mv Centos-7.repo CentOS-Base.repo

(5)生成阿里云yum源缓存并更新yum源

yum makecache
yum update

服务器配置时间同步

同步阿里云时间

yum install -y ntp

ntpdate -u ntp4.aliyun.com
举报

相关推荐

0 条评论