AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1739603
Accepted
ordinary_guy
ordinary_guy
Asked: 2022-08-30 04:17:20 +0800 CST2022-08-30 04:17:20 +0800 CST 2022-08-30 04:17:20 +0800 CST

带有内置应用程序的 FreeBSD 内核映像

  • 772

我有创建 FreeBSD 内核映像的经验,但有没有办法在映像中包含应用程序,例如 SQlite 数据库?我想要实现的是将镜像构建中的应用程序打包为一个。

freebsd netbsd
  • 1 1 个回答
  • 67 Views

1 个回答

  • Voted
  1. Best Answer
    Vladimir Botka
    2022-08-30T15:09:51+08:002022-08-30T15:09:51+08:00

    有没有办法在图像中包含应用程序,例如 SQlite 数据库?

    是的。这是。挂载您的自定义映像或公开可用的映像之一,并使用pkg安装软件包。使用选项-r。报价:

    -r  <root directory>, --rootdir <root directory>
             pkg will install all packages within the specified <root
             directory>.
    

    笔记:

    • 您还可以在已安装的映像上更新内核和用户空间。使用变量DESTDIR。请参阅线程Building FreeBSD 以在两个 DESTDIR 中安装或更新。

    • 不要忘记卸载映像并销毁mdconfig 单元。

    • 见论坛挂载镜像文件并更改内容。

    • 选择正确的图像。请参阅有关下载 FreeBSD 的 ISO 光盘映像安装程序的论坛混淆!


    例子

    • 从镜像创建内存盘/dev/md0
    shell> mdconfig -a -t vnode -u 0 -f FreeBSD-13.1-RELEASE-amd64.raw
    
    • 显示分区
    shell> gpart show /dev/md0
    =>       3  10552467  md0  GPT  (5.0G)
             3       123    1  freebsd-boot  (62K)
           126     66584    2  efi  (33M)
         66710   2097152    3  freebsd-swap  (1.0G)
       2163862   8388608    4  freebsd-ufs  (4.0G)
    
    • 将分区挂载到/mnt并列出目录
    shell> mount -t ufs /dev/md0p4 /mnt
    shell> ll /mnt
    total 176
    drwxr-xr-x  18 root  wheel   512 May 12 11:58 ./
    drwxr-xr-x  24 root  wheel  1024 Aug 21 16:05 ../
    -rw-r--r--   2 root  wheel  1023 May 12 11:45 .cshrc
    -rw-r--r--   2 root  wheel   507 May 12 11:45 .profile
    -r--r--r--   1 root  wheel  6109 May 12 11:58 COPYRIGHT
    drwxr-xr-x   2 root  wheel  1024 May 12 11:55 bin/
    drwxr-xr-x  14 root  wheel  1536 May 12 11:58 boot/
    dr-xr-xr-x   2 root  wheel   512 May 12 11:39 dev/
    drwxr-xr-x  28 root  wheel  2048 May 12 11:59 etc/
    -rw-r--r--   1 root  wheel     0 May 12 11:59 firstboot
    drwxr-xr-x   5 root  wheel  2048 May 12 11:55 lib/
    drwxr-xr-x   3 root  wheel   512 May 12 11:55 libexec/
    drwxr-xr-x   2 root  wheel   512 May 12 11:39 media/
    drwxr-xr-x   2 root  wheel   512 May 12 11:39 mnt/
    drwxr-xr-x   2 root  wheel   512 May 12 11:39 net/
    dr-xr-xr-x   2 root  wheel   512 May 12 11:39 proc/
    drwxr-xr-x   2 root  wheel  2560 May 12 11:55 rescue/
    drwxr-x---   2 root  wheel   512 May 12 11:58 root/
    drwxr-xr-x   2 root  wheel  3072 May 12 11:56 sbin/
    drwxrwxrwt   2 root  wheel   512 May 12 11:39 tmp/
    drwxr-xr-x  14 root  wheel   512 May 12 11:39 usr/
    drwxr-xr-x  24 root  wheel   512 May 12 11:39 var/
    
    • 在指定的根目录/mnt中安装包sqlite3
    shell> pkg -r /mnt install sqlite3
    Updating FreeBSD repository catalogue...
    Fetching meta.conf: 100%    163 B   0.2kB/s    00:01    
    Fetching packagesite.pkg: 100%    6 MiB   1.7MB/s    00:04    
    Processing entries: 100%
    FreeBSD repository update completed. 31759 packages processed.
    All repositories are up to date.
    The following 2 package(s) will be affected (of 0 checked):
    
    New packages to be INSTALLED:
        libedit: 3.1.20210910,1
        sqlite3: 3.39.0,1
    
    Number of packages to be installed: 2
    
    The process will require 6 MiB more space.
    1 MiB to be downloaded.
    
    Proceed with this action? [y/N]: y
    [1/2] Fetching sqlite3-3.39.0,1.pkg: 100%    1 MiB   1.4MB/s    00:01    
    [2/2] Fetching libedit-3.1.20210910,1.pkg: 100%  136 KiB 138.9kB/s    00:01    
    Checking integrity... done (0 conflicting)
    [1/2] Installing libedit-3.1.20210910,1...
    [1/2] Extracting libedit-3.1.20210910,1: 100%
    [2/2] Installing sqlite3-3.39.0,1...
    [2/2] Extracting sqlite3-3.39.0,1: 100%
    
    • 查看已安装的文件
    shell> for file in `pkg -r /mnt info -l sqlite3 | grep /usr/local`; do ll /mnt/$file; done
    -r-xr-xr-x  1 root  wheel  1727552 Aug 11 03:12 /mnt//usr/local/bin/sqldiff*
    -rwxr-xr-x  1 root  wheel  1960488 Aug 11 03:12 /mnt//usr/local/bin/sqlite3*
    -rw-r--r--  1 root  wheel  613415 Aug 11 03:12 /mnt//usr/local/include/sqlite3.h
    -rw-r--r--  1 root  wheel  37310 Aug 11 03:12 /mnt//usr/local/include/sqlite3ext.h
    lrwxr-xr-x  1 root  wheel  19 Aug 11 03:12 /mnt//usr/local/lib/libsqlite3.so@ -> libsqlite3.so.0.8.6
    lrwxr-xr-x  1 root  wheel  19 Aug 11 03:12 /mnt//usr/local/lib/libsqlite3.so.0@ -> libsqlite3.so.0.8.6
    -rwxr-xr-x  1 root  wheel  1750208 Aug 11 03:12 /mnt//usr/local/lib/libsqlite3.so.0.8.6*
    -rw-r--r--  1 root  wheel  297 Aug 11 03:12 /mnt//usr/local/libdata/pkgconfig/sqlite3.pc
    -r--r--r--  1 root  wheel  3596 Aug 11 03:12 /mnt//usr/local/man/man1/sqlite3.1.gz
    -rw-r--r--  1 root  wheel  55 Aug 11 03:12 /mnt//usr/local/share/licenses/sqlite3-3.39.0,1/LICENSE
    -rw-r--r--  1 root  wheel  71 Aug 11 03:12 /mnt//usr/local/share/licenses/sqlite3-3.39.0,1/PD
    -rw-r--r--  1 root  wheel  180 Aug 11 03:12 /mnt//usr/local/share/licenses/sqlite3-3.39.0,1/catalog.mk
    
    • 卸载镜像并销毁 vnode
    shell> umount /mnt
    shell> mdconfig -l
    md0 
    shell> mdconfig -d -u 0
    shell> mdconfig -l
    
    • 0

相关问题

  • 在 freebsd 中使用 sendmail 发送电子邮件

  • 无法在 FreeBSD 12 中安装 KDE 桌面环境

  • 在“find ... | xargs ...”中,为什么即使 find 返回零结果 xargs 也会迭代?

  • 适用于运行 freeBSD 的 HP ProLiant DL360 Gen9 的 HP iLo 固件升级

  • 如何在 freeBSD 发行版上安装包管理器 (PKG)

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    v15 为什么通过电缆(同轴电缆)的千兆位/秒 Internet 连接不能像光纤一样提供对称速度? 2020-01-25 08:53:31 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve