opkg 是 OpenWrt 一個指令式用來安裝及管理套件的程式,作用和 RedHat / CentOS 的 yum,Debian / Ubuntu 的 apt-get,ArchLinux 的 pcman,Gentoo Linux 上的 emerge 功能是類似的。
底下列出一些常用的參數
1. 更新套件庫
# opkg update
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/base/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_base.
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/base/Packages.sig.
Signature check passed.
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/luci/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_luci.
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/luci/Packages.sig.
Signature check passed.
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/management/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_management.
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/management/Packages.sig.
Signature check passed.
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_packages.
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/packages/Packages.sig.
Signature check passed.
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/routing/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_routing.
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/routing/Packages.sig.
Signature check passed.
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/telephony/Packages.gz.
Updated list of available packages in /var/opkg-lists/chaos_calmer_telephony.
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/telephony/Packages.sig.
Signature check passed.
2. 更新套件
# opkg upgrade <pkgs>[@more@]3. 安裝套件
# opkg install <pkgs>
# opkg install /root/ocserv_0.10.5-2_sunxi.ipk
4. 移除套件
# opkg remove <pkgs>
5. 列出可用的套件
# opkg list
6. 搜尋套件
# opkg list | grep <pkgs>
# opkg list | grep ocserv | awk ‘{print $1}’
luci-app-ocserv
ocserv
openconnect
7. 列出已安裝的套件
# opkg list-installed
8. 列出可更新的套件
# opkg list-upgradable
9. 列出套件的相關資訊
# opkg info <pkgs>
# opkg info ocserv
Package: ocserv
Version: 0.10.5-2
Depends: libc, libhttp-parser, libgnutls, certtool, libncurses, libreadline, libprotobuf-c, kmod-tun
Status: unknown ok not-installed
Section: net
Architecture: sunxi
Maintainer: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
MD5Sum: 5eb7ba741efe38d23fed8ed5ac078527
Size: 190298
Filename: ocserv_0.10.5-2_sunxi.ipk
Source: feeds/packages/net/ocserv
Description: OpenConnect server (ocserv) is an SSL VPN server. Its purpose is to be
a secure, small, fast and configurable VPN server. It implements the
OpenConnect SSL VPN protocol, and has also (currently experimental)
compatibility with clients using the AnyConnect SSL VPN protocol. The
OpenConnect VPN protocol uses the standard IETF security protocols such
as TLS 1.2, and Datagram TLS to provide the secure VPN service.
10. 列出已安裝的套件相關訊息
# opkg status <pkgs>
# opkg status ntfs-3g
Package: ntfs-3g
Version: 2014.2.15-1-fuseext
Depends: libc, kmod-fuse, libfuse, libpthread
Status: install user installed
Architecture: sunxi
Installed-Time: 1440475891
11. 列出套件安裝的檔案位置
# opkg files <pkgs>
# opkg files ntfs-3g
Package ntfs-3g (2014.2.15-1-fuseext) is installed on root and has the following files:
/sbin/mount.ntfs-3g
/usr/bin/ntfs-3g.probe
/usr/lib/libntfs-3g.so.85.0.0
/usr/bin/ntfs-3g
/usr/lib/libntfs-3g.so.85
12. 找尋檔案所屬的套件
# opkg search <file>
# opkg search /etc/firewall.user
firewall – 2015-07-27
13. 下載套件
# opkg download <pkgs>
# opkg download kmod-tun
Downloading http://downloads.openwrt.org/chaos_calmer/15.05-rc3/sunxi/generic/packages/base/kmod-tun_3.18.17-1_sunxi.ipk.
Downloaded kmod-tun as ./kmod-tun_3.18.17-1_sunxi.ipk
其它更多的參數
# opkg –help