Skip to main content
Engineering LibreTexts

11-D.4: Repository Configuration

  • Page ID
    41951
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    EXAM OBJECTIVES COVERED
    2.1 Given a scenario, conduct software installations, configurations, updates, and removals.

    Repositories in Linux

    On Linux systems most software is packaged in .deb or .rpm, files which contain the programs and libraries you need. These packages are stored in repositories, or repos. Repositories are servers which contain sets of packages. These packages can be downloaded using package manager utilities like yum or apt that we have discussed.

    There are generally three different levels of repositories:

    1. Local repositories - where each system has their own repository. It is best if these are used for packages that the system's user wants to use for specific purposes. If a local repository is used more for software that is used across the organization then it is very easy to create version conflicts because each system has their own repository.
    2. Centralized repository - to resolve the problem mentioned above, there are central repositories where systems across the organization can download their packages from. This makes it much easier for system administrators to control what versions users are running.
    3. Vendor repository - the software vendor controls these repositories, and which version are made available.

    yum: Repository Configuration

    The configuration file for yum and related utilities is located at /etc/yum.conf. This file contains one mandatory [main] section, which allows you to set Yum options that have global effect, and may also contain one or more [repository] sections, which allow you to set repository-specific options. However, best practice is to define individual repositories in new or existing .repo files in the /etc/yum.repos.d/directory. The values you define in the [main] section of the /etc/yum.conf file may override values set in individual [repository] sections.

    pbmac@pbmac-server $  mkdir -p /home/pbmac/test-package/repo
    pbmac@pbmac-server $  chown -R root.root /home/pbmac/test-package/repo
    pbmac@pbmac-server $  createrepo /home/pbmac/test-package/repo
    pbmac@pbmac-server $  chmod -R o-w+r /home/pbmac/test-package/repo

    Create a repository configuration file, e.g. /etc/yum.repos.d/testP.repo containing below configuration.

    [testP]
    name=Pat's Test Repo
    baseurl=file:///home/pbmac/test-package/repo
    enabled=1
    gpgcheck=0

    Now, use yum repolist, and you will see the newly created repository in the list of accessible repositories.

    pbmac@pbmac-server $  yum repolist
    Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    rhel_repo                          | 2.9 kB     00:00 ... 
    rhel_repoprimary_db                | 367 kB     00:00 ... 
    repo id                            repo name                        status
    RHEL_6.4_Disc                      RHEL_6.4_x86_64_Disc             3,648
    testP                              Pat's Test Repo                    150

    apt: Repository Configuration

    Ubuntu uses apt for package management. apt stores a list of repositories or software channels in the file

    /etc/apt/sources.list

    and in any file with the suffix .list under the directory:

    /etc/apt/sources.list.d/

    See man sources.list for more about this storage mechanism.

    By editing these files from the command line, we can add, remove, or temporarily disable software repositories.

    Typically, the beginning of the file /etc/apt/sources.list looks like this:

    # sources.list
    #deb cdrom:[Ubuntu 13.10 _Saucy Salamander_ - Release i386 (20131016.1)]/ saucy main restricted
    
    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted
    deb-src http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted
    #...

    Explanation of the Repository Format

    • All the lines beginning with one or two hashes (#) are comments, for information only.
    • The lines without hashes are apt repository lines. Here's what they say:

       

      • deb: These repositories contain binaries or pre-compiled packages. These repositories are required for most users.

         

      • deb-src: These repositories contain the source code of the packages. Useful for developers.

         

      • http://archive.ubuntu.com/ubuntu: The URI (Uniform Resource Identifier), in this case a location on the internet.

         

      • saucy is the release name or version of your distribution.

         

      • main & restricted are the section names or components. There can be several section names, separated by spaces.

         

    Adapted from:
    "Repositories/CommandLine" by Mikkel Kirkgaard Nielsen, CommunityHelpWiki is licensed under CC BY-SA 3.0


    This page titled 11-D.4: Repository Configuration is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Patrick McClanahan.

    • Was this article helpful?