1. 程式人生 > >centOS 7 簡單設定(虛擬機器)

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

[[email protected] 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配置並更新核心

[[email protected] 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