Yum configuration (source configuration-optical drive, FTP server; basic usage)

Source: Internet
Author: User

Use the optical drive as the source

To avoid problems such as incomplete software packages, slow downloading speeds, and network faults that may occur when downloading software packages from the network, we strongly recommend that you use a local DVD/cd iso to create a yum repository, in this way, the installation speed is fast, and all software packages can be installed smoothly.

If you have a yum repository in the LAN, you can use it directly without repeating the steps below.

The following operations are performed after you have installed the RHEL/centos system.

First install the createrepo tool from the CD or an existing Yum Repository:

Shell command:

# Rpm-IVH createrepo-x.y.z.rpm

The createrepo command is used to generate some information required by the yum repository, which is stored under the repodata/directory. You can open it and see what it has done.

Use an ISO file to create a yum Repository

DVD ISO

If you are using a DVD disc, you can mount the disc directly and create a yum Repository:

Shell command:

# Mkdir/mnt/DVD/

# Mount/dev/CDROM/mnt/DVD/

# Cd/mnt

# Createrepo.

If you are using the official dvd iso, copy it to the system and mount it to create a yum Repository:

Shell command:

# Mkdir/mnt/DVD/

# Mount-o loop/root/rhel5.1-DVD. ISO/mnt/DVD

# Cd/mnt

# Createrepo.

CD ISO

If you are using multiple cd iso files, you must first copy them to the system, mount them, and create a yum repository.

Create several directories with several ISO files and mount the corresponding ISO files:

Shell command:

# Mkdir-P/mnt/{1, 2, 4, 5, 6}

# Mount-o loop rhel5.1-disc1.iso/mnt/1

# Mount-o loop rhel5.1-disc2.iso/mnt/2

# Mount-o loop rhel5.1-disc3.iso/mnt/3

# Mount-o loop rhel5.1-disc4.iso/mnt/4

# Mount-o loop rhel5.1-disc5.iso/mnt/5

Create a yum Repository:

Shell command:

# Cd/mnt/

# Createrepo.

Define Yum Repository

Create a definition file for the yum Repository:/etc/yum. Repos. d/dvdiso. Repo and add the following content:

Shell command:

[Dvdiso]

Name = DVD ISO

Baseurl = file: // MNT/

Enabled = 1

Gpgcheck = 0

Test Yum Repository

We strongly recommend that you run the 'yum clean all' command to clear all information such as Yum metadata and obtain the latest repository information again:

Shell command:

# Yum clean all

# Yum list

If you can see the name of the software package in the repository you just created in the output of the 'yum list' command, it is OK. Try to install a software package to check whether it is successful:

Shell command:

# Yum install cyrus-sasl.i386

For the x86_64 platform, change i386 to x86_64:

Shell command:

# Yum install cyrus-sasl.x86_64

If the installation is successful, the yum repository and RPM package are correct.

 

Use an FTP server as the source

I. Preparations

1. Start RedHat Linux and put it on the installation CD.
2. Mount the optical drive Mount/dev/CDROM/mnt
3. Install the FTP service

CD/mnt/Server
Rpm-IVH vsftpd *
Chkconfig vsftpd on
Service vsftpd start

4. Install the createrepo Software Package

Rpm-IVH createrepo *

5. copy the files from the system disk to the system.

CP-r/mnt/Server/var/FTP/pub

 

Ii. Build yum

1. generate dependency

Createrepo-g/var/FTP/pub/Server/repodata/comps-rhel5-server-core. xml/var/FTP/pub/Server/

Pay attention to this place. comps-rhel5-server-core. xml must not be manually generated. The default installation CD already has
2. After completing the preceding steps, an error message is displayed. "cocould not remove old metadata dir:. olddata" indicates that the directory is faulty. Delete the directory.

Rm-RF/var/FTP/pub/Server/. olddata

3. Perform Step 1 again.

Createrepo-g/var/FTP/pub/Server/repodata/comps-rhel5-server-core. xml/var/FTP/pub/Server/

4. Create a repository file
Create a new warehouse file. The name can be set as needed.

CD/etc/yum. Repos. d
Vim yum. Repo

Write the following content in the file:

[Base]
Name = base
#192. 168. 0. 6 is your yum Source Address
Baseurl = ftp: // 192. 168. 0. 6/pub/Server
# Enable source?
Enabled = 1
# Verify or not.
Gpgcheck = 1
# Verification key. Optional
Gpgkey = file: // etc/pki/rpm-GPG-key-RedHat-release


After the above steps, the yum source is set up. Of course. you can provide your source to others. you only need to copy your repo file to/etc/yum. repos. d/bottom. or you can manually copy it. If you want to create another warehouse, such as VT, cluster, and clusterstorage, repeat the preceding steps and modify the warehouse file. It is much easier to install the software package after yum is installed. You do not need to consider the dependency relationship.

Yum usage

Yum install software name/** // * download and install the corresponding software package */
Yum Info software name/** // * view the software package details */
Yum list | grep kernel/** // * Find the kernel package */
Yum Update Firefox/** // * Update Firefox */
Yum remove bmp-mp3/*** // remove bmp-mp3 */
Man Yum/** // * view the yum command details */

The configuration path of the yum file is/etc/yum. conf #0 indicates that the downloaded file is not saved; 1 indicates that the downloaded file is saved. keepcache = 0 # specifies the path to save the downloaded file by default, the file is saved in the/packages/directory cachedir =/var/Cache/yum

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.