2012年12月20日 星期四

Ubuntu:apt-file 套件搜尋小技巧

今天在編譯 Raspberry Pi 的過程中,缺少了不少編譯所需要的套件。對 Linux 不熟的我,通常看到這些缺少的元件,都不知道從何下手,而在搜尋過程中發現到一個利用 apt-file 來尋找特定元件包含在哪個套件中,實際應用節省了我不少的時間。

我在 Ubuntu 12.04 寫以下範例。

1. Ubuntu 預設是沒有安裝 apt-file,先把它安裝起來
$ apt-get install apt-file

2. 安裝完成後,更新套件訊息
$ apt-file update

3. 搜尋你想要的檔案,如:curses.h
$ apt-file search curses.h

4. apt-file 會列出套件名稱,以其底下符合條件的檔案名稱,從中找到所需要的。


5. 紅框框起來的部分就是我要的
$ apt-get install libncurses5-dev

問題解決!

沒有留言:

張貼留言