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 配置沒有了,怎么配置?

  

 

  現在需要這么來設置: 

  

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM