VirtualBox 安装 centos7

1、准备条件

  VirtualBox(6.1.4)、centos7 镜像(此文使用的是CentOS-7-x86_64-Minimal-1908.iso)  

  本文是 Mac 环境下的安装.(之所以选择 6.1.4 版本的 VirtualBox,是因为低版本不兼容.这个会有一个问题,会在最后补充中说明)

  1.1 VirtualBox 下载地址

    https://www.virtualbox.org/wiki/Downloads

  1.2 Centos 7 镜像下载地址()

    http://isoredirect.centos.org/centos/7/isos/x86_64/

2、安装

2.1 配置基本信息

  

 

 

  

 

 

  

 

 

 

 

2.2 开始安装

  

 

 

 

 

 

 

  

这里可以设置 root 密码,也可以创建用户,根据自己需求.

 

 

 等待安装完成重启。

2.3 修改配置

  ##更新 如下两个文件的配置
  /etc/sysconfig/network-scripts/ifcfg-enp0s3
  /etc/sysconfig/network-scripts/ifcfg-enp0s3
  onboot=yes
 
  ##然后重启网络
  servcie network restart

 

3、更改 yum 的配置

3.1 下载阿里云的repo

  [root@k8s-master ~]# yum install -y  wget    

      [root@centos7 /]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
  [root@centos7 /]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3.2 清除缓存并生成新的缓存

[root@centos7 /]# yum clean all
[root@centos7 /]# yum makecache

 

3.3 验证

安装net-tools工具,运行ifconfig命令

yum install -y net-tools

 

 

 

3.4. 关闭防火墙

[root@k8s-master ~]# firewall-cmd --state
running
[root@k8s-master ~]# systemctl stop firewalld.service
[root@k8s-master ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

firewall-cmd --state #查看防火墙状态

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动


3.5. 关闭selinux

[root@k8s-master ~]# getenforce
Enforcing
[root@k8s-master ~]# setenforce 0
[root@k8s-master ~]# sed -i 's/^ *SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

#查看selinux状态

getenforce

#临时关闭selinux
setenforce 0 

#永久关闭(需重启系统)
sed -i 's/^ *SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config 

至此完成Centos7.6操作系统安装和优化。                                                                           

补充:

1)、Mac 的 VirtulBox6.X 版本的 host-only 配置没有了,怎么配置?

  

 

  现在需要这么来设置: 

  

 

 

posted @ 2020-02-24 15:19  竹子91  阅读(893)  评论(0编辑  收藏  举报