CentOS6.5 installation and configuration of Yum commands

Source: Internet
Author: User
Tags gpg mkdir string find centos


I. INTRODUCTION

Sometimes to facilitate the download of the package, the network speed is not fast, so use to build a local yum. The advantage is the ability to quickly install the required packages and tools, but the disadvantage is that it cannot be updated online. There are two methods

II. Installation and configuration (Method 1)

1. Download the image file. If yes, skip this step.

Cd/usr/local/src # enter the Directory
Wget http://mirrors.163.com/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso # Download image files
2. Attach an image

Mkdir-p/usr/local/yum/# Create The yum Directory
Mount-o loop/usr/local/src/CentOS-6.5-x86_64-bin-DVD1.iso/usr/local/yum/# mount the image file to the yum Directory
3. Create a repo file

Cd/etc/yum. repos. d/# enter the repo file directory
Mkdir backup # create the bakcup Directory
Mv *. repo backup # Move the default source to the Directory
Vim local. repo # Create a local source file.
Write the following content

[Looking_s] # [Database name]
Name = This ia local repo # [name description]
Baseurl = file: // usr/local/yum # [yum source directory, source address]
Enabled = 1 # [whether to enable this yum source, 0 is disabled]
Gpgcheck = 1 # [check the GPG-KEY, 0 is not checked, 1 is checked]
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 # [key file]
4. Test

Yum clean all # yum clear all
Yum makecache # yum generated cache
Yum list # yum list
If no error message is displayed, the installation and configuration are successful.

III. Installation and configuration (Method 2)

1. Download the image file. If yes, skip this step.

Cd/usr/local/src # enter the Directory
Wget http://mirrors.163.com/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso # Download image files
2. Configuration

Yum install createrepo-y # install the createrepo tool
Mkdir-p/usr/local/yum/# Create a directory
Mkdir-p/usr/local/yum1/# Create a directory
Mount-o loop/usr/local/src/CentOS-6.5-x86_64-bin-DVD1.iso/usr/local/yum/# mount the image
Cp-rv/usr/local/yum/Packages/*/usr/local/yum1/# copy the file to the Directory
Createrepo-v/usr/local/yum1/# generate an index
Cp/usr/local/yum/repodata/*. comp/usr/local/yum1/comps. xml # Copy the configuration file
Createrepo-g/usr/local/yum1/comps. xml/usr/local/yun # create group information
3. Create a repo file

Cd/etc/yum. repos. d/
Mkdir backup
Mv *. repo backup
Vim local. repo
Write the following content

[Looking_s]
Name = This ia local repo
Baseurl = file: // usr/local/yum1
Enabled = 1
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
4. Test

Yum clean all
Yum makecache
Yum list
If no error message is displayed, the installation and configuration are successful.

4. Introduction to tools

1. yum tool introduction

1 installation
Install yum install all
Yum install package1 install the specified installation package1
Yum groupinsall group1 installer group group1

2. Update and upgrade
Yum update all updates
Yum update package1 update specified package1 package1
Yum check-update check updatable programs
Yum upgrade package1 upgrade specified package1 package1
Yum groupupdate group1 upgrade program group group1

3 search and display
Yum info package1: package1
Yum list displays all installed and installable packages
Yum list package1 displays package1 installation of the specified package
Yum groupinfo group1 display group1 information of the program group yum search string find the installation package based on the keyword string

4. Delete a program
Yum remove & #124; erase package1 delete package1
Yum groupremove group1 delete group1
Yum deplist package1 check package1 dependencies

5. Clear cache
Yum clean packages clear software packages in the cache Directory
Yum clean headers clear headers in the cache Directory
Yum clean oldheaders clear old headers in the cache Directory
Yum clean, yum clean all (= yum clean packages; yum clean oldheaders) clear the packages and old headers in the cache 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.