【Mac】VMware Fusion Pro 安装 CentOS 7

[复制链接]
发表于 2025-12-19 12:18:57 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
1、下载镜像



  • CentOS 官网
  • 阿里云镜像
  • 网易镜像
  • 搜狐镜像
Mac M系列芯片基于ARM架构,而传统CentOS7(x86_64)仅支持Intel/AMD的x86架构!安装时会不停卡住(在 install 界面按 enter 回车无效),想要使用须要颠末一系列利用,制作步调拜见:arm64(aarch64)安装centos 7.5.1804 。
若不想本身动手制作,可使用某大佬提供的版本:


  • CentOS-7-aarch64-08191738.iso:
   2025年2月25日,使用上述资源再次安装 CentOS-7 失败
  

  • CentOS Stream 10 fail:SATA Link down
  保举使用CentOS的平替:Rocky Linux、AlmaLinux,安装步调与CentOS同等。
  

  • Rocky Linux镜像地点:https://mirrors.aliyun.com/rockylinux/9/isos/aarch64/
  其他选择:Ubuntu、Debian、Oracle Linux、SUSE Linux Enterprise Server (SLES)
  

  • Debian:http://mirrors.163.com/debian-cd/12.9.0/arm64/iso-cd/debian-12.9.0-arm64-netinst.iso
  文件阐明:


  • torrent是种子文件,下载完毕后,用迅雷这类下载工具打开。
  • DVD:平凡的版本的镜像,内里有许多我们用的常用软件和组件。

    • ​DVD1重要的centos体系和部分必须的软件包。
    • DVD2就是些额外的软件包。
    • 分成2个的缘故原由是由于刻录光盘的文件不能高出4.7G,而centos自带的软件包就高出了这个限定,以是为了方便刻录,就分成了两个文件。
    • 一样平常选择下载DVD1即可。

  • iso 镜像文件

    • Everything:完备安装镜像(离线镜像):

      • 包罗全部软件包和组件,无需联网即可完成安装。
      • 恰当无网络情况或须要完备体系的用户(包罗图形界面、开发工具等)。

    • Minimal:最小化安装镜像:

      • 仅包罗最根本的体系组件,无图形界面,恰当服务器或轻量级情况。
      • 安装后需手动添加额外软件包。

    • NetInstall:网络安装镜像(最小启动镜像)

      • 仅包罗启动体系所需的最根本文件,安装过程中需联网下载软件包。
      • 恰当网络情况好、盼望快速下载并自界说安装的用户。


2、创建捏造机



  • 新建

  • 将 ISO文件 拉进 VMWare Fusion,点击 继续

  • 选择 其他 - 其他 64 位 ARM ,点击 继续

  • 引导固件选择 UEFI,不清晰引导固件是什么的可以看下:捏造机引导装备选bios照旧uefi

  • 选择 自界说,将名称改为 CentOS-7(名称随意)

    名称改为CentOS-7

4、体系设置



  • 打开设置

  • 处理处罚器与内存

    根据本身的电脑运存巨细分配,修改完点击 体现全部,修改内容会自动生存
4、安装捏造机



  • 点击 开始图标

  • 选择 install CentOS 7,回车,期待几分钟


    • Install CentOS Linux 7
      选择此选项开始在你的盘算机体系中使用图形安装步调安装 CentOS 7
    • Test this media & install CentOS Linux 7.0
      这是默认选项,将在启动安装步调前会启动一个步调查抄安装介质的完备性
    • Troubleshooting -->
      这个项目是一个独立菜单,包罗的选项可资助您办理各种安装题目,进入子菜单后

      • Install CentOS Linux 7 in basic graphics mode
        这个选项可让您在安装步调无法为您的显卡载入正确的驱动步调的情况下使用图形模式安装 CentOS
      • Rescue a CentOS Linux system
        当安装完成的CentOS无法开机时,选择此项目举行修复

    • Use the ▲ and ▼ keys to change the selection.
      使用上下键切换选项
    • Press ‘e’ to edit the selected items,or ‘c’ to command prompt
      按e是添加定制引导项目,按c是进入grub(CentOS的开机步调),关于定制引导选项参考 https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html/installation_guide/chap-anaconda-boot-options
    • Press Escape to return to the previous menu.
      按 Esc 返回之前的菜单
       
  • 语言选择:中文、简体中文(中国),点击 继续


  • 点击 安装目标地,点击 完成(这个一样平常保持默认即可)

  • 点击 网络和主机名(N),打开 以太网,点击 完成

  • 点击 时间和日期,选择 亚洲、上海、打开网络时间,点击 完成

  • 点击 根暗码,设置 Root 暗码(111111),点击两次 完成

  • 点击 创建用户(可以不创建,使用 root 即可)

  • 点击 软件选择,根据自身需求选择一个

  • 完玉成部设置后,点击 开始安装,稍等几分钟

  • 安装完成后,点击 重启体系

  • 选择第一个,回车,进入体系
           1、上图末了一个选项抢救模式启动(体系出项题目不能正常启动时使用并修复体系)
        2、上图前面几个选项都是正常启动。体现的是内核的版本,如果出现多个,阐明你有升级过内核;CentOs升级内核后,旧的内核是不会自动删除,以是才有多个正常启动选项,让你选择用哪个内核来启动
  • 输入登岸用户 账号、暗码

5、设置yum源为阿里云镜像源

(1) CentOS7切换镜像源

yum install 报错:Cannot find a valid baseurl for repo: base/7/aarch64
  1. [root@localhost ~]# yum install unzip
  2. 已加载插件:fastestmirror
  3. Determining fastest mirrors
  4. Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=aarch64&repo=os&infra=stock error was
  5. 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
  6. One of the configured repositories failed (未知),
  7. and yum doesn't have enough cached data to continue. At this point the only
  8. safe thing yum can do is fail. There are a few ways to work "fix" this:
  9.      1. Contact the upstream for the repository and get them to fix the problem.
  10.      2. Reconfigure the baseurl/etc. for the repository, to point to a working
  11.         upstream. This is most often useful if you are using a newer
  12.         distribution release than is supported by the repository (and the
  13.         packages for the previous distribution release still work).
  14.      3. Run the command with the repository temporarily disabled
  15.             yum --disablerepo=<repoid> ...
  16.      4. Disable the repository permanently, so yum won't use it by default. Yum
  17.         will then just ignore the repository until you permanently enable it
  18.         again or use --enablerepo for temporary usage:
  19.             yum-config-manager --disable <repoid>
  20.         or
  21.             subscription-manager repos --disable=<repoid>
  22.      5. Configure the failing repository to be skipped, if it is unavailable.
  23.         Note that yum will try to contact the repo. when it runs most commands,
  24.         so will have to try and fail each time (and thus. yum will be be much
  25.         slower). If it is a very temporary problem though, this is often a nice
  26.         compromise:
  27.             yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
  28. Cannot find a valid baseurl for repo: base/7/aarch64
复制代码
堕落缘故原由: 上述错误信息表明无法检索镜像列表,缘故原由是 http://http://mirrorlist.centos.org 已经克制服务了,因此我们须要更改scl源的baseUrl。
办理方案:yum镜像源更换为阿里云镜像:
  1. # 备份yum源
  2. mkdir /etc/yum.repos.d/CentOS-Base.repo/back
  3. mv /etc/yum.repos.d/CentOS-* /etc/yum.repos.d/CentOS-Base.repo/back
  4. # 下载阿里云镜像仓库配置文件
  5. sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  6. sudo curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
  7. # 清除yum缓存
  8. yum clean all
  9. # 生成阿里云镜像缓存
  10. yum makecache
  11. # 公钥导入(不导入可能报错:***的公钥尚未安装)
  12. #    CentOS 7 针对 aarch64 架构(即基于 ARM 的 64 位架构)的 GPG 公钥
  13. rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
  14. #         导入的是 CentOS 7 的通用 GPG 公钥
  15. rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
  16. # 不导入公钥的话,yum install时会报错:
  17. unzip-6.0-24.el7_9.aarch64.rpm 的公钥尚未安装
  18. 失败的软件包是:unzip-6.0-24.el7_9.aarch64
  19. GPG  密钥配置为:https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  20. # 不要去修改 /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7、RPM-GPG-KEY-CentOS-7-aarch64,否则可能报错:
  21. 错误:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64:公钥 1  不受到保护。
复制代码
此时可以正常安装第三方软件:
  1. [root@localhost rpm-gpg]# yum -y install unzip
  2. 已加载插件:fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. 正在解决依赖关系
  5. --> 正在检查事务
  6. ---> 软件包 unzip.aarch64.0.6.0-24.el7_9 将被 安装
  7. --> 解决依赖关系完成
  8. 依赖关系解决
  9. ================================================================================
  10. Package        架构             版本                    源                大小
  11. ================================================================================
  12. 正在安装:
  13. unzip          aarch64          6.0-24.el7_9            updates          168 k
  14. 事务概要
  15. ================================================================================
  16. 安装  1 软件包
  17. 总下载量:168 k
  18. 安装大小:461 k
  19. Downloading packages:
  20. unzip-6.0-24.el7_9.aarch64.rpm                             | 168 kB   00:00     
  21. Running transaction check
  22. Running transaction test
  23. Transaction test succeeded
  24. Running transaction
  25.   正在安装    : unzip-6.0-24.el7_9.aarch64                                  1/1
  26.   验证中      : unzip-6.0-24.el7_9.aarch64                                  1/1
  27. 已安装:
  28.   unzip.aarch64 0:6.0-24.el7_9                                                  
  29. 完毕!
  30. [root@localhost rpm-gpg]# unzip --help
  31. UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send
  32. bug reports using http://www.info-zip.org/zip-bug.html; see README for details.
  33. Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
  34.   Default action is to extract files in list, except those in xlist, to exdir;
  35.   file[.zip] may be a wildcard.  -Z => ZipInfo mode ("unzip -Z" for usage).
  36.   -p  extract files to pipe, no messages     -l  list files (short format)
  37.   -f  freshen existing files, create none    -t  test compressed archive data
  38.   -u  update files, create if necessary      -z  display archive comment only
  39.   -v  list verbosely/show version info       -T  timestamp archive to latest
  40.   -x  exclude files that follow (in xlist)   -d  extract files into exdir
  41. modifiers:
  42.   -n  never overwrite existing files         -q  quiet mode (-qq => quieter)
  43.   -o  overwrite files WITHOUT prompting      -a  auto-convert any text files
  44.   -j  junk paths (do not make directories)   -aa treat ALL files as text
  45.   -U  use escapes for all non-ASCII Unicode  -UU ignore any Unicode fields
  46.   -C  match filenames case-insensitively     -L  make (some) names lowercase
  47.   -X  restore UID/GID info                   -V  retain VMS version numbers
  48.   -K  keep setuid/setgid/tacky permissions   -M  pipe through "more" pager
  49.   -O CHARSET  specify a character encoding for DOS, Windows and OS/2 archives
  50.   -I CHARSET  specify a character encoding for UNIX and other archives
  51. See "unzip -hh" or unzip.txt for more help.  Examples:
  52.   unzip data1 -x joe   => extract all files except joe from zipfile data1.zip
  53.   unzip -p foo | more  => send contents of foo.zip via pipe into program more
  54.   unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer
复制代码
(2) CentOS Stream 9/10 切换镜像源

  1. # 备份
  2. mkdir /etc/yum.repos.d/backup && mv /etc/yum.repos.d/centos* /etc/yum.repos.d/backup
  3. # 下载文件( CentOS Stream 9 将下述路径中的 10 改为 9 即可)
  4. curl -o /etc/yum.repos.d/centos.repo https://raw.githubusercontent.com/ithicket/package/refs/heads/main/centos/centos-stream-10-aliyun.repo
  5. curl -o /etc/yum.repos.d/centos-addons.repo https://raw.githubusercontent.com/ithicket/package/refs/heads/main/centos/centos-addons-stream-10-aliyun.repo
  6. # 更新源
  7. dnf clean all
  8. dnf makecache
复制代码
若后续 dnf 安装包报错:
  1. Curl error (37): Could not read a file:// file for file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial]
复制代码
可以看看 /etc/pki/rpm-gpg 文件夹下的 RPM-GPG-KEY-centosofficial-XXX 文件名,然后用这个文件名更换掉 centos.repo 文件内里的gpgkey项内容
若下载痴钝,可从 CSDN centos.repo下载再做更换,也可以直接复制更换:


  • 阿里源:

    • centos.repo
      1. [baseos]
      2. name=CentOS Stream $releasever - BaseOS
      3. baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/os/
      4. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      5. gpgcheck=1
      6. repo_gpgcheck=0
      7. metadata_expire=6h
      8. countme=1
      9. enabled=1
      10. [baseos-debug]
      11. name=CentOS Stream $releasever - BaseOS - Debug
      12. baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/debug/tree/
      13. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      14. gpgcheck=1
      15. repo_gpgcheck=0
      16. metadata_expire=6h
      17. enabled=0
      18. [baseos-source]
      19. name=CentOS Stream $releasever - BaseOS - Source
      20. baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/source/tree/
      21. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      22. gpgcheck=1
      23. repo_gpgcheck=0
      24. metadata_expire=6h
      25. enabled=0
      26. [appstream]
      27. name=CentOS Stream $releasever - AppStream
      28. baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/os/
      29. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      30. gpgcheck=1
      31. repo_gpgcheck=0
      32. metadata_expire=6h
      33. countme=1
      34. enabled=1
      35. [appstream-debug]
      36. name=CentOS Stream $releasever - AppStream - Debug
      37. baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/debug/tree/
      38. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      39. gpgcheck=1
      40. repo_gpgcheck=0
      41. metadata_expire=6h
      42. enabled=0
      43. [appstream-source]
      44. name=CentOS Stream $releasever - AppStream - Source
      45. baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/debug/tree/
      46. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      47. gpgcheck=1
      48. repo_gpgcheck=0
      49. metadata_expire=6h
      50. enabled=0
      51. [crb]
      52. name=CentOS Stream $releasever - CRB
      53. baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/$basearch/os/
      54. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      55. gpgcheck=1
      56. repo_gpgcheck=0
      57. metadata_expire=6h
      58. countme=1
      59. enabled=0
      60. [crb-debug]
      61. name=CentOS Stream $releasever - CRB - Debug
      62. baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/$basearch/debug/tree/
      63. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      64. gpgcheck=1
      65. repo_gpgcheck=0
      66. metadata_expire=6h
      67. enabled=0
      68. [crb-source]
      69. name=CentOS Stream $releasever - CRB - Source
      70. baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/source/tree/
      71. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      72. gpgcheck=1
      73. repo_gpgcheck=0
      74. metadata_expire=6h
      75. enabled=0
      复制代码
    • centos-addons.repo
      1. [highavailability]
      2. name=CentOS Stream $releasever - HighAvailability
      3. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/HighAvailability/$basearch/os/
      4. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      5. gpgcheck=1
      6. repo_gpgcheck=0
      7. metadata_expire=6h
      8. countme=1
      9. enabled=0
      10. [highavailability-debug]
      11. name=CentOS Stream $releasever - HighAvailability - Debug
      12. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/HighAvailability/$basearch/debug/tree/
      13. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      14. gpgcheck=1
      15. repo_gpgcheck=0
      16. metadata_expire=6h
      17. enabled=0
      18. [highavailability-source]
      19. name=CentOS Stream $releasever - HighAvailability - Source
      20. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/HighAvailability/source/tree/
      21. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      22. gpgcheck=1
      23. repo_gpgcheck=0
      24. metadata_expire=6h
      25. enabled=0
      26. [nfv]
      27. name=CentOS Stream $releasever - NFV
      28. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/NFV/$basearch/os/
      29. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      30. gpgcheck=1
      31. repo_gpgcheck=0
      32. metadata_expire=6h
      33. countme=1
      34. enabled=0
      35. [nfv-debug]
      36. name=CentOS Stream $releasever - NFV - Debug
      37. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/NFV/$basearch/debug/tree/
      38. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      39. gpgcheck=1
      40. repo_gpgcheck=0
      41. metadata_expire=6h
      42. enabled=0
      43. [nfv-source]
      44. name=CentOS Stream $releasever - NFV - Source
      45. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/NFV/source/tree/
      46. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      47. gpgcheck=1
      48. repo_gpgcheck=0
      49. metadata_expire=6h
      50. enabled=0
      51. [rt]
      52. name=CentOS Stream $releasever - RT
      53. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/RT/$basearch/os/
      54. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      55. gpgcheck=1
      56. repo_gpgcheck=0
      57. metadata_expire=6h
      58. countme=1
      59. enabled=0
      60. [rt-debug]
      61. name=CentOS Stream $releasever - RT - Debug
      62. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/RT/$basearch/debug/tree/
      63. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      64. gpgcheck=1
      65. repo_gpgcheck=0
      66. metadata_expire=6h
      67. enabled=0
      68. [rt-source]
      69. name=CentOS Stream $releasever - RT - Source
      70. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/RT/source/tree/
      71. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      72. gpgcheck=1
      73. repo_gpgcheck=0
      74. metadata_expire=6h
      75. enabled=0
      76. [resilientstorage]
      77. name=CentOS Stream $releasever - ResilientStorage
      78. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/ResilientStorage/$basearch/os/
      79. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      80. gpgcheck=1
      81. repo_gpgcheck=0
      82. metadata_expire=6h
      83. countme=1
      84. enabled=0
      85. [resilientstorage-debug]
      86. name=CentOS Stream $releasever - ResilientStorage - Debug
      87. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/ResilientStorage/$basearch/debug/tree/
      88. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      89. gpgcheck=1
      90. repo_gpgcheck=0
      91. metadata_expire=6h
      92. enabled=0
      93. [resilientstorage-source]
      94. name=CentOS Stream $releasever - ResilientStorage - Source
      95. baseurl=http://mirrors.aliyun.com/centos-stream/$stream/ResilientStorage/source/tree/
      96. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      97. gpgcheck=1
      98. repo_gpgcheck=0
      99. metadata_expire=6h
      100. enabled=0
      101. [extras-common]
      102. name=CentOS Stream $releasever - Extras packages
      103. baseurl=http://mirrors.aliyun.com/centos-stream/SIGs/$stream/extras/$basearch/extras-common/
      104. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
      105. gpgcheck=1
      106. repo_gpgcheck=0
      107. metadata_expire=6h
      108. countme=1
      109. enabled=1
      110. [extras-common-source]
      111. name=CentOS Stream $releasever - Extras packages - Source
      112. baseurl=http://mirrors.aliyun.com/centos-stream/SIGs/$stream/extras/source/extras-common/
      113. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
      114. gpgcheck=1
      115. repo_gpgcheck=0
      116. metadata_expire=6h
      117. enabled=0
      复制代码

  • 清华源:

    • centos.repo
      1. [baseos]
      2. name=CentOS Stream $releasever - BaseOS
      3. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/BaseOS/$basearch/os
      4. # metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-$stream&arch=$basearch&protocol=https,http
      5. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      6. gpgcheck=1
      7. repo_gpgcheck=0
      8. metadata_expire=6h
      9. countme=1
      10. enabled=1
      11. [baseos-debuginfo]
      12. name=CentOS Stream $releasever - BaseOS - Debug
      13. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/BaseOS/$basearch/debug/tree/
      14. # metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-debug-$stream&arch=$basearch&protocol=https,http
      15. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      16. gpgcheck=1
      17. repo_gpgcheck=0
      18. metadata_expire=6h
      19. enabled=0
      20. [baseos-source]
      21. name=CentOS Stream $releasever - BaseOS - Source
      22. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/BaseOS/source/tree/
      23. # metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-source-$stream&arch=source&protocol=https,http
      24. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      25. gpgcheck=1
      26. repo_gpgcheck=0
      27. metadata_expire=6h
      28. enabled=0
      29. [appstream]
      30. name=CentOS Stream $releasever - AppStream
      31. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/AppStream/$basearch/os
      32. # metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-$stream&arch=$basearch&protocol=https,http
      33. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      34. gpgcheck=1
      35. repo_gpgcheck=0
      36. metadata_expire=6h
      37. countme=1
      38. enabled=1
      39. [appstream-debuginfo]
      40. name=CentOS Stream $releasever - AppStream - Debug
      41. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/AppStream/$basearch/debug/tree/
      42. # metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-debug-$stream&arch=$basearch&protocol=https,http
      43. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      44. gpgcheck=1
      45. repo_gpgcheck=0
      46. metadata_expire=6h
      47. enabled=0
      48. [appstream-source]
      49. name=CentOS Stream $releasever - AppStream - Source
      50. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/AppStream/source/tree/
      51. # metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-source-$stream&arch=source&protocol=https,http
      52. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      53. gpgcheck=1
      54. repo_gpgcheck=0
      55. metadata_expire=6h
      56. enabled=0
      57. [crb]
      58. name=CentOS Stream $releasever - CRB
      59. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/CRB/$basearch/os
      60. # metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http
      61. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      62. gpgcheck=1
      63. repo_gpgcheck=0
      64. metadata_expire=6h
      65. countme=1
      66. enabled=1
      67. [crb-debuginfo]
      68. name=CentOS Stream $releasever - CRB - Debug
      69. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/CRB/$basearch/debug/tree/
      70. # metalink=https://mirrors.centos.org/metalink?repo=centos-crb-debug-$stream&arch=$basearch&protocol=https,http
      71. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      72. gpgcheck=1
      73. repo_gpgcheck=0
      74. metadata_expire=6h
      75. enabled=0
      76. [crb-source]
      77. name=CentOS Stream $releasever - CRB - Source
      78. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/CRB/source/tree/
      79. # metalink=https://mirrors.centos.org/metalink?repo=centos-crb-source-$stream&arch=source&protocol=https,http
      80. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      81. gpgcheck=1
      82. repo_gpgcheck=0
      83. metadata_expire=6h
      84. enabled=0
      复制代码
    • centos-addons.repo
      1. [highavailability]
      2. name=CentOS Stream $releasever - HighAvailability
      3. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/HighAvailability/$basearch/os
      4. # metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-$stream&arch=$basearch&protocol=https,http
      5. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      6. gpgcheck=1
      7. repo_gpgcheck=0
      8. metadata_expire=6h
      9. countme=1
      10. enabled=0
      11. [highavailability-debuginfo]
      12. name=CentOS Stream $releasever - HighAvailability - Debug
      13. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/HighAvailability/$basearch/debug/tree/
      14. # metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-debug-$stream&arch=$basearch&protocol=https,http
      15. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      16. gpgcheck=1
      17. repo_gpgcheck=0
      18. metadata_expire=6h
      19. enabled=0
      20. [highavailability-source]
      21. name=CentOS Stream $releasever - HighAvailability - Source
      22. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/HighAvailability/source/tree/
      23. # metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-source-$stream&arch=source&protocol=https,http
      24. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      25. gpgcheck=1
      26. repo_gpgcheck=0
      27. metadata_expire=6h
      28. enabled=0
      29. [nfv]
      30. name=CentOS Stream $releasever - NFV
      31. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/NFV/$basearch/os
      32. # metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-$stream&arch=$basearch&protocol=https,http
      33. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      34. gpgcheck=1
      35. repo_gpgcheck=0
      36. metadata_expire=6h
      37. countme=1
      38. enabled=0
      39. [nfv-debuginfo]
      40. name=CentOS Stream $releasever - NFV - Debug
      41. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/NFV/$basearch/debug/tree/
      42. # metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-debug-$stream&arch=$basearch&protocol=https,http
      43. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      44. gpgcheck=1
      45. repo_gpgcheck=0
      46. metadata_expire=6h
      47. enabled=0
      48. [nfv-source]
      49. name=CentOS Stream $releasever - NFV - Source
      50. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/NFV/source/tree/
      51. # metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-source-$stream&arch=source&protocol=https,http
      52. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      53. gpgcheck=1
      54. repo_gpgcheck=0
      55. metadata_expire=6h
      56. enabled=0
      57. [rt]
      58. name=CentOS Stream $releasever - RT
      59. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/RT/$basearch/os
      60. # metalink=https://mirrors.centos.org/metalink?repo=centos-rt-$stream&arch=$basearch&protocol=https,http
      61. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      62. gpgcheck=1
      63. repo_gpgcheck=0
      64. metadata_expire=6h
      65. countme=1
      66. enabled=0
      67. [rt-debuginfo]
      68. name=CentOS Stream $releasever - RT - Debug
      69. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/RT/$basearch/debug/tree/
      70. # metalink=https://mirrors.centos.org/metalink?repo=centos-rt-debug-$stream&arch=$basearch&protocol=https,http
      71. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      72. gpgcheck=1
      73. repo_gpgcheck=0
      74. metadata_expire=6h
      75. enabled=0
      76. [rt-source]
      77. name=CentOS Stream $releasever - RT - Source
      78. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/RT/source/tree/
      79. # metalink=https://mirrors.centos.org/metalink?repo=centos-rt-source-$stream&arch=source&protocol=https,http
      80. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      81. gpgcheck=1
      82. repo_gpgcheck=0
      83. metadata_expire=6h
      84. enabled=0
      85. [resilientstorage]
      86. name=CentOS Stream $releasever - ResilientStorage
      87. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/ResilientStorage/$basearch/os
      88. # metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-$stream&arch=$basearch&protocol=https,http
      89. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      90. gpgcheck=1
      91. repo_gpgcheck=0
      92. metadata_expire=6h
      93. countme=1
      94. enabled=0
      95. [resilientstorage-debuginfo]
      96. name=CentOS Stream $releasever - ResilientStorage - Debug
      97. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/ResilientStorage/$basearch/debug/tree/
      98. # metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-debug-$stream&arch=$basearch&protocol=https,http
      99. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      100. gpgcheck=1
      101. repo_gpgcheck=0
      102. metadata_expire=6h
      103. enabled=0
      104. [resilientstorage-source]
      105. name=CentOS Stream $releasever - ResilientStorage - Source
      106. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/ResilientStorage/source/tree/
      107. # metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-source-$stream&arch=source&protocol=https,http
      108. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
      109. gpgcheck=1
      110. repo_gpgcheck=0
      111. metadata_expire=6h
      112. enabled=0
      113. [extras-common]
      114. name=CentOS Stream $releasever - Extras packages
      115. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/$releasever-stream/extras/$basearch/extras-common
      116. # metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-$stream&arch=$basearch&protocol=https,http
      117. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
      118. gpgcheck=1
      119. repo_gpgcheck=0
      120. metadata_expire=6h
      121. countme=1
      122. enabled=1
      123. [extras-common-source]
      124. name=CentOS Stream $releasever - Extras packages - Source
      125. baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/$releasever-stream/extras/source/extras-common
      126. # metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-source-$stream&arch=source&protocol=https,http
      127. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
      128. gpgcheck=1
      129. repo_gpgcheck=0
      130. metadata_expire=6h
      131. enabled=0
      复制代码

6、CentOS 网络接口 ens160 未获取到 IP 地点

(1)网络适配器未启用或设置错误

查抄 VMware 捏造机设置中是否已启用网络适配器,且毗连模式为 NAT 模式(对应 VMnet8)。
确认 VMware 的捏造网络编辑器(Edit > Virtual Network Editor)中,VMnet8 的子网确实设置为 192.168.80.0,并启用了 DHCP。
(2)CentOS 网络服务未启动

CentOS 8 默认使用 NetworkManager 管理网络,需查抄服务状态:
  1. systemctl status NetworkManager
复制代码
若未运行,启动服务:
  1. systemctl start NetworkManager
  2. systemctl enable NetworkManager
复制代码
(3)网卡设置文件错误

查抄 /etc/sysconfig/network-scripts/ifcfg-ens160 文件:
  1. BOOTPROTO=dhcp      # 使用 DHCP 获取 IP
  2. ONBOOT=yes          # 开机自动启用网卡
  3. DEVICE=ens160       # 设备名称
  4. TYPE=Ethernet
复制代码
修改后重启网络服务:
  1. nmcli connection reload
  2. nmcli connection up ens160
复制代码
(4)DHCP 未分配 IP

实行手动触发 DHCP 哀求:
  1. dhclient -v ens160
复制代码
大概出现报错:
  1. bash: dhclient: command not found...
  2. Failed to search for file: cannot update repo 'appstream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]; Last error: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]
复制代码
题目分析:
  1. dhclient 命令未找到:因为系统未安装 dhcp-client 软件包。
  2. DNS 解析失败:无法访问 mirrorlist.centos.org,原因是网络未正确配置(未获取 IP 或 DNS 设置错误)。
  3. 仓库镜像失效:CentOS 8 官方已停止维护(EOL),默认仓库不可用,需更换镜像源。
复制代码
办理方案:


  • 第一步:手动设置网络(临时办理)
    由于无法通过 DHCP 获取 IP 且 DNS 不可用,须要手动为 ens160 分配 IP 和 DNS。
    启用 ens160 并设置静态 IP:
    1. sudo nmcli connection modify ens160 ipv4.addresses 192.168.80.100/24
    2. sudo nmcli connection modify ens160 ipv4.gateway 192.168.80.2
    3. sudo nmcli connection modify ens160 ipv4.dns "8.8.8.8"
    4. sudo nmcli connection modify ens160 ipv4.method manual
    5. sudo nmcli connection up ens160
    复制代码
    如果 ens160 的毗连名称不是 ens160,先用 nmcli connection show 检察实际名称。
    将 192.168.80.100 更换为 VMnet8 网段内的空闲 IP,192.168.80.2 更换为 VMnet8 的网关(通常为 .2)。
    验证网络连通性:
    1. ping 8.8.8.8      # 测试网络是否通
    2. ping google.com   # 测试 DNS 是否生效
    复制代码
  • 第二步:修复 CentOS 8 堆栈镜像
    由于官方堆栈已不可用,需更换为 vault 镜像源。
    备份原有堆栈文件:
    1. sudo mkdir /etc/yum.repos.d/backup
    2. sudo mv /etc/yum.repos.d/CentOS-*.repo /etc/yum.repos.d/backup/
    复制代码
    创建新的堆栈文件:
    1. sudo vi /etc/yum.repos.d/CentOS-vault.repo
    复制代码
    输入以下内容:
    1. [base]
    2. name=CentOS-8 - Base
    3. baseurl=http://vault.centos.org/8.5.2111/BaseOS/$basearch/os/
    4. gpgcheck=1
    5. enabled=1
    6. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    7. [appstream]
    8. name=CentOS-8 - AppStream
    9. baseurl=http://vault.centos.org/8.5.2111/AppStream/$basearch/os/
    10. gpgcheck=1
    11. enabled=1
    12. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    复制代码
    整理并更新堆栈缓存:
    1. sudo dnf clean all
    2. sudo dnf makecache
    复制代码
  • 第三步:安装 dhcp-client
    1. sudo dnf install -y dhcp-client
    复制代码
  • 第四步:规复 DHCP 自动获取 IP
    如果盼望继续使用 DHCP(保举):
    修改 ens160 为 DHCP 模式:
    1. sudo nmcli connection modify ens160 ipv4.method auto
    2. sudo nmcli connection down ens160 && sudo nmcli connection up ens160
    复制代码
    验证 IP 是否获取乐成:
    1. ip addr show ens160
    复制代码
  • 第五步,删除多余的静态IP
    1. ip addr del 192.168.80.150/24 dev ens160
    复制代码
    此时,ens160 接口同时存在 两个 IPv4 地点(192.168.80.131 和 192.168.80.140),这是范例的 IP 地点辩论或设置残留征象。
7、Mac 通过终端与捏造机举行文件传输

Mac FTP工具:FileZilla、Cyberduck、Transmit、CrossFTP、Flow
(1)scp



  • 从当地复制到长途主机:
    1. # 将 文件 `/Users/zhangsan/Downloads/a.txt` 复制到 `/root` 下
    2. zhangsan@MacBook-Pro ~ % scp Downloads/a.txt [email protected]:~
    3. [email protected]'s password:
    4. a.txt                                         100% 6850    17.9MB/s   00:00
    5. # 将 文件夹 `/Users/zhangsan/Downloads/a` 复制到 `/app` 下
    6. lisi@MacBook-Pro ~ % scp -r Downloads/a [email protected]:/app
    7. [email protected]'s password:
    8. a.txt                                         100%    2     6.0KB/s   00:00   
    9. b.txt                                         100%    2     8.1KB/s   00:00
    复制代码
  • 从长途主机复制到当地
    1. # 将 文件夹 `/app/a` 复制到 `/Users/wangwu/Downloads` 下
    2. wangwu@MacBook-Pro ~ % scp -r [email protected]:/app/a ./Downloads
    3. [email protected]'s password:
    4. a.txt                                         100%    2     3.3KB/s   00:00   
    5. b.txt                                         100%    2     4.6KB/s   00:00
    6. # 将 文件 `/root/a.txt` 复制到 `/Users/zhaoliu/Downloads` 下
    7. zhaoliu@MacBook-Pro ~ % scp [email protected]:~/a.txt ./Downloads
    8. [email protected]'s password:
    9. a.txt                                         100% 6850     6.9MB/s   00:00
    复制代码
  • 指定 SSH 端口
    1. # 如果远程主机的 SSH 端口不是默认的 22,可以使用 `-P` 选项指定端口:
    2. scp -P 2222 user@remote_host:/path/on/remote/file.txt /path/to/local/
    复制代码
(2)sftp



  • 创建sftp毗连:Shell ⇒ 新建长途毗连 ⇒ 安全文件传输⇒ + ⇒ 输入捏造机IP 192.168.10.1(可通过ip addr)⇒ 好 ⇒ 选中 192.168.10.1 ⇒ 输入用户root ⇒ 毗连

  • 输入 yes,输入捏造机 root 用户的暗码 111111
    1. The authenticity of host '192.168.10.1 (192.168.10.1)' can't be establisheE
    2. d.
    3. ED25519 key fingerprint is SHA256:GRDS25029jPM20pop9520t59u40Javav13wChhD20.
    4. This key is not known by any other names.
    5. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    6. Warning: Permanently added '192.168.10.1' (ED25519) to the list of known host
    7. S•
    8. [email protected]'s password:
    9. Connected to 192.168.10.1.
    10. sftp>
    复制代码
    乐成创建毗连后,使用 get 下令可以下载文件,使用 put 下令可以上传文件

    • get 服务器上文件的目次地点 当地存放的目次地点
    • put 当地存放的目次地点 服务器上文件的目次地点

8、多捏造机共用同一份挂载盘

此部分内容拜见:
9、Linux 下令

(1)内核利用下令



  • 检察内核列表
    1. rpm -qa | grep kernel | grep core
    复制代码
  • 检察体系当前内核版本
    1. uname -a
    复制代码
  • 手动删除某个内核版原来镌汰开启启动项 (注意不要删除当前内核版本)
    1. yum remove kernel-core-4.18.0-193.el8.x86_64
    复制代码
  • 重启体系
    1. reboot
    复制代码
(2)检察IP地点

  1. ip addr | grep 'inet[^6]' | awk '{print $2}' | cut -d/ -f1 | grep -v "127.0.0.1"
复制代码


  • ip addr:这是ip下令的一个用法,用于体现网络接口的地点信息。
  • grep 'inet[^6]':grep下令用于搜索符合特定模式的行。这里的模式是'inet[^6]',意思是匹配全部以inet开头且不包罗字符6的行。如许,grep就会过滤掉全部IPv6地点,只生存IPv4地点。
  • awk '{print $2}':awk是一个强大的文本处理处罚工具。这里使用awk来打印每行的第二个字段,即IP地点。由于ip addr下令的输出中,IP地点通常位于每行的第二个字段。
  • cut -d/ -f1:cut下令用于剪切并分割字符串。-d/ 指定了分隔符为斜杠(/),-f1体现只取第一个字段。由于IP地点和子网掩码之间通常用斜杠分隔,以是这一步是提取IP地点部分。
  • grep -v "127.0.0.1":grep -v下令与grep雷同,但它用于反向选择,即打扫匹配特定模式的行。这里打扫的是127.0.0.1,即当地回环地点。
10、资料



  • Linux Download:Ubuntu、CentOS、Debian…
  • 2024年CentOS镜像下载地点
  • M系列 Mac怎样安装CentOS7捏造机
  • MacOS 安装 VMware Fusion 以及 CentOS7 (ARM 64 版本)
  • centos7 storm摆设和测试 centos7 troubleshooting
  • 【Linux Centos】开机出现多个启动选项
  • Mac 使用终端实现长途毗连服务器(文件传输)
  • screen下令
  • Linux下令:文件传输下令scp详解
  • centos 7-aarch64怎样更换yum源
  • yum-epel-7
回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表