中国之窗,私钟妹,曹秉局
官网下载地址:http://mirrors.163.com/centos
3、进入页面后,可以看到x86_64
(我们以centos-7-x86_64-minimal-1908.iso为安装案例)
教程:
安装教程:
提示: 鼠标移动到虚拟机内部单击或者按下ctrl + g,鼠标即可移入到虚拟机中
按下ctrl + alt,鼠标即可移出虚拟机
注意: 在虚拟机中的操作,鼠标必须要移入到虚拟机中,否则虚拟机感应不到,无法对其进行操作
界面说明:
install centos 7 安装centos 7
test this media & install centos 7 测试安装文件并安装centos 7
troubleshooting 修复故障
(1)选择date & time
(2)时区设置为 region:asia city:shanghai
日期和时间 设置与自己的电脑时间同步,最后点击“done”
(1)选择software selection
(1)选择installation destination
(2)点选 i will configuire parttioning,然后再点击“done”
(3)更改模式,标准分区standard partition,点击“+”按钮添加分
(4)添加分区,add mount point
分区前先规划好
boot #分区,一般为200m
swap #交换分区,一般设置为内存的2倍
/ #根目录,所有空间给/(根分区)
分完区如下:确认分区有没有错误,如果没问题点击”done“
(1)选择root password
(2)为root设置密码 (密码长度最好不要小于6位数),然后点击“done”
提示:在输入密码时,linux为了安全起见,是看不到你输入的密码。同时,如果是使用的是键盘右边的数字键盘输入密码的话,建议查看一下,数字键盘是否开启 (建议使用字母按键上面一排的 数字键输入密码)
(1)输入ip addr 查看当前ip信息,可以看到网卡名称为ens33
(2)进入网卡配置目录 cd /etc/sysconfig/network-scripts ,查看当前目录文件 ls ,现在可看到该目录下有可以看到网卡名称为ifcfg-ens33网卡文件
(3)通过vi命令对网卡ifcfg-ens33进行配置
修改以下配置,可按键盘小写a进入编辑模式进行修改,修改完如下图:
修改完按键盘:esc键, 再输入:wq 回车,进行保存并退出
cd /etc/sysconfig/network-scripts/ //进入到network-scripts目录下 vi ifcfg-ens32 //编辑配置文件 //修改以下内容 bootproto=static //启用静态ip地址 onboot=yes //开启自动启用网络连接 //添加以下内容 ipaddr=192.168.30.1 //设置ip地址 netmask=255.255.255.0 //子网掩码
(4)重启网络服务
service network restart
ip addr
vi /etc/resolv.conf //编辑 resolv.conf文件 nameserver 114.114.114.114 //添加dns地址 可以添加多个dns地址,格式为: nameserver xxx1.xxx1.xxx1.xxx1 nameserver xxx2.xxx2.xxx2.xxx2 常用的dns地址: 阿里 223.5.5.5 或者 223.6.6.6 谷歌 8.8.8.8 国内移动、电信和联通通用的dns 114.114.114.114
使用reboot重启服务器
再使用ping命令测试网络
包括防火墙和selinux,在内网环境下,这两项都可以关闭,防止影响配置使用;
外网环境开启防火墙,关闭slinux,具体操作如下,以内网环境为例;永久关闭 firewalld防火墙(centos7默认的防火墙是firewalld防火墙,不是使用iptables,因此需要关闭firewalld服务)
首先关闭防火墙;
systemctl stop firewalld.service // 停止firewalld服务
systemctl disable firewalld.service // 开机禁用firewalld服务
iptables -l //列出所有iptables规则
永久关闭selinux防火墙
vi /etc/sysconfig/selinux //编辑selinux文件 selinux=disabled //把文件中的selinux=enforcing 改成 selinux=disabled 即可 sestatus //查看selinux状态
把selinux=enforcing 改为 selinux=disabled 然后保存并退出
seliniux修改完需要重启centos系统 reboot
使用sestatus 命令查看selinux状态,如果是disabled关闭成功,如下图:
查看当前主机名的情况 hostnamectl
[root@localhost ~]# hostnamectl
static hostname: localhost.localdomain
icon name: computer-vm
chassis: vm
machine id: 2c080819c8c64aee8c2a9ed4373b82b5
boot id: 1ca5d2bb89ea42c2af71ab772abf7967
virtualization: vmware
operating system: centos linux 7 (core)
cpe os name: cpe:/o:centos:centos:7
kernel: linux 3.10.0-1062.el7.x86_64
architecture: x86-64
hostname mrxiong 临时修改主机名
[root@localhost ~]# hostname mrxiong
[root@localhost ~]# hostnamectl
static hostname: localhost.localdomain
transient hostname: mrxiong
icon name: computer-vm
chassis: vm
machine id: 2c080819c8c64aee8c2a9ed4373b82b5
boot id: 1ca5d2bb89ea42c2af71ab772abf7967
virtualization: vmware
operating system: centos linux 7 (core)
cpe os name: cpe:/o:centos:centos:7
kernel: linux 3.10.0-1062.el7.x86_64
architecture: x86-64
vi /etc/sysconfig/network 输入hostname=mrxiong 修改主机名永久生效
[root@localhost ~]# hostnamectl set-hostname mrxiong [root@localhost ~]# hostnamectl static hostname: mrxiong pretty hostname: mrxiong icon name: computer-vm chassis: vm machine id: 2c080819c8c64aee8c2a9ed4373b82b5 boot id: 1ca5d2bb89ea42c2af71ab772abf7967 virtualization: vmware operating system: centos linux 7 (core) cpe os name: cpe:/o:centos:centos:7 kernel: linux 3.10.0-1062.el7.x86_64 architecture: x86-64
当在我们练习过程中造成系统崩馈和其它解决不了的问题,可以通过快照恢复系统
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
linux下文本编辑器vim的使用方法(复制、粘贴、替换、行号、撤销、多文件操作)
网友评论