Yum package installation, use, configuration and practice
Source: Internet
Author: User
Yum package installation, use, configuration, and practice recently some software has been installed in Centos. due to limited Internet access time, therefore, we plan to use the two DVDs installed in Centos as the local source (these two DVDs contain almost all the packages we can use). However, this is not simple, I searched a lot of questions from the internet... yum package installation, use, configuration, and practice recently some software has been installed in Centos. due to limited Internet access time, therefore, we plan to use the two DVDs installed in Centos as the local source (these two DVDs contain almost all the packages we can use). However, this is not simple, I have searched many tutorials on the internet and I am not very clear about them, so I have the idea of systematically learning yum. Www.2cto.com yum (yellow dog manager) is a manager that provides rpm packages. yum can automatically resolve package dependencies and free us from complicated package management, currently, yum systems mainly include redhat, centos, Fedora, and so on. another package manager corresponding to yum is apt (mainly used by distribution versions such as ubuntu ). 1. what is the source? Simply put, the source is a collection of software packages. if we use windows to download software, we will go to skysky, the Pacific Ocean, ZOL, and other websites to find the software. then these websites can be seen as a software source. Linux management is more rigorous. Basically, we will list all the websites that we are looking for software (of course, all of them are secure websites), and then we will list almost all the software industries, when we download the files, we will download them based on these files, saving us the trouble of searching everywhere, and of course it is much safer. Www.2cto.com 2. the commonly used yum command 2.1 yum list [available | installed | extras | updates | obsoletes | all | recent] [pkgsspec] lists the software packages, these software packages can be installable, installed, attached, upgraded, obsolete, all, recent, and so on. $ Yum list installed $ yum list vim2.2 yum install/remove/update/search the command to install, uninstall, upgrade, and find the software package 2.3 yum makecache is useful, after we update the "source file", yum still uses the source file stored in the cache. Therefore, we need to update the source cache. generally, after the source changes, we need to execute this command. The command www.2cto.com 2.4yum info allows you to view the information of the software package. 3. change your source. after the system is installed, the default source of the system is official, however, the speed is not good (I feel CentOS is okay ). In this case, we can use the Chinese source to replace the official source. 3.1 Backup official Source $ mkdir/etc/yum. repos. d/bak $ mv/etc/yum. repos. d/*/etc/yum. repos. d/bak3.2 download the domestic source (163 of the source) $ cd/etc/yum. repos. d $ wget http://mirrors.163.com/.help/CentOS6-Base-163.repo $ Yum makecache # update the source cache to use the 163 Source. 4. create your own source yum. the source is only a folder with multiple active rpm packages, this folder also contains a required control information (such as dependencies between packages and file lists ). We can find these folders through ftp/http or directly using the file path. 4.1 collect the rpm packages you want to create the source and put the packages you have collected into a folder. This folder can have many subfolders, however, all files containing the rpm installation package should be in this folder. We will use this folder to create our source. Here we assume that all the rpm packages we have collected are placed under "/usr/local/repository. 4.2 make your own source 4.2.1 the basic command for creating the SOURCE yum works through the information summary in the rpm Package, which can be collected through the "createrepo" program. If your host is not installed, you can install it by using $ yum install createrepo. After the installation, we can execute: $ createrepo/usr/local/repository. after the execution, we will find that there are several more files, such as repodata, or more, at this time, our source is ready, but it cannot be used. 4.2.2. set the source's advanced option www.2cto.com (1) -- add this option to the database to generate. sqlite database, which is only available in the new version. if it is an old version of yum, the database file will be ignored and read. xml file (2) -- unique-md-filenames uses different names for all metadata files. This is especially useful when you use images and mirrors (3) -- changelog-limite limits record entry 1 to save download time. (4) -- update when we only update a small part of the rpm package, this option is often added to save time. 4.3 register your own source now our source is ready, but yum is not enough, because yum does not know where our source is, so we need to write a file to tell yum, where is our source. Yum mainly uses the file information in/etc/yum. conf and/etc/yum. repos. d/to access the source. /Etc/yum. conf is mainly responsible for the overall configuration of the source, and generally does not need to be modified. Configuration of each source is placed under/etc/yum. repos. d/, which is a violation of the repo end. The following is a "source file" format: [myrepo] # Source id. Note that there must be no space. Otherwise, the source name = repository's name # cannot be identified, baseusr = file:///usr/local/repository # Source location enabled = 1 # enable source gpgcheck = 1 # check gpgkeygpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CENTOS-6 # Save the above content as a file with the suffix "repo" at the position of gpgkey. Note that file can be directly accessed locally, followed by 3 "/" instead of two, while http and ftp are two. 5. in actual practice, the 5.1 Background and requirements for the Linux release version I use are CentOS (I like it very much and we recommend it to you). The reason for downloading images is that I have limited time to access the Internet, however, when surfing the Internet, the network speed is very fast, so we decided to download two huge DVDs. of course, if you only want to install it, you only need to install DVD1, but for the convenience of installing software in the future, I downloaded both DVDs, because DVD2 contains some of the software to be used. with these two DVDs, I basically do not need to install software online, this solves the problem that I cannot access the Internet. What I want to do here is also clear, that is, use the two DVDs downloaded as the local source to meet the needs of my daily software installation. 5.2 createrepo can be installed in two ways. One is that you cannot connect to the Internet after installation (I am the same, you have to go online to other places), and the other is that you can connect to the Internet. (1) If you can use the Internet, simply $ yum install createrepo. (2) If you cannot use the Internet, you can use the installed DVD, first, copy DVD1 to the file system. I copied it to/root (just installed, no other users have been created) and www.2cto.com $ mkdir/media/cdrom "to create a Mount directory, it is recommended that you do not change it, as will be mentioned later $ mount-tiso9660-oloop CentOS-6.3-i386-bin-DVD1.iso/media/cdrom "mount Image $ mkdir/etc/yum. repos. d/bak "create a backup folder $ mv/etc/yum. repos. d /*. repo/etc/yum. repos. d/bak "backup source $ cp/etc/yum. repos. d/bak/CentOS-Media.repo/etc/yum. repos. d/"retrieve the source to be modified, $ vi/et C/yum. repos. d/CentOS-Media.repo "edit the source we want to modify change" enabled = 0 "inside to" enable = 1 "$ yum makecache" update yum cache $ yum install createrepo "install package here createrepo is installed and can be used, in our modified CentOS-Media.repo, the baseusl path is the path we can talk about DVD1 mount, mount to other places to modify. As a matter of fact, we should also understand the general workflow of the source, because we have used our own source here, that is, using DVD1 as the source. Of course this is a little troublesome, because every time we need to mount a DVD, if the software we need is in DVD2 again, it will be even more troublesome, that's why I decided to add two DVDs to the production cost. 5.3 create your own source. next we will create our source. the software packages I want to use are the software packages in DVD1 and DVD2. These two software packages contain commonly used software packages, I have not downloaded any packages from the Internet since I set up the local source. that is to say, there are many packages for these two DVDs. this is enough for us to use, except for updates. I remember a total of more than 4700 packages. First, we need to copy the packages in the two DVDs to a file folder, that is, under the folder of the file source, I will create the source under/usr/local/repository. $ Mkdir/usr/local/repository "create the source folder $ cp-r/media/cdrom/Packages/usr/local/repository" copy the package file of DVD1 to the source folder $ umount/media/cdrom "detach DVD1 $ mount CentOS-6.3-i386-bin-DVD2.iso/media/cdrom" mount DVD2 $ cp-ur/media/cdrom/Packages // usr/local/repository "copy DVD2 $ createrepo/usr/local/repository, patience, estimated 3 to 5 minutes $ mv/etc/yum. repos. d/CentOS-Media.repo/etc/yum. repos. d/CentOS-Local.repo "modify the configuration file $ vi/etc/yum. repos. d/The CentOS-Local.repo is modified as follows: [CentOS-Local] name = LocalRepositorybaseusr = file:///usr/local/repository Gpgcheck = 1 enabled = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CENTOS-6 $ Yum makecache "update cache $ yum install vim-enhanced" install test package, here you can install the desired package $ umount/media/cdrom "uninstall DVD25.4 and add some new software packages www.2cto.com here, our local source has been configured, if you need a separate software package, you can download it to/usr/local/repository/Packages, then execute $ createrepo -- update so that it does not take a long time to wait for "createrepo. 6. here is the last story. Basically, the yum application is over, and I hope to help you. If you have any questions
To give me a message, although I may not be able to solve it, haha !!
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.