马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
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
- [root@localhost ~]# yum install unzip
- 已加载插件:fastestmirror
- Determining fastest mirrors
- Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=aarch64&repo=os&infra=stock error was
- 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
- One of the configured repositories failed (未知),
- and yum doesn't have enough cached data to continue. At this point the only
- safe thing yum can do is fail. There are a few ways to work "fix" this:
- 1. Contact the upstream for the repository and get them to fix the problem.
- 2. Reconfigure the baseurl/etc. for the repository, to point to a working
- upstream. This is most often useful if you are using a newer
- distribution release than is supported by the repository (and the
- packages for the previous distribution release still work).
- 3. Run the command with the repository temporarily disabled
- yum --disablerepo=<repoid> ...
- 4. Disable the repository permanently, so yum won't use it by default. Yum
- will then just ignore the repository until you permanently enable it
- again or use --enablerepo for temporary usage:
- yum-config-manager --disable <repoid>
- or
- subscription-manager repos --disable=<repoid>
- 5. Configure the failing repository to be skipped, if it is unavailable.
- Note that yum will try to contact the repo. when it runs most commands,
- so will have to try and fail each time (and thus. yum will be be much
- slower). If it is a very temporary problem though, this is often a nice
- compromise:
- yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
- Cannot find a valid baseurl for repo: base/7/aarch64
复制代码 堕落缘故原由: 上述错误信息表明无法检索镜像列表,缘故原由是 http://http://mirrorlist.centos.org 已经克制服务了,因此我们须要更改scl源的baseUrl。
办理方案:yum镜像源更换为阿里云镜像:
- # 备份yum源
- mkdir /etc/yum.repos.d/CentOS-Base.repo/back
- mv /etc/yum.repos.d/CentOS-* /etc/yum.repos.d/CentOS-Base.repo/back
- # 下载阿里云镜像仓库配置文件
- sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
- sudo curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
- # 清除yum缓存
- yum clean all
- # 生成阿里云镜像缓存
- yum makecache
- # 公钥导入(不导入可能报错:***的公钥尚未安装)
- # CentOS 7 针对 aarch64 架构(即基于 ARM 的 64 位架构)的 GPG 公钥
- rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
- # 导入的是 CentOS 7 的通用 GPG 公钥
- rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
- # 不导入公钥的话,yum install时会报错:
- unzip-6.0-24.el7_9.aarch64.rpm 的公钥尚未安装
- 失败的软件包是:unzip-6.0-24.el7_9.aarch64
- GPG 密钥配置为:https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
- # 不要去修改 /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7、RPM-GPG-KEY-CentOS-7-aarch64,否则可能报错:
- 错误:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64:公钥 1 不受到保护。
复制代码 此时可以正常安装第三方软件:
- [root@localhost rpm-gpg]# yum -y install unzip
- 已加载插件:fastestmirror
- Loading mirror speeds from cached hostfile
- 正在解决依赖关系
- --> 正在检查事务
- ---> 软件包 unzip.aarch64.0.6.0-24.el7_9 将被 安装
- --> 解决依赖关系完成
- 依赖关系解决
- ================================================================================
- Package 架构 版本 源 大小
- ================================================================================
- 正在安装:
- unzip aarch64 6.0-24.el7_9 updates 168 k
- 事务概要
- ================================================================================
- 安装 1 软件包
- 总下载量:168 k
- 安装大小:461 k
- Downloading packages:
- unzip-6.0-24.el7_9.aarch64.rpm | 168 kB 00:00
- Running transaction check
- Running transaction test
- Transaction test succeeded
- Running transaction
- 正在安装 : unzip-6.0-24.el7_9.aarch64 1/1
- 验证中 : unzip-6.0-24.el7_9.aarch64 1/1
- 已安装:
- unzip.aarch64 0:6.0-24.el7_9
- 完毕!
- [root@localhost rpm-gpg]# unzip --help
- UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
- bug reports using http://www.info-zip.org/zip-bug.html; see README for details.
- Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
- Default action is to extract files in list, except those in xlist, to exdir;
- file[.zip] may be a wildcard. -Z => ZipInfo mode ("unzip -Z" for usage).
- -p extract files to pipe, no messages -l list files (short format)
- -f freshen existing files, create none -t test compressed archive data
- -u update files, create if necessary -z display archive comment only
- -v list verbosely/show version info -T timestamp archive to latest
- -x exclude files that follow (in xlist) -d extract files into exdir
- modifiers:
- -n never overwrite existing files -q quiet mode (-qq => quieter)
- -o overwrite files WITHOUT prompting -a auto-convert any text files
- -j junk paths (do not make directories) -aa treat ALL files as text
- -U use escapes for all non-ASCII Unicode -UU ignore any Unicode fields
- -C match filenames case-insensitively -L make (some) names lowercase
- -X restore UID/GID info -V retain VMS version numbers
- -K keep setuid/setgid/tacky permissions -M pipe through "more" pager
- -O CHARSET specify a character encoding for DOS, Windows and OS/2 archives
- -I CHARSET specify a character encoding for UNIX and other archives
- See "unzip -hh" or unzip.txt for more help. Examples:
- unzip data1 -x joe => extract all files except joe from zipfile data1.zip
- unzip -p foo | more => send contents of foo.zip via pipe into program more
- unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer
复制代码 (2) CentOS Stream 9/10 切换镜像源
- # 备份
- mkdir /etc/yum.repos.d/backup && mv /etc/yum.repos.d/centos* /etc/yum.repos.d/backup
- # 下载文件( CentOS Stream 9 将下述路径中的 10 改为 9 即可)
- curl -o /etc/yum.repos.d/centos.repo https://raw.githubusercontent.com/ithicket/package/refs/heads/main/centos/centos-stream-10-aliyun.repo
- 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
- # 更新源
- dnf clean all
- dnf makecache
复制代码 若后续 dnf 安装包报错:
- 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
- [baseos]
- name=CentOS Stream $releasever - BaseOS
- baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/os/
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- countme=1
- enabled=1
- [baseos-debug]
- name=CentOS Stream $releasever - BaseOS - Debug
- baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/debug/tree/
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [baseos-source]
- name=CentOS Stream $releasever - BaseOS - Source
- baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/source/tree/
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [appstream]
- name=CentOS Stream $releasever - AppStream
- baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/os/
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- countme=1
- enabled=1
- [appstream-debug]
- name=CentOS Stream $releasever - AppStream - Debug
- baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/debug/tree/
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [appstream-source]
- name=CentOS Stream $releasever - AppStream - Source
- baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/debug/tree/
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [crb]
- name=CentOS Stream $releasever - CRB
- baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/$basearch/os/
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- countme=1
- enabled=0
- [crb-debug]
- name=CentOS Stream $releasever - CRB - Debug
- baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/$basearch/debug/tree/
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [crb-source]
- name=CentOS Stream $releasever - CRB - Source
- baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/source/tree/
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
复制代码 - centos-addons.repo
- 清华源:
- centos.repo
- [baseos]
- name=CentOS Stream $releasever - BaseOS
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/BaseOS/$basearch/os
- # metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- countme=1
- enabled=1
- [baseos-debuginfo]
- name=CentOS Stream $releasever - BaseOS - Debug
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/BaseOS/$basearch/debug/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-debug-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [baseos-source]
- name=CentOS Stream $releasever - BaseOS - Source
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/BaseOS/source/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-baseos-source-$stream&arch=source&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [appstream]
- name=CentOS Stream $releasever - AppStream
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/AppStream/$basearch/os
- # metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- countme=1
- enabled=1
- [appstream-debuginfo]
- name=CentOS Stream $releasever - AppStream - Debug
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/AppStream/$basearch/debug/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-debug-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [appstream-source]
- name=CentOS Stream $releasever - AppStream - Source
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/AppStream/source/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-appstream-source-$stream&arch=source&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [crb]
- name=CentOS Stream $releasever - CRB
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/CRB/$basearch/os
- # metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- countme=1
- enabled=1
- [crb-debuginfo]
- name=CentOS Stream $releasever - CRB - Debug
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/CRB/$basearch/debug/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-crb-debug-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [crb-source]
- name=CentOS Stream $releasever - CRB - Source
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/CRB/source/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-crb-source-$stream&arch=source&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
复制代码 - centos-addons.repo
- [highavailability]
- name=CentOS Stream $releasever - HighAvailability
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/HighAvailability/$basearch/os
- # metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- countme=1
- enabled=0
- [highavailability-debuginfo]
- name=CentOS Stream $releasever - HighAvailability - Debug
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/HighAvailability/$basearch/debug/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-debug-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [highavailability-source]
- name=CentOS Stream $releasever - HighAvailability - Source
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/HighAvailability/source/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-highavailability-source-$stream&arch=source&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [nfv]
- name=CentOS Stream $releasever - NFV
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/NFV/$basearch/os
- # metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- countme=1
- enabled=0
- [nfv-debuginfo]
- name=CentOS Stream $releasever - NFV - Debug
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/NFV/$basearch/debug/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-debug-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [nfv-source]
- name=CentOS Stream $releasever - NFV - Source
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/NFV/source/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-nfv-source-$stream&arch=source&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [rt]
- name=CentOS Stream $releasever - RT
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/RT/$basearch/os
- # metalink=https://mirrors.centos.org/metalink?repo=centos-rt-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- countme=1
- enabled=0
- [rt-debuginfo]
- name=CentOS Stream $releasever - RT - Debug
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/RT/$basearch/debug/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-rt-debug-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [rt-source]
- name=CentOS Stream $releasever - RT - Source
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/RT/source/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-rt-source-$stream&arch=source&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [resilientstorage]
- name=CentOS Stream $releasever - ResilientStorage
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/ResilientStorage/$basearch/os
- # metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- countme=1
- enabled=0
- [resilientstorage-debuginfo]
- name=CentOS Stream $releasever - ResilientStorage - Debug
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/ResilientStorage/$basearch/debug/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-debug-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [resilientstorage-source]
- name=CentOS Stream $releasever - ResilientStorage - Source
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/$releasever-stream/ResilientStorage/source/tree/
- # metalink=https://mirrors.centos.org/metalink?repo=centos-resilientstorage-source-$stream&arch=source&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- enabled=0
- [extras-common]
- name=CentOS Stream $releasever - Extras packages
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/$releasever-stream/extras/$basearch/extras-common
- # metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-$stream&arch=$basearch&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- countme=1
- enabled=1
- [extras-common-source]
- name=CentOS Stream $releasever - Extras packages - Source
- baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/$releasever-stream/extras/source/extras-common
- # metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-source-$stream&arch=source&protocol=https,http
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
- gpgcheck=1
- repo_gpgcheck=0
- metadata_expire=6h
- 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 管理网络,需查抄服务状态:
- systemctl status NetworkManager
复制代码 若未运行,启动服务:
- systemctl start NetworkManager
- systemctl enable NetworkManager
复制代码 (3)网卡设置文件错误
查抄 /etc/sysconfig/network-scripts/ifcfg-ens160 文件:
- BOOTPROTO=dhcp # 使用 DHCP 获取 IP
- ONBOOT=yes # 开机自动启用网卡
- DEVICE=ens160 # 设备名称
- TYPE=Ethernet
复制代码 修改后重启网络服务:
- nmcli connection reload
- nmcli connection up ens160
复制代码 (4)DHCP 未分配 IP
实行手动触发 DHCP 哀求:
大概出现报错:
- bash: dhclient: command not found...
- 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]
复制代码 题目分析:
- dhclient 命令未找到:因为系统未安装 dhcp-client 软件包。
- DNS 解析失败:无法访问 mirrorlist.centos.org,原因是网络未正确配置(未获取 IP 或 DNS 设置错误)。
- 仓库镜像失效:CentOS 8 官方已停止维护(EOL),默认仓库不可用,需更换镜像源。
复制代码 办理方案:
- 第一步:手动设置网络(临时办理)
由于无法通过 DHCP 获取 IP 且 DNS 不可用,须要手动为 ens160 分配 IP 和 DNS。
启用 ens160 并设置静态 IP:
- sudo nmcli connection modify ens160 ipv4.addresses 192.168.80.100/24
- sudo nmcli connection modify ens160 ipv4.gateway 192.168.80.2
- sudo nmcli connection modify ens160 ipv4.dns "8.8.8.8"
- sudo nmcli connection modify ens160 ipv4.method manual
- sudo nmcli connection up ens160
复制代码 如果 ens160 的毗连名称不是 ens160,先用 nmcli connection show 检察实际名称。
将 192.168.80.100 更换为 VMnet8 网段内的空闲 IP,192.168.80.2 更换为 VMnet8 的网关(通常为 .2)。
验证网络连通性:
- ping 8.8.8.8 # 测试网络是否通
- ping google.com # 测试 DNS 是否生效
复制代码 - 第二步:修复 CentOS 8 堆栈镜像
由于官方堆栈已不可用,需更换为 vault 镜像源。
备份原有堆栈文件:
- sudo mkdir /etc/yum.repos.d/backup
- sudo mv /etc/yum.repos.d/CentOS-*.repo /etc/yum.repos.d/backup/
复制代码 创建新的堆栈文件:
- sudo vi /etc/yum.repos.d/CentOS-vault.repo
复制代码 输入以下内容:
- [base]
- name=CentOS-8 - Base
- baseurl=http://vault.centos.org/8.5.2111/BaseOS/$basearch/os/
- gpgcheck=1
- enabled=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- [appstream]
- name=CentOS-8 - AppStream
- baseurl=http://vault.centos.org/8.5.2111/AppStream/$basearch/os/
- gpgcheck=1
- enabled=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
复制代码 整理并更新堆栈缓存:
- sudo dnf clean all
- sudo dnf makecache
复制代码 - 第三步:安装 dhcp-client
- sudo dnf install -y dhcp-client
复制代码 - 第四步:规复 DHCP 自动获取 IP
如果盼望继续使用 DHCP(保举):
修改 ens160 为 DHCP 模式:
- sudo nmcli connection modify ens160 ipv4.method auto
- sudo nmcli connection down ens160 && sudo nmcli connection up ens160
复制代码 验证 IP 是否获取乐成:
- 第五步,删除多余的静态IP
- 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
- 从当地复制到长途主机:
- # 将 文件 `/Users/zhangsan/Downloads/a.txt` 复制到 `/root` 下
- zhangsan@MacBook-Pro ~ % scp Downloads/a.txt [email protected]:~
- [email protected]'s password:
- a.txt 100% 6850 17.9MB/s 00:00
- # 将 文件夹 `/Users/zhangsan/Downloads/a` 复制到 `/app` 下
- lisi@MacBook-Pro ~ % scp -r Downloads/a [email protected]:/app
- [email protected]'s password:
- a.txt 100% 2 6.0KB/s 00:00
- b.txt 100% 2 8.1KB/s 00:00
复制代码 - 从长途主机复制到当地
- # 将 文件夹 `/app/a` 复制到 `/Users/wangwu/Downloads` 下
- wangwu@MacBook-Pro ~ % scp -r [email protected]:/app/a ./Downloads
- [email protected]'s password:
- a.txt 100% 2 3.3KB/s 00:00
- b.txt 100% 2 4.6KB/s 00:00
- # 将 文件 `/root/a.txt` 复制到 `/Users/zhaoliu/Downloads` 下
- zhaoliu@MacBook-Pro ~ % scp [email protected]:~/a.txt ./Downloads
- [email protected]'s password:
- a.txt 100% 6850 6.9MB/s 00:00
复制代码 - 指定 SSH 端口
- # 如果远程主机的 SSH 端口不是默认的 22,可以使用 `-P` 选项指定端口:
- 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
- The authenticity of host '192.168.10.1 (192.168.10.1)' can't be establisheE
- d.
- ED25519 key fingerprint is SHA256:GRDS25029jPM20pop9520t59u40Javav13wChhD20.
- This key is not known by any other names.
- Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
- Warning: Permanently added '192.168.10.1' (ED25519) to the list of known host
- S•
- [email protected]'s password:
- Connected to 192.168.10.1.
- sftp>
复制代码 乐成创建毗连后,使用 get 下令可以下载文件,使用 put 下令可以上传文件
- get 服务器上文件的目次地点 当地存放的目次地点
- put 当地存放的目次地点 服务器上文件的目次地点
8、多捏造机共用同一份挂载盘
此部分内容拜见:
9、Linux 下令
(1)内核利用下令
- 检察内核列表
- rpm -qa | grep kernel | grep core
复制代码 - 检察体系当前内核版本
- 手动删除某个内核版原来镌汰开启启动项 (注意不要删除当前内核版本)
- yum remove kernel-core-4.18.0-193.el8.x86_64
复制代码 - 重启体系
(2)检察IP地点
- 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
|