VMware安装CentOS7.4初始化

CentOS系统初始化

主机重命名:

hostnamectl set -hostname server1 bash
1.设置IP地址
2.关闭防火墙,关闭核心防护
3.光盘挂载
4.yum源的配置

1. 设置IP地址

Vi /etc/sysconfig/network-scripts/ifcfg
按i进入插入模式
BOOTPROTO = static
IPADDR = 20.0.0.10
NETMASK = 255.255.255.0
GATEWAY = 20.0.0.2
DNS = 20.0.0.2
ONBOOT =yes

保存配置:wq

重启网卡:systemctl restart network

查看网卡:ifconfig / ip addr

上网:vi /etc/resolv.conf

nameserver 20.0.0.2

2.关闭防火墙

临时关闭:systemctl stop firewalld

关闭防护:setenforce 0

永久关闭防火墙:systemctl disabled firewalld

永久关闭核心防护:vi /etc/selinux/config

SELINUX=disable

3.光盘挂载

临时挂载 mount /dev/cdrom

永久挂载 vi /etc/fstab

/dev/cdrom                  /mnt       iso9660        0 0      default

4.yum源配置

cd /etc/yum.repos.d       yum目录

mkdir backup                  新建目录,名字为backup

mv C* backup                把所有的yum源文件全部剪切到backup下做备份,防止误删除

cp backup/CentOS-BXXX.repo      local.repo          拷贝模板,模板名叫local.repo

[base]

name=CentOS-$releasever - Base

mirrorlist=http://mirrorlist.centos.org/?release=KaTeX parse error: Expected 'EOF', got '&' at position 11: releasever&̲arch=basearch&repo=os&infra=$infra

baseurl=file:///mnt
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enable=1

vi  /local.repo

你可能感兴趣的:(VMware安装CentOS7.4初始化)