关于Centos无法正常下载?

故障案例:

[ root@sunboyytd ~ ] #yum  install  -y  vim
已加载插件:fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&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/x86_64

故障原因:因丢失yum源,没有缓存在本地进而无法使之前安装的一些软件。

解决办法:

[ root@sunboyytd ~ ] #cd /etc/yum.repos.d
[ root@sunboyytd /etc/yum.repos.d ] #ll
总用量 40
-rw-r--r--. 1 root root 1664 10月 23 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 10月 23 2020 CentOS-CR.repo
-rw-r--r--. 1 root root  649 10月 23 2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 10月 23 2020 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 10月 23 2020 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 10月 23 2020 CentOS-Sources.repo
-rw-r--r--. 1 root root 8515 10月 23 2020 CentOS-Vault.repo
-rw-r--r--. 1 root root  616 10月 23 2020 CentOS-x86_64-kernel.repo
[ root@sunboyytd /etc/yum.repos.d ] #rm  -rf *
[ root@sunboyytd /etc/yum.repos.d ] #ll
总用量 0
[ root@sunboyytd /etc/yum.repos.d ] #curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2523  100  2523    0     0   6117      0 --:--:-- --:--:-- --:--:--  6138
[ root@sunboyytd /etc/yum.repos.d ] #ls
CentOS-Base.repo
[ root@sunboyytd /etc/yum.repos.d ] #yum  makecache
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                                                      | 3.6 kB  00:00:00     
extras                                                                                                                                                                                    | 2.9 kB  00:00:00     
updates                                                                                                                                                                                   | 2.9 kB  00:00:00     
(1/10): base/7/x86_64/group_gz                                                                                                                                                            | 153 kB  00:00:01     
base/7/x86_64/primary_db       FAILED                                          
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/6d0c3a488c282fe537794b5946b01e28c7f44db79097bb06826e1c0c88bad5ef-primary.sqlite.bz2: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
正在尝试其它镜像。
(2/10): extras/7/x86_64/other_db                                                                                                                                                          | 154 kB  00:00:00     
(3/10): extras/7/x86_64/filelists_db                                                                                                                                                      | 305 kB  00:00:02     
(4/10): base/7/x86_64/other_db                                                                                                                                                            | 2.6 MB  00:00:06     
(5/10): updates/7/x86_64/filelists_db                                                                                                                                                     |  15 MB  00:00:09     
(6/10): base/7/x86_64/primary_db                                                                                                                                                          | 6.1 MB  00:00:03     
base/7/x86_64/filelists_db     FAILED                                          
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/d6d94c7d406fe7ad4902a97104b39a0d8299451832a97f31d71653ba982c955b-filelists.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
正在尝试其它镜像。
extras/7/x86_64/primary_db     FAILED                                                     45% [====================================                                            ] 602 kB/s |  28 MB  00:00:55 ETA 
http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/e12dbf10e94bc2b33b1f45e026559bc8685728b139dddae0654d96bc624c5602-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
正在尝试其它镜像。
updates/7/x86_64/primary_db    FAILED                                                     47% [=====================================-                                          ] 739 kB/s |  29 MB  00:00:44 ETA 
http://mirrors.aliyuncs.com/centos/7/updates/x86_64/repodata/f19044932626155f0cd849e88972b84875fc85e3308b4d622844a911c4ef54d0-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
正在尝试其它镜像。
(7/10): extras/7/x86_64/primary_db                                                                                                                                                        | 253 kB  00:00:00     
(8/10): base/7/x86_64/filelists_db                                                                                                                                                        | 7.2 MB  00:00:04     
updates/7/x86_64/other_db      FAILED                                                     56% [============================================-                                   ] 1.2 MB/s |  34 MB  00:00:22 ETA 
http://mirrors.aliyuncs.com/centos/7/updates/x86_64/repodata/14ff80eeb5b7c2c703cb151b97a17a9cec41fbe5c820b6e73a015d522e02bfe7-other.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
正在尝试其它镜像。
(9/10): updates/7/x86_64/other_db                                                                                                                                                         | 1.6 MB  00:00:00     
(10/10): updates/7/x86_64/primary_db                                                                                                                                                      |  27 MB  00:00:20     
元数据缓存已建立

建立好之后重新更新软件即可

 #yum  install  -y  lrzsz
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 lrzsz.x86_64.0.0.12.20-36.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=================================================================================================================================================================================================================
 Package                                         架构                                             版本                                                      源                                              大小
=================================================================================================================================================================================================================
正在安装:
 lrzsz                                           x86_64                                           0.12.20-36.el7                                            base                                            78 k

事务概要
=================================================================================================================================================================================================================
安装  1 软件包

总下载量:78 k
安装大小:181 k
Downloading packages:
警告:/var/cache/yum/x86_64/7/base/packages/lrzsz-0.12.20-36.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
lrzsz-0.12.20-36.el7.x86_64.rpm 的公钥尚未安装
lrzsz-0.12.20-36.el7.x86_64.rpm                                                                                                                                                           |  78 kB  00:00:00     
从 http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
 用户ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 指纹       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 来自       : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : lrzsz-0.12.20-36.el7.x86_64                                                                                                                                                                  1/1 
  验证中      : lrzsz-0.12.20-36.el7.x86_64                                                                                                                                                                  1/1 

已安装:
  lrzsz.x86_64 0:0.12.20-36.el7                                                                                                                                                                                  

完毕!

<think>首先,用户的问题是:“how to connect to centos 7 on vmware using mobaxterm”,翻译成中文是:“如何使用MobaXterm连接运行在VMware中的CentOS 7系统”。这是一个技术问题,我需要提供清晰的步骤。 系统级指令要求: - 所有行内数学表达式使用$...$格式,但在这个问题中,可能没有数学表达式,所以我可以忽略。 - 独立公式使用$$...$$并单独成段,同样,可能不需要。 - LaTeX语法正确。 - 使用中文回答。 - 生成相关问题。 - 引用的段落末尾自然地添加引用标识,如[^1]。 用户可见层要求: - 回答结构清晰,逐步解决问题。 - 保证回答真实可靠。 参考站内引用提供了相关信息: - 引用[1]提到CentOS 7的Gnome问题,建议使用其他显示管理器。 - 引用[2]是VMware文档。 - 引用[3][4][5]是关于安装LAMP的,可能不直接相关。 - 用户上一次的问题是关于使用MobaXterm连接CentOS 7 on VMware,所以我应该基于此构建回答。 关键点: - VMware中的CentOS 7需要配置网络和SSH服务。 - MobaXterm是一个支持SSH、X11等的终端工具。 - 步骤包括: 1. 确保VMware虚拟机网络设置正确(例如,NAT或桥接)。 2. 在CentOS 7上启用SSH服务。 3. 获取CentOS 7的IP地址。 4. 使用MobaXterm通过SSH连接。 从引用[1]中,CentOS 7可能有Gnome问题,但MobaXterm通常通过SSH连接,所以可能不需要X11转发,除非用户指定。引用[1]说:“Gnome in CentOS 7 tries to use local hardware acceleration...”,所以如果用户想使用图形界面,可能需要额外步骤。 用户的问题没有指定是否需要图形界面,所以我应该涵盖SSH连接,并提及如果需要图形界面时的注意事项。 结构回答: 1. **介绍**:简要解释过程。 2. **前提条件**:列出需要的东西(如VMware安装、CentOS 7运行、MobaXterm安装)。 3. **步骤**: a. 配置VMware网络。 b. 在CentOS 7上设置SSH。 c. 获取IP地址。 d. 使用MobaXterm连接。 4. **常见问题**:处理可能的问题(如SSH未启用、防火墙问题)。 5. **生成相关问题**:在最后添加相关问题。 引用:在回答中,如果引用参考内容,添加标识。例如,引用[1]提到Gnome问题,所以如果涉及X11,可以引用。 在回答中,我需要自然地添加引用。例如,如果提到图形界面问题,可以说:“注意,CentOS 7的Gnome可能在使用XDMCP远程连接时有问题[^1]。” 现在,构建回答大纲: - **步骤1:确保VMware虚拟机网络配置正确** - 解释如何设置网络适配器(NAT或桥接)。 - **步骤2:在CentOS 7上启用SSH服务** - 安装和启动sshd服务。 - 确保防火墙允许SSH。 - **步骤3:获取CentOS 7的IP地址** - 使用`ip addr`命令。 - **步骤4:使用MobaXterm连接** - 打开MobaXterm,选择SSH会话,输入IP地址和用户名。 - **如果需要图形界面**:解释如何启用X11转发,但警告可能的问题(引用[1])。 相关问题生成: 1. 如何解决CentOS 7 SSH连接问题? 2. MobaXterm的高级功能有哪些? 3. 如何在VMware中优化CentOS 7的性能? 确保回答真实可靠:基于标准知识,参考提供的引用。 最终回答用中文。</think>### 如何使用MobaXterm连接运行在VMware中的CentOS 7系统 MobaXterm 是一款功能强大的远程终端工具,支持 SSH、X11 转发等,适用于连接 VMware 虚拟机中的 CentOS 7 系统。以下是详细的步骤指南,确保连接过程可靠。整个过程分为四个主要步骤:**前提条件检查**、**VMware 网络配置**、**CentOS 7 SSH 服务设置**和**MobaXterm 连接操作**。如果遇到问题,请参考“常见问题解决”部分。 --- #### 前提条件 在开始前,请确保满足以下要求: - VMware Workstation 或 VMware Player 已安装,并创建了 CentOS 7 虚拟机。 - CentOS 7 系统已启动,且您拥有管理员权限(root 或 sudo 用户)。 - MobaXterm 已下载并安装在本地 Windows 主机上(可从 [MobaXterm 官网](https://mobaxterm.mobatek.net/) 获取)。 - VMware 虚拟机网络设置为 NAT 或桥接模式(推荐 NAT 模式以简化 IP 获取)。 --- #### 步骤1: 配置 VMware 网络 确保虚拟机网络设置正确,以便 CentOS 7 可以访问外部网络。 1. 打开 VMware,选择目标 CentOS 7 虚拟机。 2. 右键点击虚拟机,选择“设置” > “网络适配器”。 3. 设置适配器类型为“NAT”或“桥接”(默认 NAT 通常更简单)。 - **NAT 模式**:虚拟机共享主机 IP,适合大多数场景。 - **桥接模式**:虚拟机获取独立 IP,类似物理设备(需确保网络支持 DHCP)。 4. 启动 CentOS 7 虚拟机,并登录系统。 > **注意**:如果使用 NAT 模式,VMware 会为虚拟机分配一个私有 IP(如 `192.168.x.x`),无需额外配置网关[^2]。 --- #### 步骤2: 在 CentOS 7 上启用 SSH 服务 SSH 是远程连接的基础服务。CentOS 7 默认安装了 SSH 服务器,但需手动启动和配置。 1. **检查 SSH 服务状态**: 在 CentOS 7 终端中运行以下命令: ```bash sudo systemctl status sshd ``` 如果服务未运行(显示 `inactive`),则启动它: ```bash sudo systemctl start sshd sudo systemctl enable sshd # 设置开机自启 ``` 2. **配置防火墙允许 SSH**: CentOS 7 默认防火墙可能阻止 SSH 连接。运行: ```bash sudo firewall-cmd --permanent --add-service=ssh # 添加SSH规则 sudo firewall-cmd --reload # 重新加载防火墙 ``` 3. **获取 CentOS 7 的 IP 地址**: 在终端输入: ```bash ip addr show | grep inet ``` 查找类似 `inet 192.168.x.x/24` 的输出(例如 `192.168.1.100`)。记录此 IP 地址,稍后用于连接。 > **注意**:如果 IP 地址未显示,检查网络服务是否正常:`sudo systemctl restart network`。 --- #### 步骤3: 使用 MobaXterm 连接 现在通过 SSH 连接到 CentOS 7。 1. 打开 MobaXterm 在本地 Windows 主机上。 2. 点击左上角“会话”按钮,选择“SSH”。 3. 在“远程主机”字段输入 CentOS 7 的 IP 地址(如 `192.168.1.100`)。 4. 指定用户名(默认 `root` 或您创建的普通用户)。 5. 勾选“指定用户名”并输入凭据。 6. 点击“确定”建立连接。 - 首次连接时,MobaXterm 会提示接受主机密钥(点击“Yes”)。 - 输入密码后,即可进入 CentOS 7 终端。 **可选:图形界面 (X11 转发)** 如果需运行图形应用(如 Gnome 桌面),在 MobaXterm 中启用 X11 转发: - 在 SSH 会话设置中,勾选“X11 forwarding”。 - 连接后,运行命令如 `gedit` 或 `firefox` 启动图形窗口。 - **警告**:CentOS 7 的 Gnome 可能因硬件加速问题导致 X11 连接失败,建议使用轻量级桌面(如 XFCE)或避免图形界面[^1]。 --- #### 常见问题解决 - **SSH 连接失败**: 检查 CentOS 7 的 SSH 服务状态(`systemctl status sshd`),确保防火墙未阻止端口 22。运行 `sudo yum install openssh-server` 安装缺失组件。 - **IP 地址无法获取**: 在 VMware 中重启虚拟机或重置网络适配器。确保 VMware 服务正常运行(引用 VMware 文档[^2])。 - **X11 图形问题**: 如果 MobaXterm 显示黑屏或错误,尝试禁用 Gnome 硬件加速或改用其他显示管理器[^1]。运行 `sudo yum groupinstall "Xfce"` 安装 XFCE 桌面。 - **权限问题**: 使用 `sudo` 执行命令,或编辑 `/etc/ssh/sshd_config` 允许 root 登录(设置 `PermitRootLogin yes` 后重启 sshd)。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值