Linux distributions use package management commands such as Apt-get, dpkg, RPM, Yum,emerge, and so on. In this paper, the Yum tool is researched and collated.
1. About Yum
1.1 What ' s Yum
- The Yum command is a RPM-based package manager in Fedora and Redhat as well as in SuSE.
- It allows system administrators to interactively and automatically manage RPM packages,
- The ability to automatically download RPM packages and install them from the specified server,
- Dependency relationships can be handled automatically and all dependent software packages are installed at once.
Basic directory of 1.2 yum
- Yum configuration file/etc/yum.conf, usually without modification
- Warehouse configuration file Directory/etc/yum.repos.d/
- Yum's Cache directory/var/cache/yum
- Yum log file/var/log/yum.log
2. What ' s repo2.1 repo file is a configuration file for Yum source
- Usually a repo file defines the details of one or more repositories, and the settings in the repo file will be read and applied by Yum!
How the 2.2 Yum works:
- Each RPM software's head (header) will record the dependencies of the software, then if you can record the contents of the header and analysis, you can know that each software before installation requires additional installation
- Server-side: All the RPM packages are stored on the server, and then the dependencies of each RPM file are analyzed with related functions, and the data is recorded in a specific directory on the server.
- Client: If you need to install a software, first download the server record of the dependency relationship file (can be www or FTP), through the server-side download record data analysis, and then get all the relevant software, all at once downloaded to install.
2.3 Repo File Configuration explained
is used to differentiate between different repository.
- name=some name for this server
It's a description of repository.
- baseurl=url://server1/path/to/repository/
where the URL supports the protocol has HTTP/ftp://file://three kinds
BaseURL can be followed by multiple URLs
You can add multiple options after the URL, such as Gpgcheck, Failovermethod
is available
2.4 Variables in the repo
- $releasever, Linux distributions, [5/6/7]
- $arch, CPU system, e.g. [I686,athlon]
- $basearch, basic System Group of CPUs, [i386/x86_64]
3, the installation of Yum source3.1 Local Yum build
Local Yum is a Linux system that uses the RPM software in the installed image Package 1, creating mount points
# Mkdir/yum
2. Optical drive Insert Mirror disk 3, Mount
# Mount/dev/cdrom/yum
4. Edit the Repo file
[local] name=auto yum baseurl=file:///yum enabled=1 gpgcheck=1 gpgkey= file:///yum/RPM-GPG-KEY-CentOS-6
3.2 FTP-based network Yum source
Service Side1, the service side installs the VSFTPD
# RPM-IVH vsftpd-2.2.2-11.el6_4.1.x86_64.rpm
# service VSFTPD start
# Chkconfig VSFTPD on
2, modify the FTP Access Directory settings FTP home directory for CD mount point
# Mount/dev/cdrom/yum
# usermod-d/yum ftp #修改ftp用户家目录为rpm包目录
Client1. Edit the client's repo file# Vim/etc/yum.repos.d/local.repo
[local]
name=auto yum
baseurl=ftp://x.x.x.x
enabled=1
gpgcheck=0
3.3 Epel Yum Source build 1. Introduction to Epel Source
- EPEL, extra Packages for Enterprise Linux
- This software warehouse has a lot of very common software, and is specifically designed for Rhel, the Rhel standard yum Source is a good supplement, completely free to use
- Maintained by the Fedora project, so if you are using Rhel, or centos,scientific and other Rhel-system Linux, you can use Epel's Yum source with great ease.
2. Open the Epel website
http://mirrors.kernel.org/fedora-epel/
Method 1:Install generate repo rpm, online generic, but error
Download the configuration repo rpm
Select the corresponding version of RPM
because I am redhat6.4, select the epel-release-latest-6.noarch.rpm of this page
Linux installation command:
# RPM-UVH http://mirrors.kernel.org/fedora-epel/epel-release-latest-6.noarch.rpm
# yumclean all
# yum Makecache
Error:cannot connect to Epel source
Loading Mirror speeds from cached hostfileError:cannot retrieve
Metalink for Repository:epel. Verify its path and try again
Workaround:
Method 2
Method 2:Edit a Epel repo file
1. Select Basedir
Select the appropriate system version on the Epel source website, and the CPU architecture, such as I am redhat6.4 64-bit http://mirrors.kernel.org/fedora-epel/6/x86_64/
2. Edit Epel.repo
# cat Epel.repo [Epel] name=epel BASEURL=HTTP://MIRRORS.KERNEL.ORG/FEDORA-EPEL/6 /x86_64/ enable=1 gpgcheck=0
3. View Yum Source
# yumclean all
# yum repolist
3.4 Domestic Yum Source: NetEase 163yum Source
# CD/ETC/YUM.REPOS.D
Method 1:Download repo file
# wget Http://mirrors.163.com/.help/CentOS6-Base-163.repo
# yumclean all
# yum Makecache
Error:
http://mirrors.163.com/centos/6Server/os/x86_64/repodata/repomd.xml: [Errno] Pycurl ERROR-"The requested UR L returned error:404 not Found "
Solution:
you can see the problem of resolving the address by error, we will replace the variable exponentially fixed value $releasever-----6$basearch x64_86 Replace, baseurl=http://mirrors.163.com/ centos/6/os/x86_64/
Method 2:Edit a repo file directly
# cat Centos163.repo
[base]
name=centos-6-base-163.com
Baseurl=http://mirrors.163.com/cen tos/6/os/x86_64/
enable=1
gpgcheck=1
gpgkey=http://mirror.centos.org/ Centos/rpm-gpg-key-centos-6
4. Yum syntax and commands
Syntax:
yum [options] [parameters]
Options:
-H: Display Help information;-Y: Answer "yes" to all questions;-c: Specify configuration file;-Q: Quiet mode;-V: verbose mode;-D: Sets debug level (0-10);-E: Sets the error level (0-10); R: Set the maximum wait time for Yum to process a command;-C: Run completely from the cache without downloading or updating any header files.
Parameters:
Install: Installing RPM packages; Update: updating RPM packages; Check-update: Check for available update RPM packages; Remove: Deletes the specified RPM package; list: Displays information about the package; Search: Check the package information; Info: Displays the description and profile of the specified RPM package; Clean: cleans up the yum expired cache; Shell: Enter the Yum shell prompt; RESOLVEDEP: Shows the dependencies of the RPM packages; Localinstall: Install the local RPM software package, Localupdate: Display the local RPM package for updates, Deplist: Displays all dependencies of the RPM package.
Common commands:Yum Plug-in installation
Yum Install yum-fastestmirror #自动搜索最快镜像插件
yum install Yumex
#安装yum图形 Window Plugins
Yum View
Yum list
#显示所有已经安装和可以安装的程序包
yum grouplist
#查 See List of possible bulk installations
Yum Installation
Yum Install package1
#安装指定的安装包package1
yum groupinsall group1
#安装程序组group1
Yum Update
Yum update package1
#更新指定程序包package1
Yum Removal
Yum Remove | erase package1 #删除程序包package1
Linux Software management Tools-yum