ipkg命令 |
ipkg 是 OpenWrt 内的一个软件安装管理工具,在 OpenWrt 内输入
root@b&tLinux:/jffs# /opt/bin/ipkg ipkg: ipkg must have one sub-command argument ipkg version 0.99.163 usage: ipkg [options...] sub-command [arguments...] where sub-command is one of: Package Manipulation: update Update list of available packages upgrade Upgrade all installed packages to latest version install <pkg> Download and install <pkg> (and dependencies) install <file.ipk> Install package <file.ipk> configure [<pkg>] Configure unpacked packages remove <pkg|regexp> Remove package <pkg|packages following regexp> flag <flag> <pkg> ... Flag package(s) <pkg> <flag>=hold|noprune|user|ok|installed|unpacked (one per invocation) Informational Commands: list List available packages and descriptions list_installed List all and only the installed packages and description files <pkg> List all files belonging to <pkg> search <file|regexp> Search for a package providing <file> info [pkg|regexp] Display all info for <pkg> status [pkg|regexp] Display all status for <pkg> download <pkg> Download <pkg> to current directory. compare_versions <v1> <op> <v2> compare versions using <= < > >= = << >> print_architecture prints the architecture. print_installation_architecture whatdepends [-A] [pkgname|pat]+ whatdependsrec [-A] [pkgname|pat]+ whatprovides [-A] [pkgname|pat]+ whatconflicts [-A] [pkgname|pat]+ whatreplaces [-A] [pkgname|pat]+ prints the installation architecture. Options: -A Query all packages with whatdepends, whatprovides, whatreplaces, whatconflicts -V <level> Set verbosity level to <level>. If no value is --verbosity <level> provided increase verbosity by one. Verbosity levels: 0 errors only 1 normal messages (default) 2 informative messages 3 debug output -f <conf_file> Use <conf_file> as the ipkg configuration file -conf <conf_file> Default configuration file location is /opt/etc/ipkg.conf -d <dest_name> Use <dest_name> as the the root directory for -dest <dest_name> package installation, removal, upgrading. <dest_name> should be a defined dest name from the configuration file, (but can also be a directory name in a pinch). -o <offline_root> Use <offline_root> as the root directory for -offline <offline_root> offline installation of packages. -verbose_wget more wget messages Force Options (use when ipkg is too smart for its own good): -force-depends Make dependency checks warnings instead of errors Install/remove package in spite of failed dependences -force-defaults Use default options for questions asked by ipkg. (no prompts). Note that this will not prevent package installation scripts from prompting. -force-reinstall Allow ipkg to reinstall a package. -force-overwrite Allow ipkg to overwrite files from another package during an install. -force-downgrade Allow ipkg to downgrade packages. -force_space Install even if there does not seem to be enough space. -noaction No action -- test only -nodeps Do not follow dependences -force-removal-of-dependent-packages -recursive Allow ipkg to remove package and all that depend on it. -test No action -- test only -t Specify tmp-dir. --tmp-dir Specify tmp-dir. regexp could be something like 'pkgname*' '*file*' or similar eg: ipkg info 'libstd*' or ipkg search '*libop*' or ipkg remove 'libncur*' root@b&tLinux:/jffs# 你会得到 ipkg 的说明和帮助,接下来我会说明 ipkg 常用的几个命令: 1. ipkg update ipkg 会到 http://downloads.openwrt.org/whiterussian/packages/ 下载并更新最新的软件包列表(这个列表的位置在/etc/ipkg.conf指定): root@Linksys:~# ipkg update Downloading http://downloads.openwrt.org/whiteru...kages/Packages Updated list of available packages in /usr/lib/ipkg/lists/whiterussian Downloading http://downloads.openwrt.org/whiteru...-free/Packages Updated list of available packages in /usr/lib/ipkg/lists/non-free Successfully terminated. 2. ipkg list 在更新之后,我们可以用 ipkg list 这命令查看一下有什么软件包可供安装,这里我会列出部份结果: root@Linksys:~# ipkg list aiccu – 2005.01.31-1 – SixXS Automatic IPv6 Connectivity Client Utility arptables – 0.0.3-1 – ARP firewalling software arpwatch – 2.1a11-1 – Ethernet monitor program for keeping track of ethernet/ip address pairings asterisk – 1.0.7-1 – An open source PBX ... 3. ipkg install 安装软件包,有 2 种方法,例如我想安装 OpenSSH 的 SFTP 服务器(注 1),方便我以后上传文件到 OpenWrt,我可以执行 ipkg list 或到 OpenWrt 的软件包网址取得软件 SFTP 服务器的资料: Package: openssh-sftp-server Version: 4.0p1-1 Depends: zlib, libopenssl Section: net Architecture: mipsel Maintainer: bugs@openwrt.org MD5Sum: 145c72f82f2404b991a96bf5f3ef2262 Size: 14086 Filename: openssh-sftp-server_4.0p1-1_mipsel.ipk Source: buildroot internal Description: OpenSSH SFTP server 之后我可以选择第 1 个方法用软件包名来安装,这方法会自动把软件包下载并安装: ipkg install openssh-sftp-server 或者选择第 2 个方法从网站把安装包下载到路由器上,然后输入文件名安装: ipkg install openssh-sftp-server_4.0p1-1_mipsel.ipk 4. ipkg list_installed 这个命令会列出 OpenWrt 预先为你安装好的软件 (包括一些常用软件和驱动) 以及你后来安装的软件。 5. ipkg remove 当你的空间不足时,这个命令非常有用,你先执行 ipkg list_installed 得出己安装的软件列表,然后找出你要删除的软件包名称,例如: ipkg remove openssh-sftp-server 注意事项: 由于 WRG54G 的空间有限,安装软件时要留意软件的大小和剩余的空间,我们可以用 df -h 命令得知 Flash Rom 和 虚拟内存的使用量: root@Linksys:~# df -h Filesystem Size Used Available Use% Mounted on /dev/root 3.2M 2.8M 372.0k 89% / none 7.0M 6.5M 540.0k 92% /tmp /dev/mmc/disc0/part1 14.2M 7.5M 6.6M 53% /sd 结果显示我的 WRT54G 只剩下 372k 的空间,虚拟内存也只剩下 540k,因为我为我的WRT54G 加装了一张 16MB 的 SD Card,所以你会看到有一项设备 /dev/mmc/disc0/part1 剩余 6.6M 空间。 注 1: 安装了 openssh-sftp-server,你会发现 sftp 服务器并不能正常使用,为什么呢?!这时你要输入这个命令: ln -s /usr/libexec /usr/lib |
这个世界,真理只存在于导弹的射程范围内
|