当前位置: 首页 > news >正文

使用pkg -r 命令选项向jail虚拟子系统里安装软件@FreeBSD

刷FreeBSD 论坛的时候,看到这样一招:使用pkg -r选项,往jail等虚拟机子系统里安装软件。jails - How to install a pkg offline into a jail? | The FreeBSD Forums

root@fbhost:~ # pkg
pkg: not enough arguments
Usage: pkg [-v] [-d] [-l] [-N] [-j <jail name or id>|-c <chroot path>|-r <rootdir>] [-C <configuration file>] [-R <repo config dir>] [-o var=value] [-4|-6] <command> [<args>]For more information on available commands and options see 'pkg help'.

-r选项后面跟<rootdir> ,也就是是虚拟子系统的根目录,比如对下面的ubu这个虚拟子系统,根目录是是/usr/jails/jails/ubu

先列表看看运行的jail虚拟机子系统

root@fbhost:~ # jlsJID  IP Address      Hostname                      Path18  10.0.0.2        fb12.my.domain                /usr/jails/jails/fb1221  10.0.0.3        ubu.my.domain                 /usr/jails/jails/ubu

看看ubu子系统里面有没有curl

root@fbhost:~ # jexec ubu curl csdn.net
jexec: execvp: curl: No such file or directory

看来是没有 ,本地是有的

root@fbhost:~ # curl
curl: try 'curl --help' or 'curl --manual' for more information

在jail子系统里安装curl

root@fbhost:~ # pkg -r /usr/jails/jails/ubu install curl 
Updating FreeBSD repository catalogue...
pkg: No SRV record found for the repo 'FreeBSD'
Fetching meta.conf:   0%
FreeBSD repository is up to date.
All repositories are up to date.
The following 4 package(s) will be affected (of 0 checked):New packages to be INSTALLED:curl: 8.7.1libnghttp2: 1.61.0libpsl: 0.21.5libssh2: 1.11.0_1,3Number of packages to be installed: 4The process will require 6 MiB more space.
2 MiB to be downloaded.Proceed with this action? [y/N]: y
[1/4] Fetching libnghttp2-1.61.0.pkg: 100%  144 KiB 147.0kB/s    00:01    
[2/4] Fetching libssh2-1.11.0_1,3.pkg: 100%  281 KiB 287.9kB/s    00:01    
[3/4] Fetching libpsl-0.21.5.pkg: 100%   64 KiB  65.6kB/s    00:01    
[4/4] Fetching curl-8.7.1.pkg: 100%    1 MiB   1.6MB/s    00:01    
Checking integrity... done (0 conflicting)
[1/4] Installing libnghttp2-1.61.0...
[1/4] Extracting libnghttp2-1.61.0: 100%
[2/4] Installing libssh2-1.11.0_1,3...
[2/4] Extracting libssh2-1.11.0_1,3: 100%
[3/4] Installing libpsl-0.21.5...
[3/4] Extracting libpsl-0.21.5: 100%
[4/4] Installing curl-8.7.1...
[4/4] Extracting curl-8.7.1: 100%

现在再来看看jail里面是否装好了

root@fbhost:~ # jexec ubu curl csdn.net
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>openresty</center>
</body>
</html>

果然,ubu这个虚拟子系统里的curl已经装好了,pkg -r真的非常方便。因为Jail虚拟容器和PKG软件包管理系统都是FreeBSD的原生应用,所以它们之间配合非常默契,不用到jail子系统里,直接在host主机也能使用pkg向jail子系统安装各种软件。

http://www.lryc.cn/news/382214.html

相关文章:

  • Go语言开发框架GoFly已集成数据可视化大屏开发功能,让开发者只专注业务开发,本文指导大家如何使用
  • PR模板 | RGB特效视频标题模板Titles | MOGRT
  • python替换文件内容
  • SD-WAN是什么?它有哪些应用领域?
  • PHP-CGI的漏洞(CVE-2024-4577)
  • 人工智能前沿讲座——AIGC
  • CCF 第33次CCF计算机软件能力认证第二题
  • python 学习积累
  • ARM day1总结
  • 套路化编程:C# ListView 保存、恢复列宽度
  • python单元测试
  • 华为---静态路由-浮动静态路由及负载均衡(二)
  • Maven deploy上传远程私服失败
  • 通天星CMSV6车载定位监控平台 point_manage/merge SQL注入致RCE漏洞复现
  • 图像识别技术在人脸识别领域的新突破
  • iview 组件里面的(任何一个月)整月日期全部选中_iview时间轴选中有历史记录日期
  • Charles配置与API数据抓取
  • [FreeRTOS 内部实现] 信号量
  • Vue57-组件的自定义事件_解绑
  • Java启动jar设置内存分配详解
  • Feign Client超时时间设置不生效问题
  • Haproxy部署Web群集
  • C++STL梳理
  • 找出1000以内的所有的完数
  • 3110. 字符串的分数
  • Mybatis MySQL allowMultiQueries 一次性执行多条语句
  • Kubernates容器化JVM调优笔记(内存篇)
  • Elasticsearch Scroll 报错entity content is too long
  • Vue iview输入框change事件replace正则替换不生效问题的解决。
  • Prestashop跨境电商独立站,外贸B2C网站完整教程