yum & repos - alex-aleyan/linux_wiki GitHub Wiki

Mirrors:

Add EPEL (it's that easy):

  • Installed Meld
    yum install epel-release
    yum install meld
    

Useful Directories:

  • In this directory, MIRRORS are listed within each file:

    /etc/yum.repos.d

  • vim /etc/fstab:/dev/sr0 /media/centos7 iso9660 defaults 0 0

Install/Delete package:

# Install a Package with YUM
yum install util_name
yum -y install util_name
# Install a Package from Specific Repository
yum --disablerepo="*" --enablerepo="FullDisk" install wireshark
# Removing a Package with YUM
yum remove util_name #quiet
yum -y remove util_name #quiet

Update package:

# check for available update:
yum check-update
# update particular utility:
yum update util_name
# update all:
yum update

Search for a package package:

# List all available packages in the YUM Database:
yum list
# search for a particular package
yum list util_name
# Search for a Package when not know the exact name of the package:
yum search util_name
# list installed packages:
yum list installed

Get info about a package:

# Get info about a package
yum info util_name 
# Determine which package the file belongs to:
yum provides /path_to_file
yum whatprovides /path_to_file
yum deplist <utility_name>

Work with the Groups:

# Adding groups to the repo (https://unix.stackexchange.com/questions/246953/how-do-i-get-yum-groupinstall-to-work-without-a-groups-install-file):
createrepo -g <path to repo>/repodata/*comps.xml --update <path to repo>
yum clean all
# List all available Group Packages:
yum grouplist
# See who provides a given 'Group_name'
yum groupinfo "Development Tools"
# Install a Group Packages
yum groupinstall "Development Tools"
# Update a Group Packages
yum groupupdate "Development Tools"
# Remove a Group Packages
yum groupremove "Development Tools"

Yum Configuration:

# List Enabled Yum Repositories
yum repolist
# List all Enabled and Disabled Yum Repositories
yum repolist all
# Interactive Yum Shell
yum shell
# Clean Yum Cache
yum clean all
# View History of Yum
yum history

Add Repo:

  1. To add a remote mirror:

    1. Configure proxy:

      vim /etc/yum.conf
      proxy=http://<YOUR PROXY HERE>:8080
      
    2. Add the mirror (you might need to install ca-certificates and yum-utils):

      yum-config-manager --add-repo=<HTTP LINK HERE>
      
    3. You might have to disable firewalld and selinux.

  2. Copy the repos from DVD1 and DVD2 to a local diretory:

    cp -r /media/dvd1/* /repo/centos/
    cp -r /media/dvd2/Packages/* /repo/centos/Packages
    
  3. Create the repo file:

    [root@z_book_vm altera]# cat /etc/yum.repos.d/CentOS-DVD.repo 
    
    
    # CentOS-Media.repo
    #
    #  This repo can be used with mounted DVD media, verify the mount point for
    #  CentOS-6.  You can use this repo and yum to install items directly off the
    #  DVD ISO that we release.
    #
    # To use this repo, put in your DVD and use it with the other repos too:
    #  yum --enablerepo=c6-media [command]
    #  
    # or for ONLY the media repo, do this:
    #
    #  yum --disablerepo=\* --enablerepo=c6-media [command]
    
    [centos6-DVD]
    name=CentOS-$releasever - Media
    baseurl=file:///repo/centos
    gpgcheck=0
    enabled=1
    
  4. Create an actual repo first:

    createrepo /home99/RHEL6.9_Server
    
    1. if createrepo is not installed:

      rpm -ivh libxml2-python-2.9.1-5.el7.x86_64.rpm 
      rpm -ivh deltarpm-3.6-3.el7.x86_64.rpm 
      rpm -ivh python-deltarpm-3.6-3.el7.x86_64.rpm
      rpm -ivh createrepo-0.9.9-23.el7.noarch.rpm
      
  5. Let the yum know about the repo changes:

    createrepo --update /home99/RHEL6.9_Server
    rm -rf /var/cache/yum/*
    yum clean all
    
  6. This step is optional and will update the whole system's utilities with the lates stuff found in repos:

    yum update
    
  7. To turn on/off a repo (disabling all repos except the local ones seems to resolve issues!):

    yum repolist all
    yum --disablerepo=”*” --enablerepo=”reponame” list available
    yum-config-manager --add-repo "repository_url"
    yum-config-manager --enable "<REPO NAME>"
    yum-config-manager --disable "<REPO NAME>"
    
    1. if yum-config-manager is not installed:

      rpm -ivh python-chardet-2.2.1*
      rpm -ivh python-kitchen-1.1.1-*
      rpm -ivh yum-utils-1.1.*
      
⚠️ **GitHub.com Fallback** ⚠️