FedoraForum.org - Fedora Support Forums and Community
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Location
    In your closet
    Posts
    16,567
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)

    Create your own local yum repositories

    I'd like to share my notes with all on how I create local yum repositories. By local I mean that the rpm files are on a computer here at home, not somewhere out in cyberspace. I've done this since Fedora 9 with both the "Fedora" repository and the install DVD.

    This how to was written with Fedora 14 in mind but should work equally as well with any earlier release.


    The installation DVD files

    Note: For all terminal commands I'll be using the su -c command. To use this command you will need to know the root password and use it when prompted.

    I'll also be using the vi text editor. Of course, feel free to substitute with the editor of choice.

    I'll be using the Fedora 14 x86_64 installation DVD. This method will work equally as well with the 32 Bit installation DVD.


    I've seen a few threads here where members have asked about creating a yum repository of all the files contained on the installation DVD. Here's what to do.

    Step 1. Create a folder to hold the files.

    Start by opening a terminal and deciding where to keep the rpm files. You can put them almost anywhere you want. For this example I've created a folder under / called fedora64.

    Code:
    su -c 'mkdir /fedora64'
    Step 2. Get the files.

    Now that you have a place to keep your rpm files let's actually put some files in there. Insert your installation DVD and wait for it to mount. This should happen automatically and Nautilus will probably open up showing you the disk's contents. Close it.

    Now type
    Code:
    mount
    The output should include information on the mounted DVD disk. Here's that output on my computer.
    Code:
    /dev/sr0 on /media/Fedora 14 x86_64 DVD type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=500,gid=500,iocharset=utf8,mode=0400,dmode=0500)
    We'll use this information to copy the files, using tab completion to complete a path that contains spaces. The rpm files are kept in a folder on the installation DVD called Packages. Let's copy the files. In the terminal type

    Code:
    su
    <password>
    cp /media/Fed<tab>P<tab> /fedora64/
    By using the tab key the path will be filled in for you automatically. The end result is the following command.
    Code:
    cp /media/Fedora\ 14\ x86_64\ DVD/Packages/ /fedora64/
    Keep in mind that this copy operation will likely take several minutes as there are some 2500+ files in the Packages folder.

    When the copy operation is complete you need to run createrepo on this new folder. For an explanation of what createrepo does hit this link or simple type man createrepo.

    If you don't have createrepo installed then install it now with the command

    Code:
    su -c 'yum install createrepo'
    Step 3. Create the metadata.

    Run the following command to create the metadata.
    Code:
    su -c 'createrepo fedora64'
    This will be another fairly lengthy operation. When it has finished there will be 4 files in /fedora64/repodata, as described in the preceding link. The command completes without error, displaying the following output.

    Code:
    2766/2766 - hunspell-te-0.20050929-5.fc14.noarch.rpm                            
    Saving Primary metadata
    Saving file lists metadata
    Saving other metadata
    That should be all we need to do to set up the repository folder. It is now time to move on to creating the actual .repo file.

    Step 4. Create a repository file.

    Create an empty file in the folder /etc/yum.repos.d. I'm going to call my file fedora64.repo so I type
    Code:
    su -c 'vi /etc/yum.repos.d/fedora64.repo'
    In this file we need to add a minimum of 4 lines.
    Code:
    [fedora64]
    Name=Fedora $releasever $basearch local repository
    baseurl=file:///fedora64
    enabled=1
    Save the file and exit the editor.

    Step 5. Test the repository.

    Now it's time to test the new repository. Type
    Code:
    yum repolist
    The output on my computer.
    Code:
    repo id                                    repo name                                                     status
    adobe-linux-i386                           Adobe Systems Incorporated                                            18
    f14-dvd                                    Fedora 14 x86_64 networked DVD repository                       2,679+87
    fedora                                     Fedora 14 - x86_64                                            22,031+130
    fedora64                                   Fedora64                                                        2,679+87
    flash                                      flash                                                                1+3
    google-chrome                              google-chrome                                                          3
    google64                                   Google - x86_64                                                        4
    rpmfusion-free                             RPM Fusion for Fedora 14 - Free                                      411
    rpmfusion-free-updates                     RPM Fusion for Fedora 14 - Free - Updates                            131
    rpmfusion-nonfree                          RPM Fusion for Fedora 14 - Nonfree                                   181
    rpmfusion-nonfree-updates                  RPM Fusion for Fedora 14 - Nonfree - Updates                          45
    updates                                    Fedora 14 - x86_64 - Updates                                   4,180+122
    Hopefully, if we did everything right, there will be no errors and you will see your new repository listed amongst the normal Fedora repositories. Your new repository is now ready for use.

    This completes this section on how to create a local yum repository for the installation DVD rpm files.

  2. #2
    Join Date
    Mar 2004
    Location
    In your closet
    Posts
    16,567
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)

    Re: Create your own local yum repositories

    This how to was written with Fedora 14 in mind but should work equally as well with any earlier release.

    The Fedora repository files.

    This will essentially be a local copy of the "Fedora" repository that is part of a basic Fedora installation.

    Note: For all terminal commands I'll be using the su -c command. To use this command you will need to know the root password and use it when prompted.

    I'll also be using the vi text editor. Of course, feel free to substitute with the editor of choice.


    Step 1. Make a folder.

    Start by opening a terminal and deciding where to keep the rpm files. You can put them almost anywhere you want. For this example I've created a folder under / called fedora.

    Code:
    su -c 'mkdir /fedora'
    Step 2. Fetch the files.

    Now we need to get some rpm files to load up your new folder. For this task we will use reposync. For information on reposync hit this link or simply type man reposync.

    Reposync is part of the yum-utils package. If reposync is not installed on your system install it now with the command

    Code:
    su -c 'yum install yum-utils'
    We need to specify which repository we want reposync to fetch the files from and where we want it to put the files so we'll use the --repoid switch and the --download_path switch.

    Keep in mind that if you continue with this process you will be downloading more than 17,000 files. This will take some time. In some cases it will take several hours.

    Type
    Code:
    su -c 'reposync --repoid=fedora --download_path=/fedora'
    Go do something constructive and come back later.

    Step 3. Create the metadata.

    Now we need to create the metadata that yum will use for this repository. We will use createrepo. If you don't have createrepo installed on your system install it now by running the command
    Code:
    su -c 'yum install createrepo'
    Once the installation is complete run the following command to actually create the data.
    Code:
    su -c 'createrepo fedora'
    Again, due to the large number of files in this folder the operation will take considerable time to complete.

    Step 4. Create the .repo file.

    While createrepo is working you can open another terminal and create the actual .repo file. As an alternative to opening another terminal you can just open a tab in the existing terminal.

    Create an empty file in the folder /etc/yum.repos.d. I'm going to name my file fedora-local.repo.

    Code:
    su -c 'vi /etc/yum.repos.d/fedora-local.repo'
    In this file we need to add a minimum of 4 lines.

    Code:
    [fedora-local]
    Name=Fedora $releasever $basearch local repository
    baseurl=file:///fedora
    enabled=1
    Step 5. Test the repository.

    You need to make sure createrepo has finished before you can test your new repository. Once it has finished run the command

    Code:
    yum repolist
    Hopefully, if we did everything right, there will be no errors and you will see your new repository listed amongst the normal Fedora repositories. Your new repository is now ready for use.

    This completes this section on how to create a local "fedora" repository.

  3. #3
    Join Date
    Mar 2004
    Location
    In your closet
    Posts
    16,567
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)

    Re: Create your own local yum repositories

    I hope that these how-to's will be something that was helpful and worthwhile. Please, if you spot any typos, inaccuracies, or other errors, don't hesitate to let me know and I will make any necessary corrections.

  4. #4
    Join Date
    Dec 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Create your own local yum repositories

    Hi,

    Thanks for providing this useful information.

    I followed your steps and as well as from the link http://forums.fedoraforum.org/showthread.php?t=166284.

    For installing codecs (ugly,bad,mp3,vlc..) I used the above steps and have successfully created the local repo without errors.

    Now I can install the files from this local repo using for ex: " su -c yum install gstreamer-plugins-ugly"
    It is installing without errors!!

    However, when I open Add/Remove Software, it is not showing the packages from this local repo.
    This local repo is added in the Repo List and enabled (All other repos are disabled).
    Any idea, how to make Add/Remove software display the packages according to groups (Multimedia, Admin,Programming)?

  5. #5
    Join Date
    Mar 2004
    Location
    In your closet
    Posts
    16,567
    Mentioned
    19 Post(s)
    Tagged
    0 Thread(s)

    Re: Create your own local yum repositories

    I don't have any idea. Mine are there and I did nothing to make sure that they were included. Truth be told, I've never given it a thought until you mentioned it.



    Never mind. I misunderstood what you are asking.
    Attached Images Attached Images

Similar Threads

  1. Repositories
    By mh3rn4nd3z3 in forum Using Fedora
    Replies: 8
    Last Post: 13th June 2010, 11:23 PM
  2. Official repositories or the RPMforge repositories?
    By mrtaber in forum Using Fedora
    Replies: 1
    Last Post: 20th January 2005, 03:17 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •