您好,登錄后才能下訂單哦!
這篇文章主要為大家展示了“OpenWrt的ipk包如何安裝”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“OpenWrt的ipk包如何安裝”這篇文章吧。
在 make menuconfig 進行裁減 OpenWrt 時,為了讓系統(tǒng)更精小一點,我們會把部分功能以“模塊”的方式編譯,即不編入內(nèi)核,只是在后期用戶可以進行安裝與卸載。
如下關(guān)于Lua的配置項:
其中 json4lua, lua-cjson, lua-copas, lua-coxpcall 是沒有編入原生系統(tǒng)的。
在 make 完成之后。
在 bin/ar71xx/packages/ 路徑下全是 ipk 安裝包。其中上面對應(yīng)的安裝包就在 bin/ar71xx/packages/packages/ 目錄下。
#--開發(fā)機-- $ ls lua* lua-cjson_2.1.0-1_ar71xx.ipk lua-rs232_1.0.3-1_ar71xx.ipk lua-copas_2.0.0-1_ar71xx.ipk luasocket_3.0-rc1-20130909-3_ar71xx.ipk lua-coxpcall_1.15.0-1_ar71xx.ipk luasql-mysql_2.3.0-1_ar71xx.ipk luaposix_v33.2.1-4_ar71xx.ipk luasql-sqlite3_2.3.0-1_ar71xx.ipk
怎么安裝到 OpenWrt上呢?
首先,用 scp 將 ipk 包發(fā)送到 OpenWrt 系統(tǒng)上。本人的 OpenWrt 的 IP 為 192.168.1.2,以 luasql 為例
#--開發(fā)機-- $ scp luasql-mysql_2.3.0-1_ar71xx.ipk root@192.168.1.2: root@192.168.1.2's password: <輸入密碼> luasql-mysql_2.3.0-1_ar71xx.ipk 100% 6441 6.3KB/s 00:00
SSH登入 OpenWrt,查看文件。luasql-mysql_2.3.0-1_ar71xx.ipk 已在 /root/ 目錄下了。
#--OpenWrt--- $ opkg install luasql-mysql_2.3.0-1_ar71xx.ipk Installing luasql-mysql (2.3.0-1) to root... Collected errors: * satisfy_dependencies_for: Cannot satisfy the following dependencies for luasql-mysql: * libmysqlclient * * opkg_install_cmd: Cannot install package luasql-mysql.
Oops,出師不力(不用驚慌,這也是常常遇到的事兒)~缺 libmysqlclient 庫。
那就看看 libmysqlclient 庫的 ipk 包有沒有。如果 bin/ar71xx/packages 路徑下沒有,則是 make menuconfig 時沒有加進來。這時,修改配置,再make一下就會有了。
在 bin/ar71xx/packages/ 路徑下 find 一下。
#--開發(fā)機--- $ find -name "libmysqlclient*" ./packages/libmysqlclient_5.1.73-1_ar71xx.ipk
有!那就不用再make一遍了。
同樣,用 scp 將 libmysqlclient_5.1.73-1_ar71xx.ipk 文件傳送到 OpenWrt。
#--開發(fā)機--- $ scp libmysqlclient_5.1.73-1_ar71xx.ipk root@192.168.1.2:
再在 OpenWrt 的 SSH 里安裝剛發(fā)送過來的 ipk 包。
#--OpenWrt--- $ opkg install libmysqlclient_5.1.73-1_ar71xx.ipk Installing libmysqlclient (5.1.73-1) to root... Collected errors: * satisfy_dependencies_for: Cannot satisfy the following dependencies for libmysqlclient: * uclibcxx * * opkg_install_cmd: Cannot install package libmysqlclient.
Oops~Again,libmysqlclient還依賴于uclibcxx庫。安裝 uclibcxx 庫。
#--開發(fā)機--- $ scp base/uclibcxx_0.2.4-1_ar71xx.ipk root@192.168.1.2:
#--OpenWrt--- $ opkg install uclibcxx_0.2.4-1_ar71xx.ipk Installing uclibcxx (0.2.4-1) to root... Configuring uclibcxx.
uclibcxx庫OK了
再來安裝 libmysqlclient 庫
#--OpenWrt--- $ opkg install libmysqlclient_5.1.73-1_ar71xx.ipk Installing libmysqlclient (5.1.73-1) to root... Configuring libmysqlclient.
libmysqlclient庫OK了。
最后安裝 luasql 庫
#--OpenWrt--- $ opkg install luasql-mysql_2.3.0-1_ar71xx.ipk Installing luasql-mysql (2.3.0-1) to root... Configuring luasql-mysql.
就這樣,luasql 庫安裝完成了。
在 OpenWrt 系統(tǒng)的 /usr/lib/lua/ 目錄下多出一個 luasql 目錄,在該目錄下有一個 mysql.so 文件。
啟動 Lua 試試看:
#--OpenWrt--- $ lua Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio (double int32) > require 'luasql.mysql'
成功。
opkg 有點類似地 ubuntu 中的 dpkg 包管理工具。常見的用法是:安裝、卸載軟件包。
usage: opkg [options...] sub-command [arguments...] where sub-command is one of: Package Manipulation: update Update list of available packages upgrade <pkgs> Upgrade packages install <pkgs> Install package(s) configure <pkgs> Configure unpacked package(s) remove <pkgs|regexp> Remove package(s) flag <flag> <pkgs> Flag package(s) <flag>=hold|noprune|user|ok|installed|unpacked (one per invocation) Informational Commands: list List available packages list-installed List installed packages list-upgradable List installed and upgradable packages list-changed-conffiles List user modified configuration files files <pkg> List files belonging to <pkg> search <file|regexp> List package providing <file> find <regexp> List packages whose name or description matches <regexp> 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 List installable package architectures depends [-A] [pkgname|pat]+ whatdepends [-A] [pkgname|pat]+ whatdependsrec [-A] [pkgname|pat]+ whatrecommends[-A] [pkgname|pat]+ whatsuggests[-A] [pkgname|pat]+ whatprovides [-A] [pkgname|pat]+ whatconflicts [-A] [pkgname|pat]+ whatreplaces [-A] [pkgname|pat]+ Options: -A Query all packages not just those installed -V[<level>] Set verbosity level to <level>. --verbosity[=<level>] Verbosity levels: 0 errors only 1 normal messages (default) 2 informative messages 3 debug 4 debug level 2 -f <conf_file> Use <conf_file> as the opkg configuration file --conf <conf_file> --cache <directory> Use a package cache -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 <dir> Use <dir> as the root directory for --offline-root <dir> offline installation of packages. --add-arch <arch>:<prio> Register architecture with given priority --add-dest <name>:<path> Register destination with given path Force Options: --force-depends Install/remove despite failed dependencies --force-maintainer Overwrite preexisting config files --force-reinstall Reinstall package(s) --force-overwrite Overwrite files from other package(s) --force-downgrade Allow opkg to downgrade packages --force-space Disable free space checks --force-postinstall Run postinstall scripts even in offline mode --force-remove Remove package even if prerm script fails --force-checksum Don't fail on checksum mismatches --noaction No action -- test only --download-only No action -- download only --nodeps Do not follow dependencies --nocase Perform case insensitive pattern matching --force-removal-of-dependent-packages Remove package and all dependencies --autoremove Remove packages that were installed automatically to satisfy dependencies -t Specify tmp-dir. --tmp-dir Specify tmp-dir. regexp could be something like 'pkgname*' '*file*' or similar e.g. opkg info 'libstd*' or opkg search '*libop*' or opkg remove 'libncur*'
以上是“OpenWrt的ipk包如何安裝”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。