红联Linux门户
Linux帮助

Debian系统apt-get build-dep命令

发布时间:2017-06-10 10:24:05来源:linux网站作者:wpjamer
apt-get build-dep 包名,这条命令用于在编译安装软件时,自动安装相关的编译环境。比如我要编译nginx,当然可以从网上找到需安装哪些库,用apt-get install XXXX XXXX XXXX ... 来进行安装。但是有时候装了一堆库,可能有几个是用不到的。而是用apt-get build-dep命令可以更好的管理这些库文件和编译环境。
 
先更新软件源列表:
apt-get update
 
以编译nginx为例,安装所需的编译环境:
apt-get build-dep nginx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
autopoint autotools-dev binutils build-essential bzip2 cpp cpp-4.4 debhelper
dpkg-dev fakeroot g++ g++-4.4 gcc gcc-4.4 gettext git html2text intltool-debian
libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
libc-dev-bin libc6-dev libcroco3 libcurl3-gnutls libdpkg-perl liberror-perl
libgeoip-dev libglib2.0-0 libglib2.0-data libgmp3c2 libgomp1 libmail-sendmail-perl
libmpfr4 libpcre3-dev libpcrecpp0 libssl-dev libstdc++6-4.4-dev
libsys-hostname-long-perl libtimedate-perl libunistring0 linux-libc-dev make
manpages-dev po-debconf rsync shared-mime-info zlib1g-dev
The following packages will be upgraded:
libc-bin libc6 libc6-i686 libc6-xen libssl0.9.8
5 upgraded, 48 newly installed, 0 to remove and 54 not upgraded.
Need to get 52.7 MB of archives.
After this operation, 122 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
...
 
由于关系包有很多,如果想卸载可以在安装前先记录下build-dep安装的包:
apt-get build-dep nginx | tee nginx-build-dep.txt
 
Debian系统可以用Deborphan清理没有被依赖的软件包:
apt-get install deborphan
 
查找没有被依赖的软件包:
deborphan -sPz
 
删除找到的包:
apt-get autoremove `deborphan`
 
参考:
Debian系统apt-get build-dep命令
 
本文永久更新地址:http://www.linuxdiyf.com/linux/31388.html