安裝操做系統CentOS-7.x

1、建立虛擬機

使用VMware Fusion建立虛擬機

2、系統安裝

爲了統一環境,保證明驗的通用性,將網卡名稱設置爲eth*,不使用CentOS 7默認的網卡命名規則。因此須要在安裝的時候,增長內核參數。node

  • 光標選擇"Install CentOS 7"

  • 點擊Tab,打開kernel啓動選項後,增長net.ifnames=0 biosdevname=0 ,以下圖所示。

  • 修改時區

  • 安裝中文語言包

  • 網卡&主機名配置

 

3、系統配置

網卡配置

[root@linux-node1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
HWADDR=00:0C:29:CA:80:0D
BOOTPROTO=static
NAME=eth0
ONBOOT=yes
IPADDR=192.168.56.11
NETMASK=255.255.255.0
GATEWAY=192.168.56.2

重啓網絡服務linux

[root@linux-node1 ~]# systemctl restart network

關閉NetworkManager和防火牆開機自啓動

[root@linux-node1 ~]# systemctl disable firewalld
[root@linux-node1 ~]# systemctl disable NetworkManager

設置主機名

[root@linux-node1 ~]# vi /etc/hostname
linux-node1.example.com

 設置主機名解析

[root@linux-node1 ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.56.11 linux-node1 linux-node1.example.com
192.168.56.12 linux-node2 linux-node2.example.com
192.168.56.13 linux-node3 linux-node3.example.com

設置DNS解析

[root@linux-node1 ~]# vi /etc/resolv.conf
nameserver 192.168.56.2

安裝EPEL倉庫和經常使用命令

[root@linux-node1 ~]# rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
[root@linux-node1 ~]# yum -y install net-tools vim lrzsz tree screen lsof tcpdump nc mtr nmap

關閉並確認SELinux處於關閉狀態

[root@linux-node1 ~]# vim /etc/sysconfig/selinux 
SELINUX=disabled #修改成 disabled

開啓時間同步

yum -y install chrony
vim /etc/chrony.conf     

# server 0.centos.pool.ntp.org iburs
# server 1.centos.pool.ntp.org iburst
# server 2.centos.pool.ntp.org iburst
# server 3.centos.pool.ntp.org iburst
# 註釋以上配置,添加阿里雲ntp
server ntp1.aliyun.com iburst


systemctl enable chronyd
systemctl start chronyd
systemctl status chronyd 
chronyc sources -v
timedatectl 
date

關機

[root@linux-node1 ~]# reboot

建議給虛擬機作快照

相關文章
相關標籤/搜索