Three ways to create a local Yum source

Source: Internet
Author: User
Tags sqlite
======================================= Section 1: Method 1
1. Create a Dvdrom mount point (can be ignored)
Mkdir/mnt/dvdrom

2, mounted DVD ISO image
[Root@bz/]# ll/dev/dvd*
lrwxrwxrwx 1 Root 3 June 18:27/dev/dvd1-> Sr0
lrwxrwxrwx 1 Root 3 June 18:27/dev/dvdrw1-> Sr0
[Root@bz/]# Umount/mnt
[Root@bz/]# mount-t iso9660/dev/dvd1/mnt
Mount:block Device/dev/sr0 is write-protected, mounting read-only
[Root@bz/]# Umount/mnt
[Root@bz/]# mount-t iso9660/dev/sr0/mnt/=> installation disk is mounted to the local optical drive
[Root@bz/]# mount-o loop-t iso9660/stage/oel-6.5-x86_64-dvd.iso/mnt => only local ISO mirrors

3. Installation of Createrepo (two ways)
Cd/mnt/packages < view local discs--------specific path.
RPM-IVH createrepo-x.y.z.rpm <--------x.y.z vary according to the disc.

Install the following three packages
RPM-IVH deltarpm-*
RPM-IVH python-deltarpm-*
RPM-IVH createrepo-*

Take Oel6u5 as an example:
RPM-IVH deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
RPM-IVH python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
RPM-IVH createrepo-0.9.9-18.0.1.el6.noarch.rpm

4, create the installation source (this time the direct use of Mount point in the installation of the source)
3. Add Installation Source

Rm-rf/etc/yum.repos.d/base.repo
Cat >>/etc/yum.repos.d/base.repo << EOF
[Base_install]
Name=oracle
Baseurl=file:///mnt/server
Enabled=1
Gpgcheck=0
Eof

4, update the installation source

[Root@bz yum.repos.d]# Yum Clean all
Loaded Plugins:refresh-packagekit, security
Cleaning Repos:installmedia base_install public_ol6_uekr3_latest public_ol6_latest
Cleaning up Everything
[Root@bz yum.repos.d]# Yum Update
Loaded Plugins:refresh-packagekit, security
Base_install | 3.7 KB 00:00 ...
base_install/primary_db | 3.0 MB 00:00 ...
Http://public-yum.oracle.com/repo/OracleLinux/OL6/UEKR3/latest/x86_64/repodata/repomd.xml: [Errno] Pycurl ERROR 6-"couldn ' t resolve Host ' public-yum.oracle.com '"
Trying other mirror.
Error:cannot Retrieve repository metadata (Repomd.xml) for repository:public_ol6_uekr3_latest. Please verify its path and try again

When this error occurs, you can delete the OEL default public yum source file
[Root@bz yum.repos.d]# cd/etc/yum.repos.d/
[Root@bz yum.repos.d]# LL
Total 12
-rw-r--r--1 root June 18:48 Base.repo
-rw-r--r--1 root Nov 2013 Packagekit-media.repo
-rw-r--r--. 1 root 2545 May 12:40 Public-yum-ol6.repo
[Root@bz yum.repos.d]# MV Public-yum-ol6.repo public-yum-ol6.repo.20140622
[Root@bz yum.repos.d]# Yum Clean all
Loaded Plugins:refresh-packagekit, security
Cleaning Repos:installmedia Base_install
Cleaning up Everything
[Root@bz yum.repos.d]# Yum Update
Loaded Plugins:refresh-packagekit, security
Base_install | 3.7 KB 00:00 ...
base_install/primary_db | 3.0 MB 00:00 ...
Setting up Update Process
No Packages marked for Update
[Root@bz yum.repos.d]#

======================================= Section 2: Method 2
1, establish the following folder

[Root@bz/]$ Mkdir/mnt/dvd
[Root@bz/]$ Mkdir/mnt/dvd/repo/suse-p
[Root@bz/]$ Mkdir/mnt/dvd/repo/repodata

2, mounted DVD ISO image

[Root@bz/]# mount-t iso9660/dev/sr0/mnt/
Mount:block Device/dev/sr0 is write-protected, mounting read-only
[Root@bz/]$ Mount--bind/mnt/dvd/packages//mnt/dvd/repo/suse/

3, copy files to the specified directory

[Root@bz/]$ cp/mnt/dvd/repodata/repomd.xml/mnt/dvd/repo/repodata/-P

4. Create installation Source
[Root@bz/]$ cd/mnt/dvd/repo/
[ROOT@OCP repo]# Ls-l
Total 668
Drwxr-xr-x 2 root root 679936 Nov 2013 SuSE
Drwxr-xr-x 2 root root 4096 June 1 23:33 repodata
[ROOT@OCP repo]# createrepo-g repodata/repomd.xml.
Spawning worker 0 with 3754 pkgs
Workers finished
Gathering worker Results

Saving Primary Metadata
Saving file lists Metadata
Saving other metadata
Generating SQLite DBs
Sqlite DBs Complete
[ROOT@OCP repo]#

5. Add Installation Source

[ROOT@OCP repo]$ cd/etc/yum.repos.d/
[ROOT@OCP yum.repos.d]$ cat >>/etc/yum.repos.d/iso.repo <<eof
[Dvd-repo]
Name=dvd-repo
Baseurl=file:///mnt/dvd/repo
Enabled=1
Gpgcheck=0
Eof

6, update the installation source

[Root@bz/]$ Yum Clean all
Loaded Plugins:refresh-packagekit, security
Cleaning Repos:dvd-repo
Cleaning up Everything
[Root@bz/]$ Yum Update
Loaded Plugins:refresh-packagekit, security
Dvd-repo | 3.6 KB 00:00 ...
dvd-repo/primary_db | 3.5 MB 00:00 ...
Setting up Update Process
No Packages marked for Update

Setting up the update process
Do not upgrade any packages

It is important to note that when you take advantage of this installation source, you must remove other files from this directory.


======================================= Section 3: Only the operating system installation files of all RPM packages, do yum source
1, the installation of Createrepo (operating system has been registered and connected to the situation can be directly yum install createrepo-y)
cd/home/rpm
RPM-IVH deltarpm-*
RPM-IVH python-deltarpm-*
RPM-IVH createrepo-*

2, only the RPM package installation source
[root@rhel6.2 home]# createrepo/home/rpm
1399/3596-java-1.6.0-openjdk-devel-1.6.0.0-1.41.1.10.4.el6.x86_64.rpm
ISO-8859-1 encoding on Ville skytt<ville.skytta@iki.fi>-2.8.2-2

3596/3596-mod_wsgi-3.2-1.el6.x86_64.rpm
Saving Primary Metadata
Saving file lists Metadata
Saving other metadata
[root@rhel6.2 home]#

3. Add source configuration file in/ETC/YUM.REPOS.D
Cat >>/etc/yum.repos.d/rpm.repo <<eof
[Rpm-repo]
Name=rpm-repo
baseurl=file:///home/rpm/
Enabled=1
Gpgcheck=0
Eof

4, update the installation source
[root@rhel6.2 home]# Yum Clean all
Loaded Plugins:refresh-packagekit, security
Cleaning Repos:dvd-repo
Cleaning up Everything
[Root@oel6u5 yum.repos.d]# Yum Update
Loaded Plugins:refresh-packagekit, security
Dvd-repo | 3.0 KB 00:00 ...
dvd-repo/primary_db  | MB 00:00 ...
Setting up Update Process
No Packages marked for Update
[Root@oel6u5 yum.repos.d]#

It is important to note that when you take advantage of this installation source, you must remove other files from this directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.