安装centos7.9

安装centos7.9

创建虚拟机

  • 配置:自定义

  • 硬件兼容性:Workstation 17.x

  • 安装来源:稍后安装操作系统

  • 客户机操作系统:Linux

    版本:CentOS 7 64位

  • 虚拟机名称:centos7-1

    虚拟机位置:D:\data\vm\centos7-1

  • 处理器数量:1

    每个处理器内核数量:1

  • 内存:1024MB

  • 网络类型:使用网络地址转换

  • SCSI控制器:LSI Logic

  • 虚拟磁盘类型:SCSI

  • 磁盘:创建新虚拟磁盘

  • 最大磁盘大小:20GB

    将虚拟磁盘存储为单个文件

  • 磁盘文件:centos7-1.vmdk

  • 自定义硬件—>CD/DVD—>使用ISO映像文件—>选择下载好的ISO镜像

    CentOS-7-x86_64-Minimal-2009.iso

  • 虚拟机创建完成

  • 创建centos7-1到centos7-10,或者根据自己需求创建

安装操作系统

  • 开启此虚拟机

  • 选择Install CentOS 7

  • 安装语言:English

  • DATE & TIME:Shanghai

  • INSTALLATION DESTINATION:进入配置后不用操作直接退出

  • Begin Installation:开始安装

  • Root Password:toortoor

    弱密码需要确认两次

  • Reboot:重启

配置实验环境

配置网络:

1
2
3
4
5
6
7
8
9
10
11
# vi /etc/sysconfig/network-scripts/ifcfg-ens33
# 4行,BOOTPROTO改为使用静态地址
BOOTPROTO=static
# 15行,ONBOOT改为启用网卡
ONBOOT=yes
# 尾行,添加IP地址,子网掩码,网关,DNS
IPADDR=10.80.10.1
PREFIX=16
GATEWAY=10.80.0.2
DNS1=114.114.114.114
DNS2=8.8.8.8
1
2
3
# systemctl restart network
# ip a
# ping www.baidu.com -c 3

使用终端远程连接虚拟机,修改主机名:

1
# hostnamectl set-hostname node1 && bash

永久关闭firewalld:

1
2
3
# systemctl stop firewalld
# systemctl disable firewalld
# systemctl status firewalld

永久关闭selinux:

1
2
3
# setenforce 0
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
# getenforce

配置阿里的base源和epel源,阿里源慢的话可以使用华为源或清华源:

1
2
3
4
5
# mkdir -p /etc/yum.repos.d/bak
# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
# yum clean all && yum makecache

安装基础软件:

1
# yum install -y wget net-tools vim lrzsz lsof tree unzip zip iftop iotop htop nload telnet

安装时间同步:

1
2
3
4
# yum install -y chrony
# systemctl start chronyd
# systemctl enable chronyd
# systemctl status chronyd

关闭虚拟机,进行克隆或备份:

1
# poweroff