VMware安装好centos/rhel后要配置的几点(配置本地光盘yum源、修改网卡名称为eth0等)


[root@localhost ~]# setenforce 0

[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

[root@localhost ~]# tar zcvf /root/redhat.repo.tgz /etc/yum.repos.d/*

[root@localhost ~]# rm -rf /etc/yum.repos.d/*

下面是rhel7的光盘yum源配置

[root@localhost ~]# cat > /etc/yum.repos.d/rhel7.repo <<EOF

> [rhel7-source]

> name=rhel-source

> baseurl=file:///mnt

> enabled=1

> gpgcheck=0

> EOF

下面是centos6的光盘yum源配置

[root@localhost ~]# cat > /etc/yum.repos.d/centos6.repo <<EOF     

> [c6-media]

> name=CentOS-$releasever - Media

> baseurl=file:///mnt

> gpgcheck=0

> enabled=1

> EOF


[root@localhost ~]# echo "/dev/sr0 /mnt iso9660 defaults 0 0"  >> /etc/fstab

[root@localhost ~]# mount -a

[root@localhost ~]# yum install net-tools -y

ifconfig查看网卡名称是否为eth0,不是的话修改网卡名为eth0

①编辑网卡配置文件

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

修改其中的NAME和DEVICE为eth0

NAME="eth0"

DEVICE="eth0"

②重命名网卡配置文件

mv /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eth0

③编辑grub文件

vi /etc/default/grub

在第6行末尾rhgb quiet后面添加 net.ifnames=0 biosdevname=0

GRUB_TIMEOUT=5

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"

GRUB_DEFAULT=saved

GRUB_DISABLE_SUBMENU=true

GRUB_TERMINAL_OUTPUT="console"

GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet net.ifnames=0 biosdevname=0"

GRUB_DISABLE_RECOVERY="true"

④重新建立grub文件

grub2-mkconfig -o /boot/grub2/grub.cfg

⑤做快照、关机、克隆。