顯示具有 apt / dpkg 標籤的文章。 顯示所有文章
顯示具有 apt / dpkg 標籤的文章。 顯示所有文章

2014年11月5日 星期三

add PPA GPG key

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9D1A0061



References :
[SOLVED] how to add the PPA key

2014年9月6日 星期六

reinstall debian package with config files

$ cd /var/cache/apt/archives
# dpkg --install --force-confmiss mysql-server-5.5_5.5.38-0ubuntu0.14.04.1_amd64.deb




References :
Linux Wisdom: Reinstall deleted or damaged files in Debian/Ubuntu

2013年8月25日 星期日

2012年12月25日 星期二

apt-cacher 安裝

atp-cacher 只會緩存客戶安裝過的套件包, 而不是所有套件包,緩存資料夾在 /var/cache/apt-cacher/packages

Server :
# apt-get install apt-cacher
# vi /etc/apt-cacher/apt-cacher.conf
allowed_hosts = *

or

allowed_hosts = 192.168.1.0/24
# /etc/init.d/apt-cacher restart


Client :

http://your-server:3142/

# vi /etc/apt/apt.conf
Acquire::http::proxy "http://your-server:3142";

2012年10月18日 星期四

查看 apt-get / aptitude 的 log

使用 apt-get 管理的會記錄在 /var/log/apt/history.log

使用 aptitude 管理的會記錄在 /var/log/aptitude

但底層都是 dpkg,所以會在 /var/log/dpkg.log


將以下函式加入 ~/.bashrc
function apt-history(){
      case "$1" in
        install)
              cat /var/log/dpkg.log | grep 'install '
              ;;
        upgrade|remove)
              cat /var/log/dpkg.log | grep $1
              ;;
        rollback)
              cat /var/log/dpkg.log | grep upgrade | \
                  grep "$2" -A10000000 | \
                  grep "$3" -B10000000 | \
                  awk '{print $4"="$5}'
              ;;
        *)
              cat /var/log/dpkg.log
              ;;
      esac
}

之後就可以執行如 apt-history install 來查看




Reference :
Linux Commando: How to show apt log history

2012年9月30日 星期日

atp-get 使用 proxy

# vi /etc/apt/apt.conf
Acquire::Http::Proxy "http://username:password@domain.com:3128";

2012年9月29日 星期六

apt-get 只下載、不安裝 套件 (download only)

下載套件包
$ apt-get download bash

下載原始碼
$ apt-get source bash




Reference :
How do I use apt-get to only download packages? - Ask Ubuntu

apt-get 不安裝推薦套件

# apt-get --no-install-recommends install perl



# vi /etc/apt/apt.conf
// Recommends are as of now still abused in many packages
APT::Install-Recommends "0";
APT::Install-Suggests "0";




Reference :
HOWTO: Tell "apt-get" not to install "recommends" packages in Debian Linux | Debian Ubuntu Linux Solutions Blog

debian / ubuntu 手動強制移除損壞套件

# mv /var/lib/dpkg/info/PACKAGE_NAME.* /tmp/
# dpkg --remove --force-remove-reinstreq PACKAGE_NAME




Reference :
Manually remove a broken package in Ubuntu/Debian

2011年11月10日 星期四

deb 包相依套件

$ apt-cache depends package

$ apt-get -d install package1 package2 package3

2011年11月1日 星期二

解開 deb 包

# dpkg --unpack xxx.deb

# ar -x xxx.deb

會生成兩個檔案, 解開 data.tar.gz 可得到軟體套件包檔案內容
$ tar zxf data.tar.gz




Reference :
如何解開 *.deb 的包裝檔 | 魔貝特

2011年10月17日 星期一

debian / ubuntu 列出已安裝套件

列出安裝 deb 包
列出 deb 包版本
list deb packages
list deb packages version

$ dpkg --get-selections

or

$ depkg -l




Reference:
Show the List of Installed Packages on Ubuntu or Debian

2011年10月16日 星期日