我尝试使用以下命令安装 yum
sudo apt-get install yum*
这占用了大约 500 mb 以上的软件包和超过 1gb 的磁盘空间。这个命令有什么用?如果错误,如何恢复这些更改?
答案1
命令
sudo apt-get install yum*
安装所有名称包含“yu”的软件包(假设您在运行命令的文件夹中没有匹配的文件yum*
)。您很可能不希望出现这种情况。
从技术上讲,yum*
被解释为正则表达式,意思是“yu
后面跟着零个或多个实例m
”,用于进行子字符串匹配。
要恢复更改,请查看/var/log/apt/history.log
使用该命令安装了哪些软件包并将其删除。
运行您不理解的命令通常是一个非常糟糕的主意。
答案2
Florian Diesch 已经解释了运行该命令时发生的情况 - 它会安装所有与yum*
正则表达式匹配的包。我将解释如何撤消它。
apt
有一个日志文件/var/log/apt/history.log
,其中记录了日期和已安装的软件包。请看我的一个示例条目:
Start-Date: 2015-09-29 13:10:47
Commandline: apt-get install fail2ban
Install: python-pyinotify:amd64 (0.9.4-1build1, automatic), fail2ban:amd64 (0.8.11-1)
End-Date: 2015-09-29 13:10:54
它说明下载何时开始、何时结束,期间显示运行的确切命令,并Install:
显示以该格式安装的所有软件包package-name:architecture ( version )
。
因此,为了撤消您运行的命令的效果,您需要选择列出的所有包,然后运行sudo apt-get remove
它们。
这是一个小型 awk 脚本,它可以为您提供所有这些包的列表。
awk '/Commandline: apt-get install yum/,/End-Date/ { for (i=1;i<=NF;i++){ if($i~/amd64/){ sub(/amd64/,""); gsub(/\:/,""); print $i} } }' /var/log/apt/history.log
它的作用是选择和之间的所有文本Commandline: apt-get install yum
,End-Date
找到所有包含:amd64
字符串的字段,然后打印出不包含该部分的文本。记得用你的架构替换 amd64,您可以使用dpkg --print-architecture
例如,这是我运行的命令的简短输出apt-get install yakuake
xieerqi:$ awk '/Commandline: apt-get install yakuake/,/End-Date/ { for (i=1;i<=NF;i++){ if($i~/amd64/){ sub(/amd64/,""); >
libkde3support4
ntrack-module-libnl-0
libkrosscore4
libqapt2
oxygen-icon-theme
libktexteditor4
kdelibs5-data
libnepomukcleaner4
libkdeui5
libkdeclarative5
libthreadweaver4
phonon-backend-gstreamer
konsole
答案3
正如 Florian 所解释的那样,在没有正确理解的情况下使用正则表达式会产生负面影响。仅仅因为一个命令中的星号曾经达到你的预期并不意味着它总是合适或安全的语法。例如,另一个用户尝试使用 安装 android 开发工具android*
,这让他的系统处于无法启动状态。 幸运的你。
包管理器确实警告过你。以下是来自可信虚拟机的示例:
$ sudo apt-get install yum*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'yudit-common' for regex 'yum*'
Note, selecting 'libjs-yui3-min' for regex 'yum*'
Note, selecting 'libghc-tinyurl-prof-0.1.0-bf4c8' for regex 'yum*'
Note, selecting 'ibus-table-jyutping' for regex 'yum*'
Note, selecting 'zekr-quran-recitation-online-ayyub' for regex 'yum*'
Note, selecting 'python-yubico-tools' for regex 'yum*'
Note, selecting 'yhsm-yubikey-ksm' for regex 'yum*'
Note, selecting 'libghc-tinyurl-doc' for regex 'yum*'
Note, selecting 'libpam-yubico' for regex 'yum*'
Note, selecting 'yui-compressor' for regex 'yum*'
Note, selecting 'python-yubico' for regex 'yum*'
Note, selecting 'python3-pyudev' for regex 'yum*'
Note, selecting 'yubikey-ksm' for regex 'yum*'
Note, selecting 'fcitx-table-jyutping' for regex 'yum*'
Note, selecting 'yubikey-personalization-gui' for regex 'yum*'
Note, selecting 'compass-yui-plugin' for regex 'yum*'
Note, selecting 'yum-utils' for regex 'yum*'
Note, selecting 'yubiserver' for regex 'yum*'
Note, selecting 'yubikey-personalization' for regex 'yum*'
Note, selecting 'yum' for regex 'yum*'
Note, selecting 'fso-sounds-yue-base' for regex 'yum*'
Note, selecting 'librime-data-jyutping' for regex 'yum*'
Note, selecting 'iwyu' for regex 'yum*'
Note, selecting 'libjs-yui3-common' for regex 'yum*'
Note, selecting 'libjs-yui3-full' for regex 'yum*'
Note, selecting 'yubikey-server-c' for regex 'yum*'
Note, selecting 'libghc-tinyurl-prof' for regex 'yum*'
Note, selecting 'python-pyudev' for regex 'yum*'
Note, selecting 'libghc-tinyurl-dev-0.1.0-bf4c8' for regex 'yum*'
Note, selecting 'yorick-yutils' for regex 'yum*'
Note, selecting 'libkeyutils-dev' for regex 'yum*'
Note, selecting 'libkokyu-dev' for regex 'yum*'
Note, selecting 'quantum-plugin-ryu-agent' for regex 'yum*'
Note, selecting 'libyubikey-dev' for regex 'yum*'
Note, selecting 'keyutils' for regex 'yum*'
Note, selecting 'libjs-yui' for regex 'yum*'
Note, selecting 'keyutils-dbg' for regex 'yum*'
Note, selecting 'libjs-yui-doc' for regex 'yum*'
Note, selecting 'libjs-yui2' for regex 'yum*'
Note, selecting 'yubikey-val' for regex 'yum*'
Note, selecting 'quantum-plugin-ryu' for regex 'yum*'
Note, selecting 'python-myghtyutils' for regex 'yum*'
Note, selecting 'libauth-yubikey-decrypter-perl' for regex 'yum*'
Note, selecting 'neutron-plugin-ryu' for regex 'yum*'
Note, selecting 'xfonts-ayu' for regex 'yum*'
Note, selecting 'libapache2-mod-authn-yubikey' for regex 'yum*'
Note, selecting 'fso-sounds-yue-full' for regex 'yum*'
Note, selecting 'neutron-plugin-ryu-agent' for regex 'yum*'
Note, selecting 'yui-builder' for regex 'yum*'
Note, selecting 'yudit' for regex 'yum*'
Note, selecting 'libyubikey0' for regex 'yum*'
Note, selecting 'yudit-doc' for regex 'yum*'
Note, selecting 'python2.7-yubico' for regex 'yum*'
Note, selecting 'libkokyu-6.0.3' for regex 'yum*'
Note, selecting 'libjs-yui3-doc' for regex 'yum*'
Note, selecting 'libkeyutils1' for regex 'yum*'
Note, selecting 'libjs-yui3-debug' for regex 'yum*'
Note, selecting 'libghc-tinyurl-dev' for regex 'yum*'
Note, selecting 'libauth-yubikey-webclient-perl' for regex 'yum*'
Note, selecting 'fcitx-sayura' for regex 'yum*'
Note, selecting 'libghc-tinyurl-dev' instead of 'libghc-tinyurl-dev-0.1.0-bf4c8'
Note, selecting 'libghc-tinyurl-prof' instead of 'libghc-tinyurl-prof-0.1.0-bf4c8'
Note, selecting 'python-yubico' instead of 'python2.7-yubico'
Note, selecting 'zekr' instead of 'zekr-quran-recitation-online-ayyub'
libkeyutils1 is already the newest version.
libkeyutils1 set to manually installed.
The following extra packages will be installed:
alembic ant ant-contrib ant-optional apache2 apache2-bin apache2-data
binfmt-support ...
...
0 upgraded, 360 newly installed, 0 to remove and 0 not upgraded.
Need to get 291 MB of archives.
After this operation, 1.668 MB of additional disk space will be used.
Do you want to continue? [Y/n]
如果您不想安装 +1GB 的软件包,那么现在就说“不”,并且务必仔细阅读。
有趣的是,yum 和 rpm 都在存储库中,但我不记得有任何网站推荐以这种方式管理基于 Debian 的发行版上的软件,而且安装 yum 后当然没有配置存储库,因此它不能用作 apt 的替代品。另一方面,Fedora 切换到另一个工具进行包管理,安装外部包可能会导致系统不稳定,所以我不明白为什么有人会想要安装 yum。
答案4
apt-get是包管理器Ubuntu和别的Debian 发行版
好吃是包管理器红帽、Oracle、Arch Linux和别的Fedora 发行版。
例如:
苹果系统包管理器自制和Mac 应用商店
iOS包管理器是应用商店
安卓包管理器Google Play 商店,1移动市场,ApkPure,移动基因,等。
当你运行该命令时,你刚刚将第二个包管理器安装到系统中。现在你也可以安装“rpm 格式的 fedora 应用程序”同样,只需运行命令:
yum-config-manager --add-repo [repository_url]
yum install [fedora_app_name]
是的,它占用一些内存。它的包很大。