15 Praktikal nga Ehemplo sa dpkg commands para sa Debian Based Distros


Ang Debian GNU/Linux, ang inahan nga Operating System sa ubay-ubay nga mga distribusyon sa Linux lakip na ang Knoppix, Kali, Ubuntu, Mint, ug uban pa naggamit sa lainlaing package Manager sama sa dpkg, apt, aptitude, synaptic, tasksel, deselect, dpkg-deb ug dpkg-split .

Atong ihulagway ang matag usa niini sa makadiyot sa dili pa mag-focus sa 'dpkg' nga sugo.

Ang Apt nagpasabot sa Advanced Package Tool. Wala kini nag-atubang sa 'deb' nga pakete ug direkta nga nagtrabaho, apan nagtrabaho sa 'deb' archive gikan sa lokasyon nga gitakda sa /etc/apt/sources.list nga file.

Basaha ang Dugang: 25 Mapuslanon nga Basic Command sa APT-GET Commands

Ang Aptitude usa ka tagdumala sa pakete nga nakabase sa teksto alang sa Debian nga naa sa unahan sa 'apt', nga nagtugot sa tiggamit sa pagdumala sa mga pakete nga dali.

Graphical package manager nga nagpadali sa pag-install, pag-upgrade ug pag-uninstall sa mga pakete bisan sa bag-o.

Gitugotan sa Tasksel ang tiggamit nga i-install ang tanan nga may kalabutan nga mga pakete nga may kalabutan sa usa ka piho nga buluhaton, sama sa Desktop-environment.

Usa ka himan sa pagdumala sa pakete nga gimaneho sa menu, nga gigamit sa una sa una nga pag-install ug karon gipulihan sa katakus.

Nakig-interact sa Debian archive.

Mapuslanon sa pagbahin ug paghiusa sa dagkong file ngadto sa mga tipik sa gagmay nga mga file nga tipigan sa media nga mas gamay nga gidak-on sama sa floppy-disk.

Ang dpkg mao ang nag-unang programa sa pagdumala sa package sa Debian ug Debian based System. Gigamit kini sa pag-instalar, paghimo, pagtangtang, ug pagdumala sa mga pakete. Ang aptitude mao ang nag-unang front-end sa dpkg.

Ang pipila sa labing sagad nga gigamit nga mga sugo sa dpkg kauban ang ilang mga paggamit gilista dinhi:

1. Pag-instalar og Package

Alang sa pag-instalar sa usa ka .deb nga pakete, gamita ang sugo nga adunay -i nga kapilian. Pananglitan, sa pag-instalar sa usa ka .deb nga pakete nga gitawag og flashpluginnonfree_2.8.2+squeeze1_i386.deb gamita ang mosunod nga sugo.

 dpkg -i flashpluginnonfree_2.8.2+squeeze1_i386.deb
Selecting previously unselected package flashplugin-nonfree.
(Reading database ... 465729 files and directories currently installed.)
Unpacking flashplugin-nonfree (from flashplugin-nonfree_3.2_i386.deb) ...
Setting up flashplugin-nonfree (1:3.2) ...
--2013-10-01 16:23:40--  http://fpdownload.macromedia.com/get/flashplayer/pdc/11.2.202.310/install_flash_player_11_linux.i386.tar.gz
Resolving fpdownload.macromedia.com (fpdownload.macromedia.com)... 23.64.66.70
Connecting to fpdownload.macromedia.com (fpdownload.macromedia.com)|23.64.66.70|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6923724 (6.6M) [application/x-gzip]
Saving to: ‘/tmp/flashplugin-nonfree.FPxQ4l02fL/install_flash_player_11_linux.i386.tar.gz’

2. Ilista ang tanang na-install nga Packages

Aron matan-aw ug ilista ang tanan nga na-install nga mga pakete, gamita ang kapilian nga -l kauban ang mando.

 dpkg -l
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                   Version                  Architecture    Description
+++-======================================-========================-===============================================================================
ii  accerciser                             3.8.0-0ubuntu1           all             interactive Python accessibility explorer for the GNOME desktop
ii  account-plugin-aim                     3.6.4-0ubuntu4.1         i386            Messaging account plugin for AIM
ii  account-plugin-facebook                0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - facebook
ii  account-plugin-flickr                  0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - flickr
ii  account-plugin-generic-oauth           0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - generic OAuth
ii  account-plugin-google                  0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon
rc  account-plugin-identica                0.10bzr13.03.26-0ubuntu1 i386            GNOME Control Center account plugin for single signon - identica
ii  account-plugin-jabber                  3.6.4-0ubuntu4.1         i386            Messaging account plugin for Jabber/XMPP
....

Aron matan-aw ang usa ka piho nga pakete nga na-install o dili gamita ang kapilian nga -l kauban ang ngalan sa pakete. Pananglitan, susiha kung naka-install ba ang apache2 package o wala.

 dpkg -l apache2
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                   Version                  Architecture    Description
+++-======================================-========================-==============================================
ii  apache2                                2.2.22-6ubuntu5.1        i386            Apache HTTP Server metapackage

3. Kuhaa ang usa ka Pakete

Aron matangtang ang .deb nga pakete, kinahanglan natong ipiho ang ngalan sa pakete nga flashpluginnonfree, dili ang orihinal nga ngalan nga flashplugin-nonfree_3.2_i386.deb. Ang -r nga kapilian gigamit sa pagtangtang/pag-uninstall sa usa ka pakete.

 dpkg -r flashpluginnonfree
(Reading database ... 142891 files and directories currently installed.) 
Removing flashpluginnonfree ... 
Processing triggers for man-db ... 
Processing triggers for menu ... 
Processing triggers for desktop-file-utils ... 
Processing triggers for gnome-menus ...

Mahimo usab nimo gamiton ang 'p' nga kapilian puli sa 'r' nga magtangtang sa pakete kauban ang file sa pag-configure. Ang 'r' nga kapilian magtangtang lamang sa pakete ug dili mga file sa pag-configure.

 dpkg -p flashpluginnonfree

4. Tan-awa ang Content sa usa ka Package

Aron matan-aw ang sulud sa usa ka partikular nga pakete, gamita ang kapilian nga -c sama sa gipakita. Ang sugo magpakita sa mga sulod sa usa ka .deb nga pakete sa long-list nga pormat.

 dpkg -c flashplugin-nonfree_3.2_i386.deb
drwxr-xr-x root/root         0 2012-12-14 22:54 ./
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/bin/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/lib/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/lib/mozilla/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/lib/mozilla/plugins/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/lib/flashplugin-nonfree/
-rw-r--r-- root/root      3920 2009-09-09 22:51 ./usr/lib/flashplugin-nonfree/pubkey.asc
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/man/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/man/man8/
-rw-r--r-- root/root       716 2012-12-14 22:54 ./usr/share/man/man8/update-flashplugin-nonfree.8.gz
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/applications/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/icons/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/icons/hicolor/
drwxr-xr-x root/root         0 2012-12-14 22:54 ./usr/share/icons/hicolor/24x24/
....

5. Susiha ang usa ka Package nga na-install o wala

Gamit ang -s nga kapilian nga adunay ngalan sa package, ipakita kung ang usa ka deb package na-install o wala.

 dpkg -s flashplugin-nonfree
Package: flashplugin-nonfree
Status: install ok installed
Priority: optional
Section: contrib/web
Installed-Size: 177
Maintainer: Bart Martens <[email >
Architecture: i386
Version: 1:3.2
Replaces: flashplugin (<< 6)
Depends: debconf | debconf-2.0, wget, gnupg, libatk1.0-0, libcairo2, libfontconfig1, libfreetype6, libgcc1, libglib2.0-0, libgtk2.0-0 (>= 2.14), libnspr4, libnss3, libpango1.0-0, libstdc++6, libx11-6, libxext6, libxt6, libcurl3-gnutls, binutils
Suggests: iceweasel, konqueror-nsplugins, ttf-mscorefonts-installer, ttf-dejavu, ttf-xfree86-nonfree, flashplugin-nonfree-extrasound, hal
Conflicts: flashplayer-mozilla, flashplugin (<< 6), libflash-mozplugin, xfs (<< 1:1.0.1-5)
Description: Adobe Flash Player - browser plugin
...

6. Susiha ang nahimutangan sa Packages nga na-install

Aron ilista ang lokasyon sa mga file nga i-install sa imong sistema gikan sa ngalan sa package.

 dpkg -L flashplugin-nonfree
/.
/usr
/usr/bin
/usr/lib
/usr/lib/mozilla
/usr/lib/mozilla/plugins
/usr/lib/flashplugin-nonfree
/usr/lib/flashplugin-nonfree/pubkey.asc
/usr/share
/usr/share/man
/usr/share/man/man8
/usr/share/man/man8/update-flashplugin-nonfree.8.gz
/usr/share/applications
/usr/share/icons
/usr/share/icons/hicolor
...

7. I-install ang tanang Packages gikan sa Directory

Sa balikbalik nga paagi, i-install ang tanan nga regular nga mga file nga parehas nga pattern nga *.deb nga makit-an sa piho nga mga direktoryo ug tanan nga mga subdirektoryo niini. Mahimo kining gamiton sa mga opsyon nga -R ug –install. Pananglitan, akong i-install ang tanang .deb nga mga pakete gikan sa direktoryo nga gitawag og debpackages.

 dpkg -R --install debpackages/
(Reading database ... 465836 files and directories currently installed.)
Preparing to replace flashplugin-nonfree 1:3.2 (using .../flashplugin-nonfree_3.2_i386.deb) ...
Unpacking replacement flashplugin-nonfree ...
Setting up flashplugin-nonfree (1:3.2) ...
Processing triggers for man-db ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus ...

8. Unpack ang Package apan ayaw’ I-configure

Ang paggamit sa aksyon nga –unpack mag-unpack sa package, apan dili kini i-install o i-configure kini.

 dpkg --unpack flashplugin-nonfree_3.2_i386.deb
(Reading database ... 465836 files and directories currently installed.)
Preparing to replace flashplugin-nonfree 1:3.2 (using flashplugin-nonfree_3.2_i386.deb) ...
Unpacking replacement flashplugin-nonfree ...
Processing triggers for man-db ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus ...

9. I-configure pag-usab ang Unpacked Package

Ang opsyon nga “–configure” mag-reconfigure sa usa ka wala na maputos nga pakete.

 dpkg --configure flashplugin-nonfree
Setting up flashplugin-nonfree (1:3.2) ...

10. Ilisan ang anaa nga impormasyon sa Package

Ang “–-update-avail” nga opsyon mopuli sa daan nga impormasyon sa anaa nga impormasyon sa Packages file.

 dpkg –-update-avail package_name

11. Papasa ang Anaa na nga impormasyon sa Package

Ang aksyon nga “–clear-avaial” mopapas sa kasamtangang impormasyon bahin sa unsa nga mga pakete ang anaa.

 dpkg –-clear-avail

12. Kalimti ang Uninstalled ug Unavailable Packages

Ang mando sa dpkg nga adunay kapilian nga –forget-old-unavail awtomatiko nga makalimot sa wala ma-install ug dili magamit nga mga pakete.

 dpkg --forget-old-unavail

13. Ipakita ang dpkg Lisensya

 dpkg --licence

14. Ipakita ang Bersyon sa dpkg

Ang argumento nga –bersyon magpakita sa kasayuran sa bersyon sa dpkg.

 dpkg –version
Debian `dpkg' package management program version 1.16.10 (i386).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.

15. Kuhaa ang tanan nga Tabang bahin sa dpkg

Ang “–help” nga opsyon magpakita sa listahan sa mga available nga opsyon sa dpkg command.

 dpkg –help
Usage: dpkg [<option> ...] <command>

Commands:
  -i|--install       <.deb file name> ... | -R|--recursive <directory> ...
  --unpack           <.deb file name> ... | -R|--recursive <directory> ...
  -A|--record-avail  <.deb file name> ... | -R|--recursive <directory> ...
  --configure        <package> ... | -a|--pending
  --triggers-only    <package> ... | -a|--pending
  -r|--remove        <package> ... | -a|--pending
  -P|--purge         <package> ... | -a|--pending
  --get-selections [<pattern> ...] Get list of selections to stdout.
  --set-selections                 Set package selections from stdin.
  --clear-selections               Deselect every non-essential package.
  --update-avail <Packages-file>   Replace available packages info.
  --merge-avail <Packages-file>    Merge with info from file.
  --clear-avail                    Erase existing available info.
  --forget-old-unavail             Forget uninstalled unavailable pkgs.
  -s|--status <package> ...        Display package status details.
...

Kana lang sa pagkakaron. Mobalik na usab ako dinhi uban ang laing makapaikag nga artikulo. Kung nasipyat ko sa bisan unsang sugo sa lista ipahibalo kanako pinaagi sa mga komento. Hangtud niana, Magpabilin nga tuned ug Padayon nga konektado sa Tecmint. I-like ug i-share mi ug tabangi mi sa pagpakatap. Ayaw kalimot sa paghisgot sa imong bililhong mga hunahuna sa komento.