免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2665 | 回复: 7
打印 上一主题 下一主题

[FreeBSD] PC-BSD 9.1 提供的 Linux jail [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-07-13 23:21 |只看该作者 |倒序浏览
本帖最后由 zeissoctopus 于 2012-07-13 23:22 编辑

PC-BSD 9.1 的 Warden 提供 Linux jail。 暫時支援直接安裝 debian 6.0.x。

PC-BSD Warden Wiki

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
2 [报告]
发表于 2012-07-14 07:29 |只看该作者
@zeissoctopus 感谢分享最新消息 ^_^

论坛徽章:
89
水瓶座
日期:2014-04-01 08:53:31天蝎座
日期:2014-04-01 08:53:53天秤座
日期:2014-04-01 08:54:02射手座
日期:2014-04-01 08:54:15子鼠
日期:2014-04-01 08:55:35辰龙
日期:2014-04-01 08:56:36未羊
日期:2014-04-01 08:56:27戌狗
日期:2014-04-01 08:56:13亥猪
日期:2014-04-01 08:56:02亥猪
日期:2014-04-08 08:38:58程序设计版块每日发帖之星
日期:2016-01-05 06:20:00程序设计版块每日发帖之星
日期:2016-01-07 06:20:00
3 [报告]
发表于 2012-07-14 10:25 |只看该作者
这下牛逼毁了。。。

论坛徽章:
4
白羊座
日期:2013-09-24 23:01:09技术图书徽章
日期:2013-10-25 07:33:452015年辞旧岁徽章
日期:2015-03-03 16:54:1515-16赛季CBA联赛之江苏
日期:2016-12-22 10:45:16
4 [报告]
发表于 2012-07-14 13:50 |只看该作者
有啥牛逼的???

论坛徽章:
54
2017金鸡报晓
日期:2017-02-08 10:39:42操作系统版块每日发帖之星
日期:2016-03-08 06:20:00操作系统版块每日发帖之星
日期:2016-03-07 06:20:00操作系统版块每日发帖之星
日期:2016-02-22 06:20:00操作系统版块每日发帖之星
日期:2016-01-29 06:20:00操作系统版块每日发帖之星
日期:2016-01-27 06:20:00操作系统版块每日发帖之星
日期:2016-01-20 06:20:00操作系统版块每日发帖之星
日期:2016-01-06 06:20:0015-16赛季CBA联赛之江苏
日期:2015-12-21 20:00:24操作系统版块每日发帖之星
日期:2015-12-21 06:20:00IT运维版块每日发帖之星
日期:2015-11-17 06:20:002015亚冠之广州恒大
日期:2015-11-12 10:58:02
5 [报告]
发表于 2012-07-14 20:12 |只看该作者
呵呵,连操作系统都是混合动力了。

论坛徽章:
0
6 [报告]
发表于 2012-07-14 20:18 |只看该作者
安装?

能安装OS的话还算是jail么

论坛徽章:
0
7 [报告]
发表于 2012-07-14 21:23 |只看该作者
xooass 发表于 2012-07-14 20:18
安装?

能安装OS的话还算是jail么


Linux jail 裡的 debian 是用 FreeBSD Host 的 File system, 因此 Linux jail 並不是虛擬機。

论坛徽章:
0
8 [报告]
发表于 2012-07-15 13:47 |只看该作者
本帖最后由 xooass 于 2012-07-16 09:56 编辑

不错  非常感兴趣  应该是debian kFreeBSD内核版本的,



freebsd# cd /usr/ports/sysutils/debootstrap
freebsd# make install clean
freebsd# rehash


Create a directory for the jail, you may create this as a ZFS dataset, too.
freebsd# mkdir -p /jail/debian


Load necessary kernel modules:
freebsd# kldload fdescfs linprocfs linsysfs tmpfs
NOTE: Add these to /boot/loader.conf to run the jail on startup


Create a Debian (squeeze) distribution in the directory using debootstrap
freebsd# debootstrap squeeze /jail/debian http://cdn.debian.net/debian

Unmount filesystems mounted by debootstrap:
freebsd# umount /jail/debian/sys
freebsd# umount /jail/debian/dev/fd /jail/debian/dev
freebsd# umount /jail/debian/proc

Mount necessary filesystems:
freebsd# mount -t linprocfs linprocfs /jail/debian/proc
freebsd# mount -t linsysfs linsysfs /jail/debian/sys
freebsd# mount -t tmpfs tmpfs /jail/debian/lib/init/rw
NOTE: Add the filesystems to /etc/fstab to run the jail on startup, see "man fstab"

Configure the jail in your /etc/rc.conf, you may follow this example:
jail_enable="YES"
jail_list="debian"
jail_debian_rootdir="/jail/debian"
jail_debian_hostname="debian.home"
jail_debian_ip="127.0.0.1"
jail_debian_devfs_enable="YES"
jail_debian_exec_start="/etc/init.d/rc 3"
jail_debian_flags="-l -u root"

Replace 127.0.0.1 with an IP address on your system and debian.home with your desired jail hostname.

Edit /jail/debian/etc/resolv.conf or you may use your system resolv.conf, if you want:
freebsd# cp /etc/resolv.conf /jail/debian/etc/resolv.conf

Run your new jail (the /etc/rc.jail script starts rsyslog, cron and sshd inside the jail)
freebsd# /etc/rc.d/jail start debian

Use jls(8) to get the JID of your jail and jexec(8) to run /bin/bash inside:
freebsd# jls
JID  IP Address  Hostname     Path
  1  127.0.0.1   debian.home  /jail/debian

freebsd# jexec 1 /bin/bash

Verify that you are under debian now:
root@debian:/# uname
GNU/kFreeBSD

Adjust your debian mirror in /etc/apt/sources.list (base system /jail/debian/etc/apt/sources.list)
Have fun with Debian GNU/kFreeBSD in a FreeBSD jail! (functionality may be limited)
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP