O “yum” é o gerenciador de pacotes de distribuições Linux baseadas no Red Hat, vamos conhecer 8 opções de uso do comando para nosso dia-a-dia.
1 – Exibindo informações de um pacote:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@srv-centos ~]# yum info samba Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.ufscar.br * epel: mirror.math.princeton.edu * extras: mirror.ufscar.br * updates: mirror.ufscar.br Available Packages Name : samba Arch : x86_64 Version : 4.6.2 Release : 12.el7_4 Size : 633 k Repo : updates/7/x86_64 Summary : Server and Client software to interoperate with Windows machines URL : http://www.samba.org/ License : GPLv3+ and LGPLv3+ Description : Samba is the standard Windows interoperability suite of programs for Linux and : Unix. [root@srv-centos ~]# |
2 – Listando repositórios ativos:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[root@srv-centos ~]# yum repolist Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.ufscar.br * epel: epel.gtdinternet.com * extras: mirror.ufscar.br * updates: mirror.ufscar.br repo id repo name status base/7/x86_64 CentOS-7 - Base 9,591 epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 12,299 extras/7/x86_64 CentOS-7 - Extras 388 updates/7/x86_64 CentOS-7 - Updates 1,929 repolist: 24,207 [root@srv-centos ~]# |
3 – Exibindo informação de um repositório:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
[root@srv-centos ~]# yum repoinfo CentOS-7 - Base Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.ufscar.br * epel: epel.gtdinternet.com * extras: mirror.ufscar.br * updates: mirror.ufscar.br Repo-id : base/7/x86_64 Repo-name : CentOS-7 - Base Repo-status : enabled Repo-revision: 1504648209 Repo-updated : Tue Sep 5 18:51:13 2017 Repo-pkgs : 9,591 Repo-size : 7.6 G Repo-mirrors : http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock Repo-baseurl : http://mirror.ufscar.br/centos/7/os/x86_64/ (9 more) Repo-expire : 21,600 second(s) (last: Tue Feb 27 10:29:44 2018) Filter : read-only:present Repo-filename: /etc/yum.repos.d/CentOS-Base.repo repolist: 9,591 [root@srv-centos ~]# |
4 – Listando pacotes instalados:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@srv-centos ~]# yum list installed | head -n 20 Loaded plugins: fastestmirror Installed Packages GeoIP.x86_64 1.5.0-11.el7 @anaconda NetworkManager.x86_64 1:1.8.0-11.el7_4 @updates NetworkManager-libnm.x86_64 1:1.8.0-11.el7_4 @updates NetworkManager-team.x86_64 1:1.8.0-11.el7_4 @updates NetworkManager-tui.x86_64 1:1.8.0-11.el7_4 @updates NetworkManager-wifi.x86_64 1:1.8.0-11.el7_4 @updates acl.x86_64 2.2.51-12.el7 @anaconda aic94xx-firmware.noarch 30-6.el7 @anaconda alsa-firmware.noarch 1.0.28-2.el7 @anaconda alsa-lib.x86_64 1.1.3-3.el7 @anaconda alsa-tools-firmware.x86_64 1.1.0-1.el7 @anaconda audit.x86_64 2.7.6-3.el7 @anaconda audit-libs.x86_64 2.7.6-3.el7 @anaconda authconfig.x86_64 6.2.8-30.el7 @anaconda basesystem.noarch 10.0-7.el7.centos @anaconda bash.x86_64 4.2.46-29.el7_4 @updates bind-libs-lite.x86_64 32:9.9.4-51.el7_4.2 @updates bind-license.noarch 32:9.9.4-51.el7_4.2 @updates |
5 – Listando dependências de um pacote:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
[root@srv-centos ~]# yum deplist htop Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.ufscar.br * epel: epel.gtdinternet.com * extras: mirror.ufscar.br * updates: mirror.ufscar.br package: htop.x86_64 2.0.2-1.el7 dependency: libc.so.6(GLIBC_2.15)(64bit) provider: glibc.x86_64 2.17-196.el7_4.2 dependency: libgcc_s.so.1()(64bit) provider: libgcc.x86_64 4.8.5-16.el7_4.1 dependency: libgcc_s.so.1(GCC_3.0)(64bit) provider: libgcc.x86_64 4.8.5-16.el7_4.1 dependency: libgcc_s.so.1(GCC_3.3.1)(64bit) provider: libgcc.x86_64 4.8.5-16.el7_4.1 dependency: libm.so.6()(64bit) provider: glibc.x86_64 2.17-196.el7_4.2 dependency: libm.so.6(GLIBC_2.2.5)(64bit) provider: glibc.x86_64 2.17-196.el7_4.2 dependency: libncursesw.so.5()(64bit) provider: ncurses-libs.x86_64 5.9-14.20130511.el7_4 dependency: libtinfo.so.5()(64bit) provider: ncurses-libs.x86_64 5.9-14.20130511.el7_4 dependency: rtld(GNU_HASH) provider: glibc.x86_64 2.17-196.el7_4.2 provider: glibc.i686 2.17-196.el7_4.2 [root@srv-centos ~]# |
6 – Reinstalando um pacote:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
Complete! [root@srv-centos ~]# yum reinstall wget Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.ufscar.br * epel: epel.gtdinternet.com * extras: mirror.ufscar.br * updates: mirror.ufscar.br Resolving Dependencies --> Running transaction check ---> Package wget.x86_64 0:1.14-15.el7_4.1 will be reinstalled --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================================================ Package Arch Version Repository Size ================================================================================================================================================================================ Reinstalling: wget x86_64 1.14-15.el7_4.1 updates 547 k Transaction Summary ================================================================================================================================================================================ Reinstall 1 Package Total download size: 547 k Installed size: 2.0 M Is this ok [y/d/N]: y |
7 – Procurando um pacote:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
[root@srv-centos ~]# yum search squid Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.ufscar.br * epel: mirror.upb.edu.co * extras: mirror.ufscar.br * updates: mirror.ufscar.br ============================================================================== N/S matched: squid ============================================================================== squid.x86_64 : The Squid proxy caching server squid-migration-script.x86_64 : Migration script for squid caching proxy squid-sysvinit.x86_64 : SysV initscript for squid caching proxy squidGuard.x86_64 : Filter, redirector and access controller plugin for squid calamaris.noarch : Squid native log format (NLF) analyzer and report generator libecap.i686 : Squid interface for embedded adaptation modules libecap.x86_64 : Squid interface for embedded adaptation modules Name and summary matches only, use "search all" for everything. [root@srv-centos ~]# |
8 – Limpando pacotes salvos no cache:
1 2 3 4 5 6 |
[root@srv-centos ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: base epel extras updates Cleaning up everything Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos Cleaning up list of fastest mirrors |
É isso ae, até a próxima. 😉