我的编程空间,编程开发者的网络收藏夹
学习永远不晚

12.OpenWrt-OPKG包管理

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

12.OpenWrt-OPKG包管理

12.OpenWrt-OPKG包管理

Android系统手机都有应用商店,苹果手机也有app store,用来下载安装各种app.在OpenWrt系统中也有自己的 应用商店,OpenWrt是通过OPKG(Open/OpenWrt Package)来管理软件包,OPKG是一个轻量快速的软件包管理系统,用来管理软件包的下载、安装、升级、卸载和查询等,并处理软件包的依赖关系.OPKG不光可以安装应用程序也可以安装驱动程序等,安装的软件可以是编译出来的ipk安装包,也可以是从互联网下载的安装包.

12.1 OPKG 命令

OPKG 的功能主要分两类,一种是软件包的管理命令,另外一种是软件包的查询命令.另外还有很多可以修饰的选项.

12.1.1 软件包的管理

软件包的管理是OPKG最重要的功能,主要包含更新软件包列表、安装、卸载和升级等功能.

1. opkg update

该命令用于更新可以安装的软件包列表.该命令不需要参数,执行时从服务器地址下载软件包列表文件并存储在/var/opkg-lists/目录下.OPKG在安装或升级时需要读取这个文件,这个文件代表当前仓库中所有可用的软件包.也可以删除该文件来释放存储空间,在安装软件前需要重新获取这个文件.

2. opkg install

该命令用于安装软件包, 需要一个参数,传递一个软件包名称.如果软件包之间有依赖关系,会自动下载所有被依赖的软件包,并依次将所有被依赖的软件包安装上.

3. opkg remove

该命令用于卸载软件包,需要一个参数,传递一个软件包名称.需要注意的是,在安装时自动安装的软件包并不会删除,需要自己手动删除,或者在卸载软件包的同时增加(–autoremove)参数将不需要的安装包也删除.示例 3-2 所示代码用于删除 file 软件包及不再使用的依赖包.

4. opkg upgrade

该命令用于升级软件包.如果软件包没有安装,该命令执行之后和“opkg install”效果相同.如果升级多个软件包,以空格分隔列在命令之后即可.例如使用 opkg upgrade ip wget 来升级两个软件包.对大多数用户来说,不推荐升级软件包. OpenWrt 发布后再进行升级大多数情况下是不可能的,这是因为 OpenWrt 发布之后一般不再更新,除非主干的快照被编译机器人(buildbot)自动更新.如果内核升级了,可能带来升级风险,因为内核可能和原始安装的应用软件不兼容.因此一般只升级应用,即非内核软件包.

12.1.2 查询信息

OPKG 查询命令可以在软件仓库中查询,也可以在运行的系统中查询. OPKG 提供了软件包的双向查询功能:正向查询,即从软件包来查询所包含的文件列表;也可以反向查询,从系统中所安装的文件查询所属的软件包.

1. opkg list

该命令用于列出所有可使用的软件包,列出内容格式为:软件包名称 – 版本 – 描述.描述内容是可以有换行的.如果使用 grep 命令来查找软件包则需注意, grep 是单行匹配, 因此使用 grep 查找的结果并不准确.

2. opkg list-installed

该命令用于列出系统中已经安装的软件包.

3. opkg list-changed-conffiles

该命令用于列出用户修改过的配置文件.

4. opkg files

该命令用于列出属于这个软件包( )中的所有文件,这个软件包必须已经安装.

5. opkg search

该命令用于列出提供的软件包,注意:需要传递文件的绝对路径.

6. opkg find

该命令用于列出软件包名称和匹配的软件包. 是一个正则表达式,可以精确匹配,也可以使用星号来模糊匹配,例如使用“net*”或者“net”,均可以匹配 NetCat.

7. opkg info [pkg]

该命令用于显示已安装[pkg]软件包的信息,包含软件包名称、版本、所依赖的软件包名称、安装状态和安装时间等.如果没有指定参数则输出所有已安装软件包的信息.“opkgstatus”和这个命令功能完全相同.

8. opkg download

该命令用于将软件包下载到当前目录.

9. opkg print-architecture

该命令用于列出安装包的架构.

10. opkg whatdepends [-A] [pkg]

该命令用于针对已安装的软件包,输出依赖这个软件包的软件包.

12.2 使用举例

12.2.1 安装软件包

SSH是非常有用的调试工具,可以在同一局域网中连接到板子的Terminal,也可以通过SSH收发文件.有时候并不知道软件包的完整名称,这时候可以通过模糊查找,找到对应的软件包名称来进行安装.

更新软件包 :guilabel:opkg update.
模糊查找关键字 :guilabel:opkg list |grep ssh.
安装软件包 :guilabel:opkg install openssh-server.

 root@GTC-OpenWrt:/# opkg update   Downloading https://downloads.openwrt.org/snapshots/targets/ramips/mt76x8/packages/Packages.gz   Updated list of available packages in /var/opkg-lists/openwrt_core   Downloading https://downloads.openwrt.org/snapshots/targets/ramips/mt76x8/packages/Packages.sig   Signature check passed.   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/base/Packages.gz   Updated list of available packages in /var/opkg-lists/openwrt_base   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/base/Packages.sig   Signature check passed.   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/luci/Packages.gz   Updated list of available packages in /var/opkg-lists/openwrt_luci   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/luci/Packages.sig   Signature check passed.   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/packages/Packages.gz   Updated list of available packages in /var/opkg-lists/openwrt_packages   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/packages/Packages.sig   Signature check passed.   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/routing/Packages.gz   Updated list of available packages in /var/opkg-lists/openwrt_routing   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/routing/Packages.sig   Signature check passed.   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/telephony/Packages.gz   Updated list of available packages in /var/opkg-lists/openwrt_telephony   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/telephony/Packages.sig   Signature check passed.   root@GTC-OpenWrt:~# opkg list |grep ssh   announce - 1.0.1-1 - Announce services on the network with Zeroconf/Bonjour. This announces services such as ssh, sftp, and http running on the local machine to the network.   autossh - 1.4g-4 - Autossh client   avahi-daemon-service-ssh - 0.8-7 - Avahi is an mDNS/DNS-SD (aka RendezVous/Bonjour/ZeroConf) implementation (library). It facilitates service discovery on a local network -- this means that you can plug your laptop or computer into a network and instantly be able to view other people who you can chat with, find printers to print to or find files being shared. This kind of technology is already found in MacOS X (branded 'Rendezvous', 'Bonjour' and sometimes 'ZeroConf') and is very convenient. . This package contains the service definition for announcing SSH service.   cryptsetup-ssh - 2.5.0-1 - Experimental SSH token support for cryptsetup.   erlang-ssh - 4.13 - Erlang/OTP is a general-purpose programming language and runtime environment. Erlang has built-in support for concurrency, distribution and fault tolerance. . This Erlang/OTP package provides an implementation of the Secure Shell protocol, with SSH & SFTP support.   gsocket - 1.4.37-1 - Global Socket allows two workstations on different private networks to communicate with each other. Through firewalls and through NAT - like there is no firewall.  The TCP connection is secured with AES-256 and using OpenSSL's SRP protocol (RFC 5054). It does not require a PKI and has forward secrecy and (optional) TOR support.  The gsocket tools derive temporary session keys and IDs and connect two TCP pipes through the Global Socket Relay Network (GSRN). This is  done regardless and independent of the local IP Address or geographical location.  The session keys (secrets) never leave the workstation. The GSRN sees only the encrypted traffic.  The workhorse is 'gs-netcat' which opens a ssh-like interactive PTY command shell to a remote workstation (which resides on a private and remote network and/or behind a firewall).   libssh - 0.10.3-1 - libssh is a mulitplatform C library implementing the SSHv2 and SSHv1 protocol for client and server implementations.   libssh2-1 - 1.10.0-1 - libssh2 is a client-side C library implementing the SSH2 protocol.   luci-proto-pppossh - git-21.158.38888-88b9d84 - Support for pppossh   openssh-client - 9.0p1-1 - OpenSSH client.   openssh-client-utils - 9.0p1-1 - OpenSSH client utilities.   openssh-keygen - 9.0p1-1 - OpenSSH keygen.   openssh-moduli - 9.0p1-1 - OpenSSH server moduli file.   openssh-server - 9.0p1-1 - OpenSSH server.   openssh-server-pam - 9.0p1-1 - OpenSSH server (with PAM support).   openssh-sftp-avahi-service - 9.0p1-1 - This package contains the service definition for announcing SFTP support via mDNS/DNS-SD.   openssh-sftp-client - 9.0p1-1 - OpenSSH SFTP client.   openssh-sftp-server - 9.0p1-1 - OpenSSH SFTP server.   pagekitec - 0.91.201110C-2 - PageKite is a system for running publicly visible servers (generally web servers) on machines without a direct connection to the Internet, such as mobile devices or computers behind restrictive firewalls. PageKite works around NAT, firewalls and IP-address limitations by using a combination of tunnels and reverse proxies.  This package provides an implementation of the PageKite Protocol in C, optimized for high-performance or embedded applications.   This package contains a basic backend useful for exposing http/ssh servers.  Basic UCI support for configuring this backend is also included.   passh - 1.0.1-2 - Passh is an sshpass alternative.   pppossh - 2 - This package adds protocol support for PPP over SSH.  The protocol name is 'pppossh' as in netifd interface config option 'proto'.   rrsync - 3.2.7-1 - rrsync is a script which wraps around rsync to restrict its permission to a particular subdirectory via ~/.ssh/authorized_keys and/or to read-only or write-only mode   sshfs - 3.7.2-3 - Mount remote system over sftp.   sshpass - 1.09-1 - Sshpass is a tool for non-interactively performing password authentication with SSH's so-called "interactive keyboard password authentication". Most user should use SSH's more secure public-key authentication instead.   sshtunnel - 4-5 - Creates openssh ssh(1) Local and Remote tunnels configured in UCI file. Can be used to allow remote connections, possibly over NATed connections or without public IP/DNS   strongswan-mod-sshkey - 5.9.7-8.1 - StrongSwan SSH key decoding plugin   tmate-ssh-server - 511fd2bd852464e76824279609a34ee93fe148a4-2 - tmate-ssh-server is the server side part of tmate.io.   root@GTC-OpenWrt:/# opkg install openssh-server   Installing openssh-server (9.0p1-1) to root...   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/packages/openssh-server_9.0p1-1_mipsel_24kc.ipk   Installing libopenssl1.1 (1.1.1s-1) to root...   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/base/libopenssl1.1_1.1.1s-1_mipsel_24kc.ipk   Installing zlib (1.2.12-4) to root...   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/base/zlib_1.2.12-4_mipsel_24kc.ipk   Installing openssh-keygen (9.0p1-1) to root...   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/packages/openssh-keygen_9.0p1-1_mipsel_24kc.ipk   Installing libcbor0 (0.8.0-1) to root...   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/packages/libcbor0_0.8.0-1_mipsel_24kc.ipk   Installing libevdev (1.13.0-1) to root...   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/packages/libevdev_1.13.0-1_mipsel_24kc.ipk   Installing libudev-zero (1.0.1-1) to root...   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/packages/libudev-zero_1.0.1-1_mipsel_24kc.ipk   Installing libfido2-1 (1.12.0-1) to root...   Downloading https://downloads.openwrt.org/snapshots/packages/mipsel_24kc/packages/libfido2-1_1.12.0-1_mipsel_24kc.ipk   Configuring libevdev.   Configuring libopenssl1.1.   Configuring zlib.   Configuring openssh-keygen.   Configuring libcbor0.   Configuring libudev-zero.   Configuring libfido2-1.   Configuring openssh-server.

来源地址:https://blog.csdn.net/shuige2215/article/details/128038438

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

12.OpenWrt-OPKG包管理

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

openwrt如何进入管理页面

要进入OpenWrt的管理页面,您可以按照以下步骤操作:首先确保您已经连接到OpenWrt路由器的局域网中。打开您的浏览器,并输入OpenWrt路由器的默认IP地址。通常情况下,默认IP地址为192.168.1.1。按下回车键,您将会看到一
openwrt如何进入管理页面
2024-03-05
2024-04-02

一次性打包送你12 个好看的开源后台管理系统

1. D2admin开源地址:https://github.com/d2-projects/d2-admin文档地址:https://d2.pub/zh/doc/d2-admin/效果预览:https://d2.pub/d2-admin/p
2023-07-25

Python pip包管理

一、前言    在Python中, 安装第三方模块是通过 setuptools 这个工具完成的。 Python有两个封装了 setuptools的包管理工具: easy_install  和  pip , 目前官方推荐使用 pip。    
Python pip包管理
2023-01-31

python 2 :包管理

一个模块就是一个包含pytho代码的文件, 后缀名成是.py就可以,模块就是个python文件  使用模块进行拆分程序,方便维护;增加复用率;当做命名空间使用,避免命名冲突  模块的定义和普通文件无很大区别  导入  假如模块名称直接以数字
2023-01-31

Python包管理整理:setuptoo

setuptool管理python相关的包一、介绍setuptool管理python相关的包的工具。这些包是zip格式发布,但是后缀一般都是.eggsetuptool能解决python包的依赖关系setuptool安装的包默认安装到/usr
2023-01-31

12个linux进程管理命令介绍

执行中的程序在称作进程。当程序以可执行文件存放在存储中,并且运行的时候,每个进程会被动态得分配系统资源、内存、安全属性和与之相关的状态。可以有多个进程关联到同一个程序,并同时执行不会互相干扰。操作系统会有效地管理和追踪所有运行着的进程。为了
2022-06-03

Debian使用哪种包管理工具来管理软件包

Debian使用APT(Advanced Package Tool)作为主要的包管理工具来管理软件包。APT是一个命令行工具,提供了一系列命令来搜索、安装、升级和移除软件包。APT还支持依赖解析和自动安装所需的依赖软件包。APT还可以配合D
Debian使用哪种包管理工具来管理软件包
2024-03-12

Node.js包管理工具

本文主要详细介绍了node包管理工具,主要介绍了npm,cnpm及yarn,文中有详细的代码示例,对学习具有一定参考价值,需要的朋友可以参考一下
2023-05-15

linux有哪些包管理

今天小编给大家分享一下linux有哪些包管理的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。8种常用包管理有:1、DPKG,D
2023-07-02

Android 包管理机制---PackageInstaller

PackageInstaller是Android系统中的一个组件,用于管理和安装应用程序的包。它是Android的包管理机制的一部分,负责处理应用程序包的安装和卸载操作。PackageInstaller提供了一个用户界面,允许用户选择安装应
2023-09-28

python 包管理工具 —— setu

1. 创建一个简单的包创建 setup_demo文件夹,编写如下的 setup.py 文件:from setuptools import setup, find_packagessetup( name = "demo", ver
2023-01-31

编程热搜

目录