21 usefull commands of YUM

What is YUM?

YUM(Yellowdog Updater Modified) is an open source command-line as well
as graphical based package management tool for RPM(RedHat Package
Manager) based Linux systems.

It allows users and system administrator to easily install, update,
remove, or search software packages on a systems.

YUM uses numerous third party repositories to install packages
automatically by resolving their dependencies issues.

1. Install a Package with YUM

To install a package called Firefox 14, just run the below command it
will automatically find and install all required dependencies for
Firefox.


  yum install firefox

The above command will ask confirmation before installing any package
on your system. If you want to install packages automatically without
asking any confirmation, use option -y as shown in below example.


  yum -y install firefox

2. Removing a Package with YUM

To remove a package completely with their all dependencies, just run
the following command as shown below.


   yum remove firefox

Same way the above command will ask confirmation before removing a
package. To disable confirmation prompt just add option -y as shown in
below.


  yum -y remove firefox

3. Updating a Package using YUM

Lets say you have outdated version of MySQL package and you want to update it to the latest stable version. Just run the following commandit will automatically resolves all dependencies issues and
install them.`


  yum update mysql

4. List a Package using YUM

Use the list function to search for the specific package with name.
For example to search for a package called openssh. use the command.


 yum list openssh

You can also use the below command to search the installed packages.


 yum list installed | grep mongo

5. Search for a Package using YUM

If you don`t remember the exact name of the package, then use search
function to search all the available packages to match the name of
the package you specified. For example, to search all the packages
that matches the word.


  yum search vsftpd

6. Get Infomation of a Package using YUM

Say you would like to know information of a package before installing
it. To get information of a package just issue the below command.


   yum info firefox

7. List all Available Packages using YUM

To list all the available packages in the YUM database, use the below
command.


  yum list | less

8. list all Installed Packages using YUM


    yum list installed | less
    

9. YUM Provides Function

YUM provides function is used to find which package a specific
file belongs to. For example, if you would like to known
the name of the package that has the /etc/httpd/conf/httpd.conf


  yum provides /etc/httpd/conf/httpd.conf

But if you rename the default name of the file, it can`t find the
package belongs to. For example like below


      yum provides /etc/mongod37017.conf

10 Check for Available Updates using YUM

To find how many of installed packages on your system have updates
available, to check use the following command


      yum check-update

11. Update System using YUM

To keep your system up-to-date with all security and binary package
updates, run the following command. It will install all lastest
patches and security updates to your system.


  yum update

12. List all available Group Packages

In Linux, number of packages are bundled to particular group.
Instead of installing individual packages with yum, you can
install particular group that will install all the related
packages that belongs to the group. For example to list all
the available groups, just issue following command.


  yum grouplist

13. Install a Group Packages

To install a particular package group, we use option as groupinstall.
For example, to install "MySQL Database"


  yum groupinstall 'MySQL Database'

14. Update a Group Packages

To update any existing installed group packages, just run the
following command as shown below.


   yum groupupdate 'DNS Name Server'

15. Remove a Group Packages

To delete or remove any existing installed group from the system,
just use below command.


  yum groupremove 'DNS Name Server'

16. List Enabled YUM Repositories

To list all enabled YUM repositories in your system, use following
option.


  yum repolist

17. List all Enabeled and Disabled YUM Repositories

The following command will display all enabled and disabled yum
repositores on the system.


  yum repolist all

18. Install a Package from Specific Repository

To install a particular package from a specific enabled or disabled
repository, you must use --enablerepo option in your yum command.
For example to Install PhpMyAdmin 3.5.2 package, just execute the
command


      yum --enablerepo=epel install phpmyadmin

19. Interactive YUM Shell

YUM utility provides a custom shell where you can execute multiple
commands.


  yum shell

20. Clean YUM Cache

By default yum keeps all the repository enabled package data in
/var/cache/yum/ with each sub-directory, to clean all cached files
from enabled repository, you need to run the following command
regularly to clean up all the cache and make sure that there is
noting unnecessary space is using. We don`t want to give the output
of the below command, because we like to keep cached data as it is.


      yum clean all

21. View History of YUM

To view all the past transactions of yum command, just use the
following command.


  yum history

  Loaded plugins: fastestmirror
  ID     | Login user               | Date and time    | Action(s)      | Altered
  -------------------------------------------------------------------------------
  10 | root               | 2012-08-11 15:19 | Install        |    3
  9 | root               | 2012-08-11 15:11 | Install        |    1
  8 | root               | 2012-08-11 15:10 | Erase          |    1 EE
  7 | root               | 2012-08-10 17:44 | Install        |    1
  6 | root               | 2012-08-10 12:19 | Install        |    2
  5 | root               | 2012-08-10 12:14 | Install        |    3
  4 | root               | 2012-08-10 12:12 | I, U           |   13 E<
  3 | root               | 2012-08-09 13:01 | Install        |    1 >
  2 | root               | 2012-08-08 20:13 | I, U           |  292 EE
  1 | System            | 2012-08-08 17:15 | Install        |  560
  history list

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末陵吸,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子装诡,更是在濱河造成了極大的恐慌,老刑警劉巖践盼,帶你破解...
    沈念sama閱讀 217,542評論 6 504
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件鸦采,死亡現(xiàn)場離奇詭異,居然都是意外死亡咕幻,警方通過查閱死者的電腦和手機赖淤,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,822評論 3 394
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來谅河,“玉大人咱旱,你說我怎么就攤上這事”了#” “怎么了吐限?”我有些...
    開封第一講書人閱讀 163,912評論 0 354
  • 文/不壞的土叔 我叫張陵,是天一觀的道長褂始。 經(jīng)常有香客問我诸典,道長,這世上最難降的妖魔是什么崎苗? 我笑而不...
    開封第一講書人閱讀 58,449評論 1 293
  • 正文 為了忘掉前任狐粱,我火速辦了婚禮舀寓,結果婚禮上,老公的妹妹穿的比我還像新娘肌蜻。我一直安慰自己互墓,他們只是感情好,可當我...
    茶點故事閱讀 67,500評論 6 392
  • 文/花漫 我一把揭開白布蒋搜。 她就那樣靜靜地躺著篡撵,像睡著了一般。 火紅的嫁衣襯著肌膚如雪豆挽。 梳的紋絲不亂的頭發(fā)上育谬,一...
    開封第一講書人閱讀 51,370評論 1 302
  • 那天,我揣著相機與錄音帮哈,去河邊找鬼膛檀。 笑死,一個胖子當著我的面吹牛娘侍,可吹牛的內容都是我干的宿刮。 我是一名探鬼主播,決...
    沈念sama閱讀 40,193評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼私蕾,長吁一口氣:“原來是場噩夢啊……” “哼僵缺!你這毒婦竟也來了?” 一聲冷哼從身側響起踩叭,我...
    開封第一講書人閱讀 39,074評論 0 276
  • 序言:老撾萬榮一對情侶失蹤磕潮,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后容贝,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體自脯,經(jīng)...
    沈念sama閱讀 45,505評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 37,722評論 3 335
  • 正文 我和宋清朗相戀三年斤富,在試婚紗的時候發(fā)現(xiàn)自己被綠了膏潮。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,841評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡满力,死狀恐怖焕参,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情油额,我是刑警寧澤叠纷,帶...
    沈念sama閱讀 35,569評論 5 345
  • 正文 年R本政府宣布,位于F島的核電站潦嘶,受9級特大地震影響涩嚣,放射性物質發(fā)生泄漏。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,168評論 3 328
  • 文/蒙蒙 一航厚、第九天 我趴在偏房一處隱蔽的房頂上張望顷歌。 院中可真熱鬧,春花似錦幔睬、人聲如沸眯漩。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,783評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至冯勉,卻和暖如春澈蚌,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背灼狰。 一陣腳步聲響...
    開封第一講書人閱讀 32,918評論 1 269
  • 我被黑心中介騙來泰國打工宛瞄, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人交胚。 一個月前我還...
    沈念sama閱讀 47,962評論 2 370
  • 正文 我出身青樓份汗,卻偏偏與公主長得像,于是被迫代替她去往敵國和親蝴簇。 傳聞我的和親對象是個殘疾皇子杯活,可洞房花燭夜當晚...
    茶點故事閱讀 44,781評論 2 354

推薦閱讀更多精彩內容