02 Package Management and Update



YUM

Yum eshte administruesi i paketave (Red Hat package manager) i cili ofron funksionalitetet e nevojshme per:
  • te marre informacione mbi paketat disponibel
  • te marre paketat nga depot ("repositories")
  • te instaloje dhe te c'instaloje paketat
  • te rinovoje (update) sistemin ne versionet e reja
Yum kryen nje verifikim automatik mbiu varesine qe paketat kane nga njera-tjetra dhe instalon gjithashtu ed paketat nga te cilat ka varesi paketa qe po instalohet

Depot e paketave qe perdor Yum mund te shtohen dhe modifikohen.
Gjithashtu Yum eshte i pajisur me plug-in qe shtojne funksionalitetet e tij.

Yum kryen pothuajse te gijtha funksionet qe kryen edhe RPM. Gjithashtu edhe argumentat e komandes jane te njejta si ne Yum edhe ne RPM.

Yum mundeson administrim te sigurte te paketave nepermjet firmave GPG (Gnu Privacy Guard; njohur ndryshe si GnuPG). Nese aktivizohet verfikimi i firmes Yum nuk do te pranoje te instaloje paketa te pa firmosura.

Yum na lejon  gjithashtu qe te kijojme dept tona me paketa PRM ( repositories) per ti shkarkuar dhe per ti instaluar ne makina te tjera.

Qe te perdorim Yum per te instaluar paketat duhe te kemi privilegjet e superuser-it ( su ose sudo)

Rinovimi i paketave


Kerkimi per versione te reja te paketave


Per te pare cilat nga paketat e instaluara ne sistem kane nje version me te ri mund te perdorim komanden yum me opsionin check-update

per shembull

[root@localhost student]# yum check-update
.............................................

bind-libs.i686                  32:9.8.2-0.23.rc1.el6_5.1 updates               
bind-utils.i686                 32:9.8.2-0.23.rc1.el6_5.1 updates               
....................................................   

[root@localhost student]# 


Evidentimi i paketave qe kane nevoje per rinovim per arsye sigurie


Eshte e mundur qe te evidentojme vetem paketat te cilat kane nevoje per rinovim per arsye sigurie. Evidentimi dhe rinovimi i ketyre paketave eshte i rendesishem per shkak sepse problemet me sigurine mund te krijojne hapesira per nderhyrje te paaurotizuara ne sistem.
Per te evidentuar paketat qe kane nevoje per rinovim per arsye sigurie perdorim komanden:

[root@localhost student]# yum check-update --security
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.cc.uoc.gr
 * extras: centos.telecoms.bg
 * updates: ftp.cc.uoc.gr
Limiting package lists to security relevant ones
No packages needed for security; 54 packages available
[root@localhost student]# 



Rinovimi i paketave


Rinovimi i nje pakete 
Per te rinovuar nje pakete mund te perdorim  opsionin update sipas sintakses se meposhtme:

yum update emri_paketes

Per shembull

[root@localhost student]# yum update firefox*

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


Rinovimi i te gjithe paketave
Eshte e mundur qe nepermjet yum te nisim nje proces te rinovimit te te gijthe paketave te instaluara. Ne kete rast komanda do te ishte 

yum update

pa vendosur ndonje emer pakete te vecante.

Rinovim i paketave me probleme sigurie


Per te rinovuar vetem paketa te cilat kane probleme sigurie mund te perdorim opsionin --security

[root@localhost student]# yum update --security
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.cc.uoc.gr
 * extras: centos.telecoms.bg
 * updates: ftp.cc.uoc.gr
Setting up Update Process
Resolving Dependencies
Limiting packages to security relevant ones
No packages needed for security; 53 packages available
[root@localhost student]# 

Paketat dhe grupet e paketave


Kerkimi per paketa


Mund te kerkojme ne depone paketave me fjale kyce. Kerkimi behet ne emrin e paketes dhe pershkrimin e paketes.

Per te kerkuar ne deopt e paketave perdorim komanden:

yum search fjale_kyce

per shembull

[root@localhost student]# yum search vsftpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.cc.uoc.gr
 * extras: centos.telecoms.bg
 * updates: ftp.cc.uoc.gr
============================= N/S Matched: vsftpd ==============================
vsftpd.i686 : Very Secure Ftp Daemon

  Name and summary matches only, use "search all" for everything.
[root@localhost student]# yum search vsftp
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.cc.uoc.gr
 * extras: centos.telecoms.bg
 * updates: ftp.cc.uoc.gr
============================== N/S Matched: vsftp ==============================
vsftpd.i686 : Very Secure Ftp Daemon

  Name and summary matches only, use "search all" for everything.
[root@localhost student]# 


Listimi i paketave


Komanda yum list search_string  na mundeson te listojme paketat qe e kane emertimin sipas search_string.
Search-string perbehet nga karaktere fikse dhe nga simbolet speciale:
  •  ? (pike cuditese) per te simbolizuar nje karakter dhe
  •  * (yll) per te simbolizuar nje numer cfare do karakteresh 0..n


Per shembull komanda yum list bind* do te listoje te gjithe paketat qe fillojne me bind 

[root@localhost student]# yum list bind*
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.cc.uoc.gr
 * extras: centos.telecoms.bg
 * updates: ftp.cc.uoc.gr
Installed Packages
bind-libs.i686       32:9.8.2-0.17.rc1.el6_4.6 @anaconda-CentOS-201311271240.i386/6.5
bind-utils.i686      32:9.8.2-0.17.rc1.el6_4.6 @anaconda-CentOS-201311271240.i386/6.5
Available Packages
bind.i686            32:9.8.2-0.23.rc1.el6_5.1 updates                          
bind-chroot.i686     32:9.8.2-0.23.rc1.el6_5.1 updates                          
bind-devel.i686      32:9.8.2-0.23.rc1.el6_5.1 updates                          
bind-dyndb-ldap.i686 2.3-5.el6                 base                             
bind-libs.i686       32:9.8.2-0.23.rc1.el6_5.1 updates                          
bind-sdb.i686        32:9.8.2-0.23.rc1.el6_5.1 updates                          
bind-utils.i686      32:9.8.2-0.23.rc1.el6_5.1 updates                          
[root@localhost student]# 


Ndersa komanda yum list bind? nuk do te listoje asnje pakete pasi ajo kerkon per paketa qe fillojne me bind dhe kane edhe nje simbol te vetem pas bind

[root@localhost student]# yum list bind?
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.cc.uoc.gr
 * extras: centos.telecoms.bg
 * updates: ftp.cc.uoc.gr
Error: No matching Packages to list
[root@localhost student]# 


Per te listuar te gjithe paketat e instaluara mund te perdorim opsionin e komandes yum list installed

Per shembull per te listuar paketat e instaluara emri i te cilave pemban fjalen ftp, perdorim komanden me poshte:

[root@localhost student]# yum list installed | grep ftp
ftp.i686                  0.17-54.el6     @base                                 
gvfs-obexftp.i686         1.4.3-15.el6    @anaconda-CentOS-201311271240.i386/6.5
tftp-server.i686          0.49-7.el6      @base                                 
vsftpd.i686               2.2.2-11.el6_4.1
[root@localhost student]# 


Per te listuar paketat disponibel te pa instaluara ende perdorim yum list available

Per shembull

[root@localhost student]# yum list available | grep wireshark
wireshark.i686                             1.8.10-4.el6                  base   
wireshark-devel.i686                       1.8.10-4.el6                  base   
wireshark-gnome.i686                       1.8.10-4.el6                  base   
[root@localhost student]# 

Per te listuar te gjithe paketat ( te instaluara dhe disponibel per tu instaluar ) perdorim yum list all

Per shembull

[root@localhost student]# yum list all | grep wireshark
wireshark.i686                             1.8.10-4.el6                  base   
wireshark-devel.i686                       1.8.10-4.el6                  base   
wireshark-gnome.i686                       1.8.10-4.el6                  base   
[root@localhost student]# 


Shfaqja e informacioneve per paketat

Per te marre informacione ne lidhje me nje pakete mund te perdorim opsionin info te komandes yum, 

per shembull

[root@localhost student]# yum info wireshark.i686
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.cc.uoc.gr
 * extras: centos.telecoms.bg
 * updates: ftp.cc.uoc.gr
Available Packages
Name        : wireshark
Arch        : i686
Version     : 1.8.10
Release     : 4.el6
Size        : 9.9 M
Repo        : base
Summary     : Network traffic analyzer
URL         : http://www.wireshark.org/
License     : GPL+
Description : Wireshark is a network traffic analyzer for Unix-ish operating systems.
            : 
            : This package lays base for libpcap, a packet capture and filtering
            : library, contains command-line utilities, contains plugins and
            : documentation for wireshark. A graphical user interface is packaged
            : separately to GTK+ package.

[root@localhost student]# 




Instalimi i paketave

Per te instaluar nje pakete nepermjet Yum komanda eshte yum install emri_paketes

[root@localhost student]# yum install wireshark.i686

Instalimi i grupeve te paketave

Nje grup paketash permbledh disa paketa qe se bashku ofrojne nje funksionalitet te caktuar.
Nje grup paketash ka nje emer dhe nje group_id.

Komanda yum grouplist -v liston emrat e grupeve te paketave dhe perbri tyre kodin e grupit

Gjithashtu mund te kerkojme te listojme grupe e paketave duke perdorur simbolet e vecanta * dhe ?

Per shembull:

[root@localhost student]# yum grouplist kde*
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Group Process
Loading mirror speeds from cached hostfile
 * base: ftp.cc.uoc.gr
 * extras: ftp.cc.uoc.gr
 * updates: ftp.cc.uoc.gr
Available Groups:
   KDE Desktop
Done
[root@localhost student]# 



Per te instaluar nje grup paketash si per shembull KDE Desktop me lart mund te perdorim opsionin groupinstall te komandes yum se ciles duhet ti kalojme si argument group_id ose emrin e grupit te paketave.

Per shembull:

[root@localhost student]# yum groupinstall "KDE Desktop"


C'instalimi i paketave


Per te c'instaluar nje pakete perdorim opsionin remove te komandes yum ( yum remove emri_paketes)

Per shembull

[root@localhost student]# yum remove wireshark.i686
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package wireshark.i686 0:1.8.10-4.el6 will be erased
--> Finished Dependency Resolution
...............................................
...............................................

Gjithshtu eshte e mundur qe te c'instalohet nje grup paketash nepermjet 

yum groupremove emri_grupit

per shembull 

[root@localhost student]# yum groupremove "KDE Desktop"
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Group Process


Historiku i veprimeve


Komanda yum history   i lejon perdoruesve te shikojne historine e veprimeve te yum ne kohe dhe numrin e paketave te ndikuara ( instalim apo c'instalim) ne cdo transaksion te yum.

Gjithashti kjo  komande mund te perdoret per te kthyer mbrapsht ( undo) ose per te ribere ( redo ) nje veprim te yum.

Komanda yum history list liston 20 transaksionet me te fundit te yum.

Per shembull

[root@localhost student]# yum history list
Loaded plugins: fastestmirror, refresh-packagekit, security
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     9 | ICT Student <student>    | 2014-02-13 08:37 | Install        |    2   
     8 | ICT Student <student>    | 2014-02-09 13:50 | Install        |    4   
     7 | ICT Student <student>    | 2014-01-13 08:58 | Install        |    2   
     6 | ICT Student <student>    | 2014-01-13 08:54 | Install        |    2   
     5 | ICT Student <student>    | 2014-01-13 08:10 | Install        |   24   
     4 | ICT Student <student>    | 2014-01-06 08:06 | Install        |    3   
     3 | ICT Student <student>    | 2014-01-02 07:49 | Install        |    1   
     2 | ICT Student <student>    | 2014-01-02 07:47 | Install        |    1   
     1 | System <unset>           | 2014-01-02 07:58 | Install        |  924   
history list
[root@localhost student]# 

Per te listuar te gjithe transaksionet predorim opsionin all

[root@localhost student]# yum history list all
Loaded plugins: fastestmirror, refresh-packagekit, security
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     9 | ICT Student <student>    | 2014-02-13 08:37 | Install        |    2   
     8 | ICT Student <student>    | 2014-02-09 13:50 | Install        |    4   
     7 | ICT Student <student>    | 2014-01-13 08:58 | Install        |    2   
     6 | ICT Student <student>    | 2014-01-13 08:54 | Install        |    2   
     5 | ICT Student <student>    | 2014-01-13 08:10 | Install        |   24   
     4 | ICT Student <student>    | 2014-01-06 08:06 | Install        |    3   
     3 | ICT Student <student>    | 2014-01-02 07:49 | Install        |    1   
     2 | ICT Student <student>    | 2014-01-02 07:47 | Install        |    1   
     1 | System <unset>           | 2014-01-02 07:58 | Install        |  924   
history list
[root@localhost student]# 




Per te listuar transaksionet e yum qe kane prekur nje pakete te caktuar mund te perdorimin package-list

per shembull

root@localhost student]# yum history package-list vsftp*
Loaded plugins: fastestmirror, refresh-packagekit, security
ID     | Action(s)      | Package                                              
-------------------------------------------------------------------------------
     2 | Install        | vsftpd-2.2.2-11.el6_4.1.i686                         
history package-list
[root@localhost student]# 



Sic duke nga kodi me lart paketa vs-ftp* eshte instaluar ne transaksionin e yum ne id =2

Mund te marrim nje informacion mbi transaksionin 2

[root@localhost student]# yum history info 2
Loaded plugins: fastestmirror, refresh-packagekit, security
Transaction ID : 2
Begin time     : Thu Jan  2 07:47:11 2014
Begin rpmdb    : 924:b32b27f146d1946614b1f71c496654228d36271c
End time       :            07:47:16 2014 (5 seconds)
End rpmdb      : 925:8173c378e68db53897f4959c2002f8b1c8e8b077
User           : ICT Student <student>
Return-Code    : Success
Command Line   : install vsftp*
Transaction performed with:
    Installed     rpm-4.8.0-37.el6.i686                         @anaconda-CentOS-201311271240.i386/6.5
    Installed     yum-3.2.29-40.el6.centos.noarch               @anaconda-CentOS-201311271240.i386/6.5
    Installed     yum-plugin-fastestmirror-1.1.30-14.el6.noarch @anaconda-CentOS-201311271240.i386/6.5
Packages Altered:
    Install vsftpd-2.2.2-11.el6_4.1.i686 @base
history info
[root@localhost student]# 


Per te c'bere nje veprim te yum

[root@localhost student]# yum history undo 9

Shembulli me poshte kerkon per informacine ne lidhje me paketen wireshark. Gjen transaksionin ne te cilin eshte instaluar kjo pakete dhe e kthen mbrapsht kete transaksion:

Verifikojme veprimet e yum per paketen wireshark:

[root@localhost student]# yum history package-list wireshark*
Loaded plugins: fastestmirror, refresh-packagekit, security
ID     | Action(s)      | Package                                              
-------------------------------------------------------------------------------
     9 | Install        | wireshark-1.8.10-4.el6.i686                          
history package-list
[root@localhost student]# 

Nga informacioni me lart verifikojme qe transaksioni me id 9 ka instaluar paketen wireshark

Kerkojme me shume informacione mbi kete transaksion:

[root@localhost student]# yum history info 9
Loaded plugins: fastestmirror, refresh-packagekit, security
Transaction ID : 9
Begin time     : Thu Feb 13 08:37:14 2014
Begin rpmdb    : 961:269dacdc516d9aaa3322ed3eaa127c1fa4dd58ad
End time       :            08:37:30 2014 (16 seconds)
End rpmdb      : 963:afca8d9ed37fce228e95d96369b09b1b6f90fc30
User           : ICT Student <student>
Return-Code    : Success
Command Line   : install wireshark.i686
Transaction performed with:
    Installed     rpm-4.8.0-37.el6.i686                         @anaconda-CentOS-201311271240.i386/6.5
    Installed     yum-3.2.29-40.el6.centos.noarch               @anaconda-CentOS-201311271240.i386/6.5
    Installed     yum-plugin-fastestmirror-1.1.30-14.el6.noarch @anaconda-CentOS-201311271240.i386/6.5
Packages Altered:
    Dep-Install libsmi-0.4.8-4.el6.i686     @base
    Install     wireshark-1.8.10-4.el6.i686 @base
history info
[root@localhost student]# 


E kthejme mbrapsht kete transaksion

[root@localhost student]# yum history undo 9
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.cc.uoc.gr
 * extras: ftp.cc.uoc.gr
 * updates: ftp.cc.uoc.gr
Undoing transaction 9, from Thu Feb 13 08:37:14 2014
    Dep-Install libsmi-0.4.8-4.el6.i686     @base
    Install     wireshark-1.8.10-4.el6.i686 @base
Resolving Dependencies
--> Running transaction check
---> Package libsmi.i686 0:0.4.8-4.el6 will be erased
---> Package wireshark.i686 0:1.8.10-4.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved
..........................................
Remove        2 Package(s)

Installed size: 64 M
Is this ok [y/N]: 

Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : wireshark-1.8.10-4.el6.i686                                                                                                                                                       1/2 
  Erasing    : libsmi-0.4.8-4.el6.i686                                                                                                                                                           2/2 
  Verifying  : libsmi-0.4.8-4.el6.i686                                                                                                                                                           1/2 
  Verifying  : wireshark-1.8.10-4.el6.i686                                                                                                                                                       2/2 

Removed:
  libsmi.i686 0:0.4.8-4.el6                                                                       wireshark.i686 0:1.8.10-4.el6                                                                      

Complete!
[root@localhost student]# 

Po te listojme pas kesaj transaksionet e yum:

[root@localhost student]# yum history list
Loaded plugins: fastestmirror, refresh-packagekit, security
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    10 | ICT Student <student>    | 2014-02-13 09:20 | Erase          |    2   
     9 | ICT Student <student>    | 2014-02-13 08:37 | Install        |    2   
     8 | ICT Student <student>    | 2014-02-09 13:50 | Install        |    4   
     7 | ICT Student <student>    | 2014-01-13 08:58 | Install        |    2   
     6 | ICT Student <student>    | 2014-01-13 08:54 | Install        |    2   
     5 | ICT Student <student>    | 2014-01-13 08:10 | Install        |   24   
     4 | ICT Student <student>    | 2014-01-06 08:06 | Install        |    3   
     3 | ICT Student <student>    | 2014-01-02 07:49 | Install        |    1   
     2 | ICT Student <student>    | 2014-01-02 07:47 | Install        |    1   
     1 | System <unset>           | 2014-01-02 07:58 | Install        |  924   
history list
[root@localhost student]# 


eshte shtuar nje transaksion me ID 10. Nese kerkojme me shume info per kete transaksion:

[root@localhost student]# yum history info 10
Loaded plugins: fastestmirror, refresh-packagekit, security
Transaction ID : 10
Begin time     : Thu Feb 13 09:20:38 2014
Begin rpmdb    : 963:afca8d9ed37fce228e95d96369b09b1b6f90fc30
End time       :            09:20:45 2014 (7 seconds)
End rpmdb      : 961:269dacdc516d9aaa3322ed3eaa127c1fa4dd58ad
User           : ICT Student <student>
Return-Code    : Success
Command Line   : history undo 9
Transaction performed with:
    Installed     rpm-4.8.0-37.el6.i686                         @anaconda-CentOS-201311271240.i386/6.5
    Installed     yum-3.2.29-40.el6.centos.noarch               @anaconda-CentOS-201311271240.i386/6.5
    Installed     yum-plugin-fastestmirror-1.1.30-14.el6.noarch @anaconda-CentOS-201311271240.i386/6.5
Packages Altered:
    Erase libsmi-0.4.8-4.el6.i686     @base
    Erase wireshark-1.8.10-4.el6.i686 @base
history info
[root@localhost student]# 


Verifikojme qe paketa wireshark eshte c'instaluar.

Ne kete pike mund te duam ta riinstalojme wireshark dhe per kete mund te ribejme (redo) transaksionin 9.

[root@localhost student]# yum history redo 9
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.cc.uoc.gr
 * extras: ftp.cc.uoc.gr
 * updates: ftp.cc.uoc.gr
Repeating transaction 9, from Thu Feb 13 08:37:14 2014
    Dep-Install libsmi-0.4.8-4.el6.i686     @base
    Install     wireshark-1.8.10-4.el6.i686 @base
Resolving Dependencies
--> Running transaction check
---> Package wireshark.i686 0:1.8.10-4.el6 will be installed
--> Processing Dependency: libsmi.so.2 for package: wireshark-1.8.10-4.el6.i686
--> Running transaction check
---> Package libsmi.i686 0:0.4.8-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

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




Konfigurimi i Yum


Skedari kryesor i konfigurimit per yum eshte etc/yum.conf. 
Ndersa ne dosjen /etc/yum.repos.d/ ndodhen skedaret me informacion se ku ndodhen dosjet e paketave ku do te kerkoju Yum per instalimin e paketave te reja apo per updaten e paketave te instaluara tashme.
Ky informacion ruhet ne skedare me emrin {skedar}.repo



/etc/yum.conf
Me poshte eshte permbajtja e nje skedari /etc/yum.conf i marre si shembull :

[root@localhost student]# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
[root@localhost student]# 


Seksioni Main
Skedari permban nje seksion te detyrueshem main ,ne te cilin percaktohet menyre se si do te funksionoje yum dhe menyra se si yum do te trajtoje depot e paketave ( package repositories).

Disa nga opsionet me te zakonshme te seksionit main jane:


cachedir=direktori

ku direktori eshte path i direktorise ne te cilen yum do te ruaje skedaret e tije te cache dhe te database. Si default direktoria e cache e yum ndodhet ne /var/cache/yum.
reposdir=direktori

…ku direktori eshte vendi ku ndodhen skedaret e depove(file.repo)
Te gjithe skedaret .repo permbajne informacion mbi depot e paketave 
yum mbledh te gjithe informacionet mbi depot nga sekdaret  .repo si edhe nga seksioni 
[repository] ne etc/yum .conf per te ndertuar nje liste me depot e paketave qe do te perdore per veprimet e instalimit apo rinovimit.
Nese nuk eshte percaktuar opsioni  reposdir , yum  perdor direktorine baze  /etc/yum .repos.d/


Permbajtja e dosjes /etc/yum.repos.d/
Me poshte po listojme per shembull permbajtjen e dosjes /etc/yum.repos.d/

[root@localhost student]# ls /etc/yum.repos.d/ -l
total 20
-rw-r--r--. 1 root root 1887 Feb 14 00:41 CentOS-Base.repo
-rw-r--r--. 1 root root  638 Nov 27 03:52 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  630 Nov 27 03:52 CentOS-Media.repo
-rw-r--r--. 1 root root 3664 Nov 27 03:52 CentOS-Vault.repo
[root@localhost student]# 


Skedari CentOS-Base.repo ruan informacion mbi vendondodhjen e depove te paketave:


[root@localhost student]# cat /etc/yum.repos.d/CentOS-Base.repo_old 
 
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[root@localhost student]# 

Shenim:
variablat $releasever dhe $basearch (release server dhe base architecture) ruajne versionin e serverit (psh 6 ose 6.5) dhe arkitekturen per shembull i386.



Per te percaktuar nje depo paketash mund te percaktojme minimalisht :
  • nje emer dhe 
  • nje base_url
Ndersa mund te vendosim gjithashtu edhe nje liste me servera qe hostojne depo paketash, si per shembull ne skedarin e afishuar me lart , nen seksionin [base]

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/


eshte percaktuar nje mirror list ne vend te nje baseurl. 
baseurl ruan adresen e nje depoje paketash ndersa mirror list ruan nje liste me url ku ndodhen depot e paketave

Per shembull mirror list ne shembullin me lart ne versionin 6 per arkitekturen i386 do te kishte permbajten e meposhtme:

https://sites.google.com/a/ictedu.info/web/e-learning/redhat-linux-cource-custom/02-learning-how-to-install-and-configure-local-components-and-services/yum-installation/yumm%20config%20mirror%20list%2001.PNG?attredirects=0

Ndersa nje baseurl e depos se paketave do te ishte per shembull:

baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

qe do te ishte

http://mirror.centos.org/centos/6/os/i386/

ose nese do te perdornim serverin qe kemi ndertuar paraprakisht:

baseurl=http://192.168.221.9/centos/6.5/os/i386/

https://sites.google.com/a/ictedu.info/web/e-learning/redhat-linux-cource-custom/02-learning-how-to-install-and-configure-local-components-and-services/yum-installation/local%20repository.PNG?attredirects=0

Duhet qe dosja ku shenon URL duhet te kete dosjen repodata.


Server lokal per paketat

Nga sa shpjeguam me lart eshte e mundur qe te konfigurojme yum duke modifikuar permbatjen e skedareve te depove ne /etc/yum.repos.d duke i mundesuar makinave qe ndodhen ne rrjetin tone te marrin paketat nga serveri lokal pa patur nevoje te dalin ne internet per te shkarkuar paketa apo per te kryer rinovimin e tyre.


Per kete eshte e nevojshme qe :

  1. Te sinkronizojme serverin lokal me nje server mirror public duke perdorur komanden rsync
  2. Te konfigurojme yum e makinave te tjera ne rrjet qe te kerkojne per depot e paketave ne serverin lokal
Skema me poshte ilustron kete rast

https://sites.google.com/a/ictedu.info/web/e-learning/redhat-linux-cource-custom/02-learning-how-to-install-and-configure-local-components-and-services/yum-installation/local%20yum%20server.PNG




1- Te sinkronizojme serverin lokal me mirror publike ne internet:

[root@localhost student]# rsync -avrt rsync://ftp.is.co.za/mirror/centos/6.5/os/i386   /home/student/centos/6.5/os/i386
..................................
receiving incremental file list
.......................................


Ky veprim mund te marre pak kohe dhe te gjeneroje trafik interneti per kete arsye do te sugjerohej qe te skedulohej ky veprim ne nje orar te pershtatshem duke krijuar nje cron job.


Shembull
Krijojme nje skedar tekst me permbajtjen e meposhtme

[root@localhost student]# cat /etc/cron.daily/sysupdate
 rsync -avrt rsync://ftp.is.co.za/mirror/centos/6.5/os/i386   /home/student/centos/6.5/os/i386
[root@localhost student]# 


{ndryshoni  serverin me te cilin doni te sinkronizoni dhe pathin lokal te skedareve te sistemit operativ ne serverin tuaj}

I japim ketij skedari te drejta ekzekutimi

[root@localhost student]# chmod a+r /etc/cron.daily/sysupdate 
[root@localhost student]# ls  /etc/cron.daily/sysupdate  -l
-rwxr-xr-x 1 root root 95 Feb 20 14:25 /etc/cron.daily/sysupdate
[root@localhost student]# 

Sic duket nga x ne te drejtat e skedarit skedari eshte tashme i ekzekutueshem.

Nese e therrasim skedarin nga prompti:

do te nise procesi i sinkronizimit me serverin  e percaktuar:

[root@localhost student]#  /etc/cron.daily/sysupdate 
................................................
receiving incremental file list
........................................


Ky skript do te ekzekutohet cdo dite ne varesi te konfigurimit qe i kemi bere sherbimit te cron.

Ne kete pike kemi krijuar nje server lokal i cili sinkronizohet ne menyre te vazhdueshme. Tani do te modifikojme skedaret e depove /etc/yum.repos.d/xxx_base.repo ne menyre te tille qe ta udhezojne yum qe te kerkoje per paketa ne serverin lokal ne rrjet:

2- Te konfigurojme yum e makinave te tjera ne rrjet qe te kerkojne per depot e paketave ne serverin lokal

Do te modifikojme permbajtjen e skedarit  CentOS-Base.repo

[root@localhost student]# ls /etc/yum.repos.d/ -l
total 20
-rw-r--r--. 1 root root 1887 Feb 14 00:41 CentOS-Base.repo
-rw-r--r--  1 root root 1927 Feb 14 00:37 CentOS-Base.repo_old
-rw-r--r--. 1 root root  638 Nov 27 03:52 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  630 Nov 27 03:52 CentOS-Media.repo
-rw-r--r--. 1 root root 3664 Nov 27 03:52 CentOS-Vault.repo
[root@localhost student]# 


me permbajtjen e meposhtme:

    
[root@localhost student]# cat /etc/yum.repos.d/CentOS-Base.repo


[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://192.168.221.9/centos/6.5/os/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://192.168.221.9/centos/6.5/os/i386/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


Per efekt te ketij shembulli kemi modifikuar vetem seksionet [base] dhe [updates] ku merren paketat baze dhe updatet.
Jane komentuar mirrorlist dhe dhe jane percaktuar baseurl duke i dhene si vlere adresen e serverit lokal.

Pas ketij konfigurimi nese do te tentojme te instalojme nje pakete nepermejt yum atehere yum do te kerkoje per paketen ne serverin lokal:

[root@localhost student]# yum install wireshark*
..........................................................

Shkarkimi behet shume me shpejt pasi paketat gjenden lokalisht ne server.


Komandat per konfigurimin e yum

Ka nje liste me komanda qe na mundeson qe ne menyre interaktive te  konfigurojme yum.

yum-config-manager

Komanda yum-config-manager na liston konfigurimin aktual te yum per te gjithe seksionet:

[root@localhost student]# yum-config-manager
Loaded plugins: fastestmirror, refresh-packagekit
===================================== main =====================================
[main]
.............................
assumeyes = False
.............................
cachedir = /var/cache/yum/i386/6
reposdir = /etc/yum/repos.d
...........................

================================== repo: base ==================================
[base]
base_persistdir = /var/lib/yum/repos/i386/6
baseurl = http://192.168.221.9/centos/6.5/os/i386/
cachedir = /var/cache/yum/i386/6/base
.........................................
================================= repo: extras =================================
[extras]
bandwidth = 0
base_persistdir = /var/lib/yum/repos/i386/6
baseurl = 
...............................................................
mirrorlist = http://mirrorlist.centos.org/?release=6&arch=i386&repo=extras
mirrorlist_expire = 86400
name = CentOS-6 - Extras
.....................................
================================ repo: updates =================================
[updates]
bandwidth = 0
base_persistdir = /var/lib/yum/repos/i386/6
baseurl = http://192.168.221.9/centos/6.5/os/i386/
cachedir = /var/cache/yum/i386/6/updates
......................................
[root@localhost student]# 





Yum-config-manager mund te na jape gjithashtu nje informacion mbi nje seksion te konfigurimit per shembull

[root@localhost student]# yum-config-manager base
................................

ose

[root@localhost student]# yum-config-manager updates
................................

Shtimi ,aktivizimi dhe c'aktivizimi i depove te paketave

Shtimi ,aktivizimi dhe c'aktivizimi i depove qe perdor yum mund te behet nepermejt komandave ne menyre interaktive

Komanda:

yum-config-manager --add-repo repository_url

shton nje depo te re paketash per tu perdorur nga yum.
Keto komanda mund te jene te dobishme nese perdoren ne formen e skripteve ne fund te instalimit te sistemit ne rastin e instalimeve kickstart per te instaluar makina te cilat jane te parakonfiguruar per te kerkuar per depot e paketave ne nje server lokal qe ne fillim.

~]# yum-config-manager --add-repo http://www.example.com/example.repo
Loaded plugins: product-id, refresh-packagekit, subscription-m anager
adding repo from : http://www.exam ple.com /exam ple.repo
grabbing file http://www.exam ple.com /exam ple.repo to
/etc/yum .repos.d/exam ple.repo
exam ple.repo | 413 B 00:00
repo saved to /etc/yum .repos.d/example.repo


Ndonese mund te jete shtuar nje depo paketash ajo duhet aktivizuar qe te mund te perdoret nga yum.
Per te aktivizuar nje depo paketash mund te perdorim opsionin enable te komandes yum-config-manager, per shembull


~]# yum-config-manager --enable example\*
Loaded plugins: product-id, refresh-packagekit, subscription-m anager
============================== repo: exam ple ==============================
[exam ple]
bandwidth = 0
base_persistdir = /var/lib/yum /repos/x86_64/6Server
baseurl = http://www.exam ple.com /repo/6Server/x86_64/
cache = 0
cachedir = /var/cache/yum /x86_64/6Server/example........
........................................................

Ndersa komanda

yum-config-manager --disable repository

Na mundeson te c'aktivizojme nje depo paketash