Home | Mirror | Search

5. dpkg

5.1. -i|--install 安裝.deb包

$ sudo dpkg -i netkiller-1.0.deb
			

5.2. -r|--remove 卸載.deb包

$ sudo dpkg -r netkiller
			

5.3. -L|--listfiles <package> ... List files `owned' by package(s). 列出包中的檔案

$ dpkg -L netkiller|more
/.
/opt
/opt/neo
/opt/neo/netkiller-1.0
/opt/neo/netkiller-1.0/linux
/opt/neo/netkiller-1.0/linux/docbook.css
/opt/neo/netkiller-1.0/linux/apas03.html
/opt/neo/netkiller-1.0/linux/shell
			

5.4. -l|--list [<pattern> ...] List packages concisely. 列出.deb包

			
$ sudo dpkg -l netkiller
$ dpkg -l netkiller
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        Description
+++-==============-==============-============================================
un  netkiller      <none>         (no description available)
			
			

5.5. Status

系統上裝了哪些軟件包

要查看 Debian 系統上安裝的所有軟件包的狀態, 運行

     dpkg --list

輸出每個軟件包的一行簡單介紹, 2字元的狀態標誌, 包名, 所安裝版本, 和簡要描述.

查看以 "foo" 開頭的軟件包的狀態, 執行:

     dpkg --list 'foo*'

要得到某個軟件包的更詳細信息, 執行:

     dpkg --status packagename
			

List of installed software packages

$ dpkg-query -W
			

Description of installed software packages

$ dpkg -l
			

找出一個檔案的歸屬包

dpkg --search cachemgr
squid3-cgi: /usr/lib/cgi-bin/cachemgr3.cgi
squid3-cgi: /usr/share/man/man8/cachemgr3.cgi.8.gz
squid3-cgi: /etc/squid3/cachemgr.conf
			

5.6. dpkg-deb - Debian package archive (.deb) manipulation tool

5.6.1. -X, --vextract archive directory Extract and display the filenames contained by a package

$ dpkg -X dmd_2.057-0_amd64.deb dmd_2.057-0_amd64
				

5.6.2. -e, --control archive [directory] Extracts the control information files from a package archive into the specified directory.

$ dpkg -e dmd_2.057-0_amd64.deb

$ find DEBIAN/
DEBIAN/
DEBIAN/conffiles
DEBIAN/md5sum
DEBIAN/control
				

5.6.3. -b, --build directory [archive|directory]

在你的目錄下創建DEBIAN目錄與control檔案

				
mkdir DEBIAN/

cat >> DEBIAN/control <<EOF
Package: netkiller
Version: 1.0-0
Architecture: amd64
Maintainer: Neo Chen <netkiller@msn.com>
Installed-Size: 51196
Depends: libc6-dev, gcc, gcc-multilib, libc6 (>= 2.11), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.1.1)
Section: devel
Priority: optional
Description: Netkiller ebook
 .
 Main designer: Neo Chen
 .
 Homepage: http://netkiller.github.com/
 .
EOF
				
				
				
$ dpkg -b dlang dlang.deb
dpkg-deb: building package `netkiller' in `dlang.deb'.		

$ dpkg --info dlang.deb
 new debian package, version 2.0.
 size 263266 bytes: control archive= 371 bytes.
     354 bytes,    14 lines      control              
 Package: netkiller
 Version: 1.0-0
 Architecture: amd64
 Maintainer: Neo Chen <netkiller@msn.com>
 Installed-Size: 51196
 Depends: libc6-dev, gcc, gcc-multilib, libc6 (>= 2.11), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.1.1)
 Section: devel
 Priority: optional
 Description: Netkiller ebook
  .
  Main designer: Neo Chen
  .
  Homepage: http://netkiller.github.com/
  .

$ dpkg --contents dlang.deb
drwxr-xr-x neo/neo           0 2012-02-06 11:22 ./
-rw-r--r-- neo/neo         144 2012-02-01 16:35 ./hello.lst
-rwxr-xr-x neo/neo         321 2012-01-08 21:25 ./test.d
-rw-r--r-- neo/neo         207 2012-02-01 15:57 ./d4py.d
-rwxr-xr-x neo/neo      919366 2012-02-01 16:28 ./hello
-rw-r--r-- neo/neo        6452 2012-02-01 16:28 ./hello.o
-rwxr--r-- neo/neo          80 2012-01-08 21:28 ./hello.d

				
				

5.7. dpkg-reconfigure

$ sudo dpkg-reconfigure package
			

所有未完成的配置步驟,主要是你在安裝過程中出現中斷後,可以使用下面命令補救。

$ sudo dpkg --configure -a			
			
comments powered by Disqus