CentOS6.5 use createrepo to build the local source
The rpm used to build local yum source all comes from CentOS-6.5-bin-DVD1 & DVD2;
I installed it in a virtual machine environment. Check the version of my operating system first:
[adam@ultraera~]$
uname
-m
i686
[adam@ultraera~]$
cat
/etc/centos-release
CentOSrelease6.5(Final)
3. Because the local yum source needs to be configured to modify the files in the/directory and the configuration files in the/etc directory, we recommend that you replace them with the root user; "su -"
4. First, create a local directory to store the rpm package. Here I will create it directly under/. You can customize it:
[root@ultraera~]
#mkdir/yumload
[root@ultraera~]
#cd/yumload/
[root@ultraerayumload]
#pwd
/yumload
5. Next, copy all the rpm Packages in the two DVDs to/yumload:
[root@ultraerayumload]
#cp/media/CentOS_6.5_Final/Packages/*./
[root@ultraerayumload]
# Ll./*. rpm | wc-l # Total number of rpm packages of the two dvds;
4802
6. then use the createrepo command to create a local repo. By default, createrepo is not installed in CentOS6. You need to install it manually. It doesn't matter. We have integrated the createrepo package in our DVD, if you need to install other packages, install them one by one.
[root@ultraerayumload]
# Rpm-ivhcreaterepo-0.9.9-18.el6.noarch.rpm # Install createrepo
[root@ultraerayumload]
# Createrepo/yumload/# create a yum repository and wait patiently. You can add the-v parameter to list the execution information.
Spawningworker0with4802pkgs
WorkersFinished
Gatheringworkerresults
SavingPrimarymetadata
Saving
file
listsmetadata
Savingothermetadata
GeneratingsqliteDBs
SqliteDBscomplete
[root@ultraerayumload]
#
7. Create a repo file under/etc/yum. repo. d/. The file name can be customized, but it must end with repo and add the following content:
[ultraera.org]
# The repository name can be customized.
name=Thisisa
local
repo
# Description
baseurl=
file
:
///yumload/
# Enter the repository url here. Note that there are three forward slashes.
enabled=1
# Whether to enable the repository; 1: Enable; 0: Disable
gpgcheck=0
# Check whether gpgkey is enabled; 1 is enabled; 0 is disabled
8. If you want to add the group information of the software package, you can use the *-comps. xml file in the repodata file in DVD1 to load the local repository with ceraterepo-g. The Code is as follows:
[root@ultraerarepodata]
# Createrepo-g [character may be different, the suffix is correct on the line] c6-i386-comps.xml/yumload/
9. Now the local yum source has been set up. Next, reinitialize the yum cache:
[root@ultraerarepodata]
#yumcleanall
Loadedplugins:fastestmirror,refresh-packagekit,security
Cleaningrepos:ultraera.org
CleaningupEverything
Cleaninguplistoffastestmirrors
[root@ultraerarepodata]
#yummakecache
Loadedplugins:fastestmirror,refresh-packagekit,security
Determiningfastestmirrors
ultraera.org|2.9kB00:00...
ultraera.org
/filelists_db
|4.9MB00:00...
ultraera.org
/primary_db
|3.5MB00:00...
ultraera.org
/other_db
|2.1MB00:00...
MetadataCacheCreated
10. to test whether the group information is correctly added, use the following code. If the output information is correct, the group information is successfully added.
[root@ultraera~]
#yumgrouplist