Home  >  Article  >  php教程  >  Detailed explanation of linux yum command

Detailed explanation of linux yum command

高洛峰
高洛峰Original
2016-12-13 10:33:101075browse

yum (full name Yellow dog Updater, Modified) is a Shell front-end package manager in Fedora, RedHat and SUSE. Based on RPM package management, it can automatically download and install RPM packages from designated servers, automatically handle dependencies, and install all dependent software packages at once, without the need to download and install them again and again. yum provides commands to find, install, and delete a certain, a group, or even all software packages, and the commands are concise and easy to remember.

The command form of yum is generally as follows: yum [options] [command] [package...]
The [options] are optional, and the options include -h (help), -y (select when prompted during the installation process All are "yes"), -q (do not display the installation process), etc. [command] is the operation to be performed, and [package...] is the object of the operation.

A summary of some commonly used commands include:

Automatically search for the fastest mirror plug-in: yum install yum-fastestmirror
Install yum graphics window plug-in: yum install yumex
View the list of possible batch installations: yum grouplist

1 Install
yum install All installation
yum install package1 Install the specified installation package package1
yum groupinsall group1 Installation program group group1

2 Update and upgrade
yum update All update
yum update package1 Update the specified package package1
yum check-update Check the updateable ones Program
yum upgrade package1 Upgrade the specified package package1
yum groupupdate group1 Upgrade the program group group1

3 Find and display
yum info package1 Display the installation package information package1
yum list Display all installed and installable packages
yum list package1 Display the installation status of the specified package package1
yum groupinfo group1 Display the information of program group group1 yum search string Search the installation package according to the keyword string

4 Delete the program
yum remove | erase package1 Delete the package package1
yum groupremove group1 Delete the program Group group1
yum deplist package1 Check the dependencies of program package1

5 Clear the cache
yum clean packages Clear the software packages in the cache directory
yum clean headers Clear the headers in the cache directory
yum clean oldheaders Clear the old headers in the cache directory
yum clean, yum clean all (= yum clean packages; yum clean oldheaders) Clear the software packages and old headers in the cache directory

For example, to install the game program group, first search:
#: yum grouplist
You can find it, you can The name of the installed game package is "Games and Entertainment", so you can install it:
#: yum groupinstall "Games and Entertainment"
All game packages will be installed automatically. Here, the name of Games and Entertainment must be selected with double quotes, because Linux will consider the file name to end when encountering a space, so the system must be told that the name of the installed package is "Games and Entertainment" instead of "Games".

In addition, you can also modify the configuration file /etc/yum.conf to select the installation source. You can see how convenient it is to configure the program with yum. For more detailed options and commands, of course, just follow the command prompt: man yum

yum groupinstall "KDE (K Desktop Environment)"

yum install pirut k3b mikmod

yum groupinstall "Server Configuration Tools"

yum groupinstall "Sound and Video"

#yum groupinstall "GNOME Desktop Environment"

yum groupinstall "Legacy Software Support"

yum groupinstall "Development Libraries"

yum groupinstall "Development Tools"

#yum groupinstall "Windows File Server"

yum groupinstall "System Tools"

yum groupinstall "X Window System"

yum install php-gd
yum install gd-devel
yum groupinstall "Chinese Support"


#yum install samba-common //This execution Will install samba-client
#yum install samba

yum install gcc
yum install cpp
yum install gcc-c++
yum install ncurses
yum install ncurses-devel
yum install gd-devel php-gd
yum install gd- devel
yum install gcc
yum install cpp
yum install gcc-c++
yum install ncurses
yum install ncurses-devel
yum install gd-devel php-gd
yum install gd-devel
yum install zlib-devel
yum install freetype -devel freetype-demos freetype-utils
yum install libpng-devel libpng10 libpng10-devel
yum install libjpeg-devel
yum install ImageMagick
yum install php-gd
yum install flex
yum install ImageMagick-devel


#yum install System-config-bind
#yum Groupinstall "dns name server" // Install bind and bind-chroot kit
yum groupinstall "mysql database" '

yum clean all

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- ----------------------------------------

It is very difficult to not be able to input in Chinese after installing fedora linux. I can’t even search for solutions. I can only try my luck with a few pinyin to see if Google can recognize it. And this is what happened to me.
Solution:
yum install scim* -y

yum Command details:
The software installation command for Redhat and Fedora is rpm, but the biggest trouble with using rpm to install software is that you need to manually find a series of dependencies required to install the software. , not to mention super troublesome, if the software needs to be uninstalled when it is no longer needed, it is very annoying that other software cannot be used because a certain dependency is uninstalled. Happily, Fedora finally launched the yum command, which is similar to apt in ubuntu, making Fedora software installation simple and easy. Yum has the following features:
*Can configure multiple repositories at the same time
*Concise configuration file (/etc/yum.conf)
*Automatically solve dependency problems encountered when adding or deleting rpm packages
*Use Convenient to
* maintain consistency with the RPM database
yum is the abbreviation of Yellow dog Updater Modified. It was originally developed by Terra Soft, the developer of the yellow dog distribution, and was written in python. At that time, it was also called yup (yellow dog updater ), which was later improved by the Linux@Duke development team at Duke University, hence the name. The purpose of yum is to automatically upgrade, install/remove rpm packages, collect information about rpm packages, check dependencies and automatically prompt users to solve them. The key to yum is to have a reliable repository. As the name suggests, this is a software warehouse. It can be an http or ftp site, or a local software pool, but it must contain the rpm header. The header includes various rpm packages. Information, including description, function, provided files, dependencies, etc. It is by collecting these headers and analyzing them that the remaining tasks can be automated.
1. All configuration information of yum is stored in a configuration file called yum.conf, usually located in the /etc directory. This is the top priority of the entire yum system. I checked this file in F9. Let’s take a look:
[hanlong@localhost F9 common documents]$ sudo more /etc/yum.conf
[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var /log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
metadata_expire=1800
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos. d

The following is a brief explanation of this file:
cachedir: the directory cached by yum, where yum stores downloaded rpm packages and databases, usually /var/cache/yum.
debuglevel: debugging level, 0──10, the default is 2
logfile: yum log file, the default is /var/log/yum.log.
exactarch, there are two options 1 and 0, which represent whether to only upgrade the package with the same CPU system as the package you installed. If set to 1, if you install an i386 rpm, yum will not use the 686 package. upgrade.
gpgchkeck= There are two options, 1 and 0, which respectively represent whether to perform gpg check. If there is no such item, it seems to be checked by default.
2. Okay, the next step is to use yum. First use yum to upgrade the software. Most operations of yum require super user permissions. Of course, you can use sudo.
yum update, this step is necessary. yum will download the rpm header from the server's header directory and put it in the local cache. This may take a certain amount of time, but it brings us more convenience than yum. What does the expense count? After the header is downloaded, yum will determine whether there is an updateable software package. If so, it will ask for your opinion on whether to update it. Let's say y. It is always good to keep the system up to date. At this time, yum starts to download the software. Package and use rpm to install. This may take some time, depending on the number of software to be updated and the network conditions. If the network is disconnected, it doesn't matter, just do it again. After the upgrade is completed, you only need to use yum check-update every day to check whether there is any update. If so, use yum update to keep the system up to date and plug any discovered loopholes. Use yum update packagename to upgrade a single package.
Now let’s simply list some commands for yum software upgrade:
(Update: When I installed wine, I used rpm to install it one by one. I installed it first, and then installed the main package of wine. But just now on the forum I found a good post about the local installation of yum. The parameter is -localinstall
$yum localinstall wine-*
In this case, yum will automatically install all the dependencies instead of installing them one by one through rpm, which saves a lot of work. .
There is another parameter similar to him:
$yum localupdate wine-*
If there is a new version of wine and you download it locally, you can update wine locally like this)

1. List all available wines. Updated software list
Command: yum check-update

2. Install all updated software
Command: yum update

3. Install only specified software
Command: yum install

4. Update only specified software
Command: yum update

5. List all installable software
Command: yum list

3. When using yum to install and uninstall software, there is a prerequisite that the software packages installed by yum are all in rpm format.
The installation command is, yum install xxx, yum will query the database to see if there is this software package. If so, check its dependency conflict. If there is no dependency conflict, then it is best to download and install it; if so, it will be A prompt will appear asking whether you want to install dependencies at the same time, or delete conflicting packages. You can make your own judgment. The command to delete is yum remove xxx. Like installation, yum will also query the database and give tips for resolving dependencies.
1. Use YUM to install the software package
Command: yum install

2. Use YUM to delete the software package

Command: yum remove

4. Use yum to query the software you want to install

We often encounter this situation and want to install it For a piece of software, I only know that it is related to a certain aspect, but I don’t know its name exactly. At this time, yum's query function comes into play. You can use a command like yum search keyword to search. For example, if we want to install an Instant Messenger, but we don’t know what it is, we might as well use a command like yum search messenger to search. Yum will search the descriptions of all available rpms. , lists all rpm packages related to messeger in the description, so we may get gaim, kopete, etc., and choose from them.
Sometimes we may encounter a package installed but don’t know its purpose. We can use the yum info packagename command to obtain information.
1. Use YUM to find packages
Command: yum search
2. List all installable packages
Command: yum list
3. List all updateable packages
Command: yum list updates
4. Column List all installed software packages
Command: yum list installed
5. List all installed software packages but not in Yum Repository
Command: yum list extras
6. List the specified software packages
Command: yum list 7. Use YUM to get package information
Command: yum info 8. List information of all packages
Command: yum info
9. List all updateable package information
Command: yum info updates
10. List All installed package information
Command: yum info installed
11. List all installed package information but not in Yum Repository
Command: yum info extras
12. List which files the package provides
Command: yum provides

5. Clear YUM cache

yum will store the downloaded software packages and headers in the cache and will not delete them automatically. If we feel that they are taking up disk space, we can use the yum clean command to clear them. The more precise usage is yum clean headers to clear headers, yum clean packages to clear downloaded rpm packages, yum clean all to clear all
1. Clear the cache directory (/ var/cache/yum)
Command: yum clean packages

2. Clear the headers under the cache directory (/var/cache/yum)

Command: yum clean headers

3. Clear the cache directory (/ Old headers under var/cache/yum)

Command: yum clean oldheaders

4. Clear the software packages and old headers under the cache directory (/var/cache/yum)

Command: yum clean, yum clean all (= yum clean packages; yum clean oldheaders)

The use of all the above command parameters can be viewed with man:

1. Install the graphical version of yumex: yum install yumex.
2. Install additional software repositories:
rpm.livna.org package repository:
rpm -ivh http://livna-dl.reloumirrors.net … ease-7-2.noarch.rpm

freshrpms.net Software package warehouse:

rpm –ivh http://ftp.freshrpms.net/pub/fre… 1.1-1.fc.noarch.rpm

3. Install the fastest source yum install yum-fastestmirror

The resource is really It is very rich. From Centos to Ubuntu, ISO images, upgrade packages, everything is available. The brothers who submitted it are really happy and envious. But fortunately, we are still within the education network, so we can make do with some benefits and download some.

The URL is: ftp://ftp.sjtu.edu.cn/

The corresponding yum repo is

[updates]
name=Fedora updates
baseurl=ftp://ftp.sjtu.edu.cn/fedora/ linux/updates/$releasever/$basearch/
enabled=1
gpgcheck=0
[fedora]
name=Fedora $releasever - $basearch
baseurl=ftp://ftp.sjtu.edu.cn/fedora/linux/ releases/$releasever/Everything/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/ pki/rpm-gpg/RPM-GPG-KEY

If apt manager is installed on the machine, the corresponding source is

repomd ftp://ftp.sjtu.edu.cn/ fedora/linux/updates/$( VERSION)/$(ARCH)/

repomd ftp://ftp.sjtu.edu.cn/ fedora/linux/releases/$(VERSION)/Everything/$(ARCH)/os/

This is the same as the previous yum There are some differences in the format of the sources that need to be noted.

The following is an introduction to installing scim under fedora

1. What input method is suitable for me?
fcitx and scim are currently better input methods, but their characteristics are different. fcitx can only input Chinese, while scim can use different code expressions to input Chinese, English, Japanese, etc. according to needs. If you only understand Chinese, or can only input English & Chinese, then fcitx is a good choice because it is beautiful, compact, and practical. If you also need to input Japanese or other languages, then you should install scim. Through reasonable configuration, it can allow you to input whatever language you want just like in Windows, and use whatever input method you want for the same language. Scim is very scalable and relatively stable, so I chose scim.
2. What preparations are needed before installing a new input method?
If you choose fcitx or scim, then I suggest you delete the Chinese input method that comes with the system. The method is as follows:
rpm –qa | grep iiimf | xargs rpm –e
rpm –qa | grep Chinput| No, don't worry, just keep reading.
Explanation: rpm –qa lists all installed rpm packages, grep iiimf selects those packages whose names contain iiimf, and xargs rpm –e means to delete the packages listed previously. The function of Xargs is to use the data passed previously through | as the parameters of the following command. This is like a filter. First, all installation packages are placed, and then after grep, only the rpm packages containing certain specific keywords are left. Then, through the combination of xargs and rpm -e, the remaining ones are Packages containing a specific keyword are deleted. In this way, the purpose of deleting the input method and related packages is achieved. The same is true for the Chinput below, which will not be repeated here. If you have installed other input methods, for example, you originally installed fcitx and now want to install scim, then you'd better delete fcitx as shown above. The method is to change the location of iiimf to fcitx.
Before installing a new input method, it is best to do this, because there is no benefit in having multiple input methods in the same system at the same time. You can only use one, and problems may sometimes occur if they exist at the same time. Think about it. You know, they will compete with each other. So after this, you should ensure that there is no Chinese input method in the system. Verify by something like:
whereis fcitx
whereis scim
whereis miniChinput

3. When is the input method called by the system?
Many people don’t know when the input method is loaded. If they don’t know this, of course they don’t know why sometimes the input method cannot be called (because it may not be loaded at all), and of course they don’t know how to configure it to meet their own requirements. .
Everyone knows that there are two commonly used desktop systems under Linux, gnome and kde. It doesn’t matter, they are actually built on the X system. Simply put, the X system is the core and lowest desktop system. Whether it is gnome, kde, or other fvwm, it is just another layer of software between the X system and the user. So if you want to be able to call the input method no matter what desktop system you use, you need to start the input method when the All can be called into the input method. Because when it is their turn to start, the X system has already been started and the input method has been loaded by the system. So how does the X system start? Let's start with startx.
No matter what desktop system you use, it is started through startx. So what exactly is startx? An application or a script file? Why can it start various desktop systems and set them according to the corresponding configuration files? With doubts, I entered whereis startx in the console. After finding the path where startx is stored, I opened it with an editor and found that it turned out to be a script file. The content of this script file may vary depending on the distribution. If you know some shell language, you can try it. You don’t have to understand everything, but after you have a rough look, you will find that there is a xinit at the end. command, followed by some parameters. I tried to enter xinit under the console (note, do not do this operation in the graphical interface)
I found that the graphical interface started, but it was very ugly and had no functions. The mouse could be moved, and there was a small window where commands could be entered. How to exit? ctrl+alt+backspace. It turns out that startx is just a script, which analyzes and sets a series of configuration files, and finally uses the xinit command to start the graphical interface. Whether it is kde or gnome, it is all done in this script. So let's open the startx script again and see what else is done in it. If you look carefully, you will find that there is something very conspicuous, which is /etc/X11/xinit /xinitrc. This xinitrc seems familiar. I always see it in other posts about configuring the input method. If it appears here, it must be running in it. this script. Looking at other things, we actually use the shell to configure a xinit startup parameter, which is used to configure the desktop system, so don't worry about it. What is known so far is that when startx is executed, it will execute a /etc/X11/xinit/xinitrc script. Let’s open it and see what’s inside.
Open it and take a look. One of the paragraphs I think is the most valuable is a for loop, which executes all the scripts under /etc /X11/xinit/xinitrc.d/ in sequence. You can search patiently and you will definitely find it. So what is in this directory? There is a file that you can tell is related to input just by looking at its name. It is called xinput. Wait, let's figure out how to get from startx to xinput.
First, execute the startx script file, which will execute the xinitrc script, and then the xinitrc script is called xinput. OK, let's go ahead and open xinput and take a look.
4. Install the software package
rpm -Uvh scim-0.8.2-1.i586.rpm
rpm -Uvh scim-chinese-0.2.6-1.i586.rpm

5. Modify the configuration file

The next important thing The first step is to modify the
/etc /X11/xinit/xinitrc.d/xinput file so that SCIM will also start when X starts. I have seen many articles on the Internet saying this, but I never get the point. After my own experiments, the simplest thing is to replace all Chinput in the xinput file with SCIM, replace chinput with scim, save and restart X.
zh_CN*)
if [ -e /usr/bin/scim ]; then
XIM="SCIM"
elif [ -e /usr/X11R6/bin/xcin ] ; then

              XIM= "xcin-zh_CN.GB2312"
  fi
;;

........................

SCIM)

XIM_PROGRAM =scim
                                  locale" "ko:ja:zh"
Changed to:
"xim" "X Input Method" "gtk20" "/usr/share/locale" "en:ko:ja:zh"

may mean that it is also used when inputting English After the input method


is installed, run scim-setup and change the input method switching key to ctrl+space



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn