028-86922220

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

VMwareWorkstation安装CentOS7操作系统

这篇文章给大家分享的是VMware Workstation安装CentOS7 操作系统的详细安装教程,相信大部分人都还不知道怎么安装,为了让大家学会,给大家总结了以下内容。

我们提供的服务有:成都做网站、网站设计、外贸营销网站建设、微信公众号开发、网站优化、网站认证、嘉黎ssl等。为上千余家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的嘉黎网站制作公司

1.下载CentOS7 操作系统镜像

这里推荐几个国内镜像源下载,速度要比官网的快,本文推荐的都是最小安装版Minimal。原因是占用空间小600M左右,系统干净DVD版要4G左右。

  1. 阿里云镜像源
  2. 华为云镜像源
  3. 清华大学镜像源

其他国内镜像源还有很多,网易镜像源等。

2.使用VMware Workstation创建虚拟机省略,本文标示下我的配置

VMware Workstation安装CentOS7 操作系统

之后便可开启虚拟机,安装操作系统

3开始安装配置虚拟机

VMware Workstation安装CentOS7 操作系统

VMware Workstation安装CentOS7 操作系统

VMware Workstation安装CentOS7 操作系统

VMware Workstation安装CentOS7 操作系统

VMware Workstation安装CentOS7 操作系统

VMware Workstation安装CentOS7 操作系统

VMware Workstation安装CentOS7 操作系统

4.安装后,对系统网卡,YUM源,SELinux,防火墙配置

网卡配置

修改网卡配置文件

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"            # 修改"dhcp"为"none"或者"static"都可以
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="eth0"                 # 此处可不做修改,本人习惯性修改  网卡名称
UUID="219ac969-2c0b-4571-b8c8-f2bf7fe1e162"
DEVICE="eth0"               # 此处可不做修改,本人习惯性修改  设备名称
ONBOOT="yes"                # 此配置为开机是否自动启动网卡,yes为开机自动启动
IPADDR="11.1.1.31"          # 配置静态IP
PREFIX="24"                 # 子网掩码为24位
GATEWAY="11.1.1.2"          # 默认网关
DNS1="114.114.114.114"      # DNS域名解析 DNS1 阿拉伯数字1不可少
IPV6_PRIVACY="no"

# :wp保存退出

如果没有修改NAME和DEVICE名称为eth0的话,wq保存退出后,重启网卡就可以上网了

# 重启网卡命令
[root@localhost ~]# systemctl restart network

如果修改了NAME和DEVICE名称为eth0的话,还需如下配置

# 1.修改网卡配置文件名称
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost ~]# mv ifcfg-ens33 ifcfg-eth0
# 2.修改grub文件参数
[root@localhost ~]# vi /etc/sysconfig/grub 
# net.ifnames=0 biosdevname=0 即可
# 我这里用不到ipv6,所以一并禁用掉了 ipv6.disable=1
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="crashkernel=auto net.ifnames=0 biosdevname=0 ipv6.disable=1 rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
# :wq保存退出
# 3.是更改后的grub文件重启后生效
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

# 4.重启操作系统
[root@localhost ~]# reboot

重启后我们就可以用xshell或者MobaXterm这样的windows操作系统连接shell工具操作CentOS操作系统了

SELinux配置

[root@localhost ~]# vi /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled        # 修改enforcing为disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

:wq # 保存退出

关闭防火墙,禁止开机自动启动

[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# systemctl stop firewalld

修改主机名

[root@localhost ~]# hostnamectl set-hostname node3.sumailcode.cn
[root@localhost ~]# reboot

YUM 源配置

本文采用阿里云YUM源

[root@node3 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[root@node3 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@node3 ~]# yum clean all && yum makecache fast
[root@node3 ~]# yum update -y                   # 更新操作系统
[root@node3 ~]# yum -y install ntpdate git vim net-tools lrzsz      # 常用软件安装

安装epel源,epel分CentOS官方提供的包仓库,epel中包含一些优秀的开源软件,包括Nginx等

[root@node3 ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

安装docker源,方便日后我们使用docker安装软件

# step 1: 安装必要的一些系统工具
[root@node3 ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
[root@node3 ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新并安装Docker-CE
[root@node3 ~]# yum makecache fast
[root@node3 ~]# yum -y install docker-ce
# Step 4: 开启Docker服务
[root@node3 ~]# systemclt start docker
# Step 5: 开机自动启动Docker服务
[root@node3 ~]# systemctl enable docker
# Step 6: 配置Docker阿里云镜像加速器
[root@node3 ~]# mkdir -p /etc/docker
[root@node3 ~]# tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://hl6fdq72.mirror.aliyuncs.com"]
}
EOF
[root@node3 ~]# systemctl daemon-reload
[root@node3 ~]# systemctl restart docker

其他配置,此配置大家可不配,因为我有一台老旧笔记本,物理机安装了一台CentOS7,当作服务器使,日常属于关闭盖子状态,如果不做如下配置,笔记本扣盖就回休眠断网。

vim /etc/systemd/logind.conf
#文件中添加一行配置
HandleLidSwitch=ignore

5.关闭系统,克隆虚拟机

VMware Workstation安装CentOS7 操作系统

VMware Workstation安装CentOS7 操作系统

VMware Workstation安装CentOS7 操作系统

VMware Workstation安装CentOS7 操作系统

上文描述的就是VMware Workstation安装CentOS7 操作系统的详细安装过程,具体使用情况还需要大家自己动手实验使用过才能领会。如果想了解更多相关内容,欢迎关注创新互联行业资讯频道!


网站标题:VMwareWorkstation安装CentOS7操作系统
网站网址:http://www.tsicrk.com/article/peiioe.html

其他资讯

让你的专属顾问为你服务

4.3510s