Yum Source Server
The Yum client is written in Python using SQLite storage
Yum's key is to have a reliable repository, as the name implies, this is the repository of software, it can be an HTTP or FTP site, it can also be a local software pool, but must contain RPM Header,header includes various information of RPM package, including description, function, Provide files, dependencies, etc. it is by collecting these headers and analyzing them that the remaining tasks can be completed automatically.
When executing the yum Update command, this step is that Yum downloads the RPM header from the server's header directory and places it in the local cache.
Set up local, remote (Ftp,http can)
First set up the VSFTP server
RPM-IVH createrepo-xxx.rpm
createrepo/var/ftp/pub/#生成数据库
/ETC/INIT.D/VSFTPD Start #启动ftp服务
baseurl=ftp://192.168.1.88 (IP address of yumserver)/pub/
Installing a single service is ready, let's fix the problem of installing the package
Modified files:/usr/lib/python2.4/sit-pachages/yum/yumrepo.py #第441行vi +441/usr/lib/python2.4/sit-pachages/yum/yumrepo.py #敲命令将 remote= URL + '/' +relative modified to remote= "/var/ftp/pub/server" + '/' +relative
HTTP is similar to FTP, except that the path is different and the protocol is different. The HTTP method is to put the source file into the HTML directory
Yum Client
Yum configuration generally has two ways, one is to configure the yum.conf file in the/etc directory directly, and the other is to add the. repo file under the/ETC/YUM.REPOS.D directory.
[Email protected] ~]# cat/etc/yum.conf
[Main]
Cachedir=/var/cache/yum #yum下载的RPM包的缓存目录
Keepcache=0 #缓存是否保存, 1 save, 0 not saved.
debuglevel=2 #调试级别 (0-10), default is 2 (specific debug level of application, I do not understand).
Logfile=/var/log/yum.log #yum的日志文件所在的位置
Exactarch=1 #在更新的时候 whether to allow updating different versions of RPM packages, such as whether to update i686 RPM packages on i386.
Obsoletes=1 #这是一个update的参数, please refer to Yum (8), which is simply equivalent to upgrade, allowing the updating of stale RPM packages.
Gpgcheck=1 #是否检查GPG (GNU Private Guard), a key-mode signature.
Plugins=1 #是否允许使用插件, the default is 0 is not allowed, but we generally use yum-fastestmirror this plugin.
Installonly_limit=3 #允许保留多少个内核包.
exclude=selinux* #屏蔽不想更新的RPM包, wildcards can be used, separated by a space between multiple RPM packages.
[Email protected] ~]# Cat/etc/yum.repos.d/centos-base.repo
[fedora] #方括号里面的是软件源的名称, will be acquired and recognized by Yum
Name= Fedora $releasever-$basearch #这里也定义了软件 the name of the warehouse, usually for the convenience of reading the configuration file, generally does not work, $releasever variables define the distribution, usually 8,9,10 and other numbers, $basearch variables define the architecture of the system, which can be i386, x86_64, PPC equivalents, which have different values depending on the current version of the system, which makes it easy for Yum to choose a package that fits the current system when it is upgraded to the same ... The
failovermethod=priority #failovermethod has two values to choose from, and priority is the default value, which indicates that the mirror server address is selected from the listed BaseURL. Roundrobin indicates that the
exclude=compiz* *compiz* fusion-icon* #exclude这个选项是后来我自己加上去的 is randomly selected in the listed servers to prohibit the installation and updating of some packages in this repository. Wildcard characters can be used, separated by spaces, and you can add
#baseurl =http://download.fedoraproject.org/pub/fedora/linux/releases/as appropriate $releasever /everything/$basearch/os/
#上面的一行baseurl第一个字符是 ' # ' means that the line has been commented and will not be read, which means specifying a baseurl (the mirror server address of the source)
# mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever &arch= $basearch
# The above line is to specify a mirror server address list, usually open, in this case add the comment symbol is disabled, we can try to replace $releasever and $basearch with their corresponding version and schema, such as 10 and i386, opened in the browser, We'll be able to see a long list of mirror server address lists available.
Http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/10/09/2203916.html
YUM (Yellow dog Updater, Modified) is a front-end package manager for multiple Linux distributions, such as Redhat RHEL, CentOS & Fedora. Yum makes it easier for users to install, upgrade, uninstall, and other software package management operations by invoking RPM's package information.
This tutorial is for all Linux distributions using the Yum management package, including CentOS, RHEL or Fedora.
How do I upgrade all RPM packages using the Yum command?
Yum Update
How to upgrade a single RPM package using the Yum command
Yum Update software name
Installing the RPM package with Yum
Yum Install software name
How to exclude individual software when using Yum to upgrade all software, if you want to upgrade all packages, but do not want to upgrade the kernel, you can use the following command:
Yum--exclude=package kernel* Update
How to use Yum to determine if a software needs to be upgraded, the following command detects if all software on the Fedora/centos/rhel needs to be upgraded
Check-update
Uninstalling software with Yum
Yum Remove software name or yum Erase software name
Use Yum to view package-related information
The Yum list allows you to obtain information about the package, followed by not specifying the package name, which lists all the package information. Yum List software name
Use Yum to understand the main features of the software
For example, you want to know what httpd this software is for, you can enter the following command: Yum provides httpd
Find Packages using Yum
This command is useful if you don't know the full name of a package, and it searches the RPM package database for matching packages based on the keywords you provide. For example, I want to find the full name of samba software, I just need to enter the following command: Yum Search Samba
Use Yum to view basic information about a package
Yum Info Samba
How to clear Yum cache and download package files
For each package installed, yum downloads one RPM package before installing it and does not delete it automatically after installation. For a long time, these files occupy a lot of space. Therefore, regular cleanup is required: Yum clean all
How to install local RPM packages with Yum
If you want to create an RPM package yourself, you can use Yum to determine what dependencies exist: Yum Localinstall software name. rpm
upgrading local RPM packages with Yum
If you want to upgrade a local RPM software package, you can use the following command: Yum localupdate update-package.rpm
Determine which components the RPM package depends on
If you want to install your own source code, it is necessary to know which software packages you have installed on your computer. Deplist lets you know which components a package depends on, and what the full name of those components is. Yum deplist software Name
View version information for Yum
Yum-v
Install packages to chroot environment (chroot) using Yum
You can use the following command to install the software to Chroot:yum--installroot=/path/to/chroot/
To enable a software source that already exists using Yum
If you install a third-party software source, you need to enable the software source before you can install the software from it, enter the following command to enable the Epel software Source: Yum--enablerepo=epel install Rsnapshot
Disabling a software source using Yum
If you installed a third-party software source but do not want to install the software from it, you can disable it with the following command: Yum--disablerepo=epel install software name
Yum Software Collection
The Yum Software collection refers to a number of co-collaborative software collectively known as "Development tools" (development tools). Here's how to use the Yum groupinstall command to view/install/uninstall the Yum Software collection
Installing the Yum Software Collection
Yum Groupinstall ' Development Tools '
Uninstalling the Yum Software collection
Yum Groupremove ' Development Tools '
Upgrading the Yum Software collection
Yum groupupdate ' Development Tools '
View Yum Software collection information
Yum GroupInfo ' Development Tools '
See what software collections are available
Yum Grouplist | More
Use Yum to output a list of installed packages
This command applies to all Linux versions using Yum as software Manager, such as CentOS, Fedora, Rhel:yum list installed
Yum stores the downloaded packages and headers in the cache without deleting them automatically. If we feel that they are taking up disk space, you can use the Yum Clean command to clear it, and more precisely use Yum clean headers to clear Header,yum clean packages to clear the downloaded RPM package.
Yum clean, yum clean all (= Yum clean packages; yum clean oldheaders)
Fastestmirror configuration file: (generally do not move)
/etc/yum/pluginconf.d/fastestmirror.conf
The speed test log file for your yum Image:
/var/cache/yum/timedhosts.txt
Problem:
[[[email protected] user]# yum
File "/usr/bin/yum", line "
except Keyboardinterrupt, E:
Reason:
This is because Yum uses Python as the command interpreter, which can be found #!/usr/bin/python the first line in the/usr/bin/yum file. Compatibility between Python versions is not very good, making 2. There is a syntax inconsistency between version X and version 3.0. The CentOS 5 comes with Yum with python2.4, and when the system upgrades Python to 2.6 or 3.0, a syntax explanation error occurs.
Workaround:
Very simple, one is to upgrade Yum, one is to modify the Yum interpreter for the old version of python2.4 (if you do not use overwrite upgrade)
Upgrade Yum is not detailed;
Modify the Yum interpreter for the old version python2.4:
Vi/usr/bin/yum
Change the first line "#!/usr/bin/python" to "#!/usr/bin/ python2.4 "can be
when Yum, note: Existing lock/var/run/yum.pid:another copy is running if present. Aborting. Error,
to run: rm-f/var/run/yum.pid delete the file!
Yum Existing Lock Error Resolution
If the system starts, Yum appears Existing Lock/var/run/yum.pid:another copy is running as PID 3380. Aborting. The
can be resolved in the following way:
You can/etc/init.d/yum-updatesd stop
or rm-f/var/run/yum.pid
The main reason is that Yum is automatically updated just turn it off.
[Email protected] ~]# Cd/var/cache/yum/x86_64/6/;ls
/etc/yum.repos.d/the source below is enabled, the directory will not be associated with the cache directory.
Yum is based on these RPM headers stored here to detect whether the software (RPM package) installed in the system is the latest version and requires no update.
If we feel that they are taking up disk space, you can use the Yum Clean command to clear it, and more precisely use Yum clean headers to clear Header,yum clean packages clear the downloaded RPM package, yum-All peremptorily
How do I build my own local installation source?
1. Copy all RPM packages to a directory, which is placed under/mnt/local/
2, install Createrepo package,
RPM-IVH Createrepo-0.9.8-4.el6.noarch
3, createrepo-v/mnt/local #-v designation
Then create the Yum warehouse configuration file in/etc/yum.repos.d/, and note that you want to end with. Repo
Example:
#vi Local.repo
[Base] #yum仓库的描述
Name=local #仓库名字, any, here just for the convenience of my own view
baseurl=file:///mnt/local/#rpm包的路径, the installation source that Yum points to
Gpgcheck=0 #不检测
Set it up for later execution.
#yum Clean All
Of course, I can also use Redhat system image to do yum source, the method is similar to the above
Mount the image file to a directory, for example
Mount-o loop-t iso9660 rhel6.iso/mnt/iso/
At this point the Local.repo file is added
[Server]
Name=rhel
baseurl=file:///mnt/iso/
Gpgcheck=0
#yum Clean All
[Email protected] yum]# Rpm-qa gpg-pubkey*
Gpg-pubkey-c105b9de-4e0fd3a3
[Email protected] yum]# Rpm-qi GPG-PUBKEY-C105B9DE-4E0FD3A3
[[email protected] yum]# rpm-e GPG-PUBKEY-C105B9DE-4E0FD3A3 Delete key
Command Manual
[email protected] ~]# Yum list installed|wc-l
276
[Email protected] ~]# rpm-qa|wc-l
220
[email protected] ~]# Yum Search varnish
[email protected] ~]# Yum Search all varnish
[email protected] ~]# Yum provides varnish
[email protected] ~]# Yum list varnish
[email protected] ~]# Yum install varnish
[email protected] ~]# Yum info varnish
[email protected] ~]# Yum Localinstall varnish.rpm
[email protected] ~]# Yum deplist httpd
[Email protected] ~]# cat/etc/yum.conf
[Email protected] ~]# Cat/etc/yum.repos.d/centos-base.repo
Yum Clean All
Yum Makecache
rm-rf/var/cache/yum/*
Install the fastest mirror plug-in
Yum Install Yum-fastestmirror
[Email protected] log]# Rpm-qa|grep Yum
Yum-plugin-fastestmirror-1.1.30-14.el6.noarch
Yum-metadata-parser-1.1.2-16.el6.x86_64
Yum-3.2.29-40.el6.centos.noarch
[Email protected] log]# RPM-QL yum-plugin-fastestmirror
/etc/yum/pluginconf.d/fastestmirror.conf
/usr/lib/yum-plugins/fastestmirror.py
/usr/lib/yum-plugins/fastestmirror.pyc
/usr/lib/yum-plugins/fastestmirror.pyo
/usr/share/doc/yum-plugin-fastestmirror-1.1.30
/usr/share/doc/yum-plugin-fastestmirror-1.1.30/copying
[Email protected] log]# RPM-QL Yum-metadata-parser
/usr/lib64/python2.6/site-packages/_sqlitecache.so
/usr/lib64/python2.6/site-packages/sqlitecachec.py
/usr/lib64/python2.6/site-packages/sqlitecachec.pyc
/usr/lib64/python2.6/site-packages/sqlitecachec.pyo
/usr/lib64/python2.6/site-packages/yum_metadata_parser-1.1.2-py2.6.egg-info
/usr/share/doc/yum-metadata-parser-1.1.2
/usr/share/doc/yum-metadata-parser-1.1.2/authors
/usr/share/doc/yum-metadata-parser-1.1.2/changelog
/usr/share/doc/yum-metadata-parser-1.1.2/readme
[Email protected]/]# cd/var/cache/yum/
[Email protected]/]# cd/var/lib/yum/