下载centos,官网下载iso镜像
官方提供了两个版本:DVD ISO 和 Minimal ISO
DVD版是系统标准安装包,4.*GB大小
Minimal版是非常基本的系统,具有一个功能系统所需的最少的软件包,只有9百多MB
这里我们选择Minimal版安装
虚拟机我这里使用的是 VMware Workstation 15 Pro
- 创建虚拟机的主要步骤
- 打开VMware 创建新的虚拟机
- 选择自定义(高级)安装
- 选择安装程序光盘映像文件,选择我们下载的CentOS-7-x86_64-Minimal-1810.iso镜像文件
- 选择使用桥接模式
桥接:选择桥接模式的话虚拟机和宿主机在网络上就是平级的关系,相当于连接在同一交换机上。
NAT:NAT模式就是虚拟机要联网得先通过宿主机才能和外面进行通信。 - 其他没说明的可以根据自己情况来选择
- 安装操作系统
开启虚拟机后会出现以下界面
- Install CentOS 7 安装CentOS 7
- Test this media & install CentOS 7 测试安装文件并安装CentOS 7
- Troubleshooting 修复故障
选择第一项,安装直接CentOS 7,回车,进入下面的界面
选择安装过程中使用的语言,选择英文、美式键盘,点击Continue
设置时间时区为亚洲上海
选择安装位置,默认不分区
设置root密码,123456
点击USER CREATION 创建管理员用户
开机设置网络,打开文件配置 vi /etc/sysconfig/network-scripts/ifcfg-ens33
- 重启网络,查看ip地址,ping测试
# service network restart
# ip addr
# ping www.baidu.com
- 解决不能使用ifconfig命令
yum install net-tools -y
- 安装wget
yum installl -y wget
- 开放ssh,打开sshd_config 修改开放 PermitRootLogin yes 和 StrictModes yes
vim /etc/ssh/sshd_config
- 重启ssh服务
service sshd restart
- 安装其他工具
yum install -y unzip zip
yum install -y gcc gcc-c++
- 防火墙firewalld的基本使用
启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status firewalld 开机禁用 : systemctl disable firewalld 开机启用 : systemctl enable firewalld