bash: unzip: 未找到命令,sudo: nano:找不到命令

在 Ubuntu/Debian 系统上

打开终端并运行以下命令:

复制代码
sudo apt update
sudo apt install unzip

在 CentOS/RHEL 系统上

打开终端并运行以下命令:

复制代码
sudo yum install unzip

在 macOS 上

如果您使用的是 macOS,可以使用 Homebrew 安装 unzip(通常 macOS 默认已安装):

复制代码
brew install unzip

在 Windows 上

如果您在使用 Windows 的 WSL(Windows Subsystem for Linux),可以按照上述步骤安装。在 Windows 中,您可以使用文件资源管理器右键点击 ZIP 文件并选择"解压缩"选项。

安装完成后

安装完成后,您可以再次尝试解压文件

后续问题

复制代码
[root@master01 www]# sudo yum install unzip
已加载插件: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 源

如果问题仍然存在,您可以考虑更换 YUM 源。以下是更换为阿里云的 YUM 源的步骤:

备份原有的 YUM 源配置:

复制代码
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

编辑 YUM 源配置文件:

复制代码
sudo nano /etc/yum.repos.d/CentOS-Base.repo

将以下内容替换到文件中:

复制代码
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos7

[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos7

[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centos7
保存并退出,然后运行以下命令以清除缓存并更新:
sudo yum clean all
sudo yum makecache
  1. 安装 unzip
    在更新了 YUM 源后,您可以再次尝试安装 unzip:

    sudo yum install unzip

相关推荐
向宇it9 分钟前
【unity游戏开发——编辑器扩展】使用EditorGUI的EditorGUILayout绘制工具类在自定义编辑器窗口绘制各种UI控件
开发语言·ui·unity·c#·编辑器·游戏引擎
Python私教24 分钟前
Rust:重新定义系统编程的安全与效率边界
开发语言·安全·rust
cainiao0806051 小时前
Java 大视界——Java 大数据在智慧交通智能停车诱导系统中的数据融合与实时更新
java·大数据·开发语言
瑞雪兆丰年兮1 小时前
数学实验(Matlab符号运算)
开发语言·算法·matlab·数学实验
chxii1 小时前
6.2字节流
java·开发语言
八股文领域大手子1 小时前
Java死锁排查:线上救火实战指南
java·开发语言·面试
点云SLAM1 小时前
Python中列表(list)知识详解(2)和注意事项以及应用示例
开发语言·人工智能·python·python学习·数据结果·list数据结果
国强_dev1 小时前
任意复杂度的 JSON 数据转换为多个结构化的 Pandas DataFrame 表格
开发语言·python
o(╥﹏╥)2 小时前
绑定 SSH key(macos)
开发语言·git·学习·macos
小龙Guo2 小时前
QT+opencv实现卡尺工具找圆、拟合圆
开发语言·qt·opencv