linux模板机配置

1、设置主机名称

# hostnamectl set-hostname centos7.longlyshadow.cn
# su

2、更改ip获取方式为静态设置以及绑定主机名+ip到 /etc/hosts

修改网卡:

# vi /etc/sysconfig/network-scripts/ipcfg-ens33
    TYPE="Ethernet"
    BOOTPROTO="none"
    IPADDR=10.1.1.10
    NETMASK=255.255.255.0
    GATEWAY=10.1.1.2
    DNS1=8.8.8.8
    DNS2=119.29.29.29
    NAME="ens33"
    DEVICE="ens33"
    ONBOOT="yes"

绑定ip和主机名

# vi /etc/hosts

10.1.1.10 centos7.longlyshadow.cn

重启网卡:

# systemctl restart network

3、关闭防火墙和selinux

# systemctl stop firewalld
# systemctl disable firewalld
# setenforce 0
# vi /etc/selinux/config
SELINUX=disabled

4、配置公网yum源(推荐腾讯云)

百度:腾讯镜像站

https://mirrors.cloud.tencent.com/

找到 centos, 点击查看

下载wget:

# yum install wget -y
# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
# yum clean all
# yum makecache

5、安装扩展软件(自动补全、vin编辑器、net-tools网络工具包以及ntpdate时间同步工具)

# yum install bash-completion vim net-tools ntpdate -y
# ntpdate 120.25.108.11
posted @ 2021-04-07 18:58  于贰哥  阅读(192)  评论(0编辑  收藏  举报