centOS 7 简单设置(虚拟机)

1.修改主机名

hostnamectl set-hostname 

2.ssh连接慢的问题解决

vim /etc/ssh/sshd_config
    UseDNS=no
    GSSAPIAuthentication 

重启sshd

systemctl restart sshd

3.安装系统要做的事情

关闭selinux

vim /etc/selinux/config 
    SELINUX=disabled

关闭防火墙

systemctl stop firewalld
systemctl disable firewalld

修改网卡名字

cd /etc/sysconfig/network-scripts/
mv ifcfg-enp0s3 ifcfg-eth0
mv ifcfg-enp0s8 ifcfg-eth1

并修改内容,定制静态IP

修改网卡配置文件中的 DEVICE=参数的关于 eth0 ,eth1

因 CentOS7 采用 grub2 引导,还需要对 grub2 进行修改,编辑/etc/default/grub 配置文件,在 GRUB_CMDLINE_LINUX这个参数后面加入 net.ifnames=0 biosdevname=0

[root@ansheng network-scripts]# vi /etc/default/grub
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="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"

用 grub2-mkconfig 命令重新生成GRUB配置并更新内核

[root@ansheng network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-4dd6b54f74c94bff9e92c61d669fc195
Found initrd image: /boot/initramfs-0-rescue-4dd6b54f74c94bff9e92c61d669fc195.img
done

重启系统

reboot
原文地址:https://www.cnblogs.com/duzhaoqi/p/10011474.html