免费注册 查看新帖 |

Chinaunix

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

在Virtualbox上安装Funtoo [复制链接]

论坛徽章:
8
亥猪
日期:2014-02-09 10:55:252015小元宵徽章
日期:2015-03-06 15:57:20数据库技术版块每日发帖之星
日期:2015-06-08 22:20:00综合交流区版块每日发帖之星
日期:2015-06-14 22:20:002015亚冠之阿尔沙巴布
日期:2015-09-01 20:23:45IT运维版块每日发帖之星
日期:2015-09-04 06:20:00IT运维版块每日发帖之星
日期:2015-11-04 06:20:00IT运维版块每日发帖之星
日期:2015-12-04 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-04-11 11:21 |只看该作者 |倒序浏览
本帖最后由 lemoncandy 于 2012-04-11 11:21 编辑

在 Virtualbox 上安装 Funtoo Linux

    建议硬盘大小 20G ,反正是动态的。
    用 Gentoo Minimal ISO 引导系统。
    用 gdisk /dev/sda 对虚拟硬盘进行分区,第一分区 /boot(256M) ,第二分区 Bios boot partition(512K) ,第三分区 swap ,第四分区 / 。

    GPT fdisk (gdisk) version 0.8.4

    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present

    Found valid GPT with protective MBR; using GPT.
    Disk /dev/sda: 83886080 sectors, 40.0 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 7E4F11C0-9DBA-42F2-849E-E64557A96C26
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 83886046
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 2014 sectors (1007.0 KiB)

    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048         1050623   512.0 MiB   8300  Linux filesystem
       2         1050624         1116159   32.0 MiB    EF02  BIOS boot partition
       3         1116160         3213311   1024.0 MiB  8200  Linux swap
       4         3213312        83886046   38.5 GiB    8300  Linux filesystem

    下载并运行以下脚本。

    wget http://wiki.zhonglog.com/_export/code/virtualbox?codeblock=2 -O install_funtoo_on_vbox.sh
    sh install_funtoo_on_vbox.sh

    install_funtoo_on_vbox.sh

        # 校准系统, UTC标准时间
        date `date +%m%d%H%M%Y.%S --date="-8 hour"`
         
        # 创建文件系统
        mkfs.ext4 -L boot /dev/sda1
        mkfs.ext4 -L root /dev/sda4
        mkswap -L swap /dev/sda3
         
        # 设置文件系统检查频率,每30次mount,或180天
        #tune2fs -l /dev/sda1
        #tune2fs -c 30 -i 180 /dev/sda1
        #tune2fs -c 30 -i 180 /dev/sda4
         
        # 挂载文件系统
        mkdir /mnt/funtoo
        mount /dev/sda4 /mnt/funtoo
        mkdir /mnt/funtoo/boot
        mount /dev/sda1 /mnt/funtoo/boot
        swapon /dev/sda3
         
        # 下载和解压 stage3 和 portage 包
        cd /mnt/funtoo
        wget http://goo.gl/PqmHH
        tar xpf stage3-current.tar.xz -C /mnt/funtoo
        wget http://goo.gl/QOzRT
        tar xf portage-current.tar.xz -C /mnt/funtoo/usr
         
        # chroot
        mount -o bind /dev /mnt/funtoo/dev
        mount -o bind /proc /mnt/funtoo/proc
        chroot /mnt/funtoo /bin/bash
        env-update
        source /etc/profile
        export PS1="(chroot) $PS1"
         
        # 设置时区和硬件时钟
        ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
        echo "Asia/Shanghai" > /etc/timezone
        sed -i"" -e "/clock=/s/UTC/local/" /etc/conf.d/hwclock
         
        # 设置网络
        ln -sf /etc/init.d/netif.tmpl /etc/init.d/netif.eth0
        cat > /etc/conf.d/netif.eth0 <<DELIM
        template="interface"
        ipaddr="10.0.2.15/24"
        gateway="10.0.2.2"
        nameservers="8.8.8.8"
        DELIM
         
        # 设置主机名
        sed -i"" -e "s/localhost/vbox/" /etc/conf.d/hostname
        sed -i"" -e "/127/s/localhost/localhost\tvbox/" /etc/hosts
        sed -i"" -e "/::1/s/localhost/localhost\tvbox/" /etc/hosts
         
        # 设置域名服务器,以便同步 portage
        echo "nameserver 8.8.8.8" > /etc/resolv.conf
         
        # 设置文件系统列表
        sed -i"" -e "s/ext[23]/ext4/" /etc/fstab
        sed -i"" -e "s/sda3/sda4/" /etc/fstab
        sed -i"" -e "s/sda2/sda3/" /etc/fstab
         
        # 本地化,生成字符集
        cat > /etc/locale.gen <<DELIM
        en_US ISO-8859-1
        en_US.UTF-8 UTF-8
        zh_CN.GB18030 GB18030
        zh_CN.GBK GBK
        zh_CN.UTF-8 UTF-8
        zh_CN GB2312
        DELIM
        locale-gen
         
        # 更新 portage
        cd /usr/portage
        git checkout funtoo.org
        emerge --sync
         
        # make.conf
        cat >> /etc/make.conf <<DELIM
        #
        MAKEOPTS="-j9"
        GENTOO_MIRRORS="http://mirrors.163.com/gentoo"
        DELIM
         
        # 编译内核
        eselect profile set 2
        echo "sys-kernel/sysrescue-std-sources binary" >> /etc/portage/package.use
        emerge sysrescue-std-sources
         
        # 安装必要的软件
        emerge eix gentoolkit rsyslog vixie-cron vim sudo klibc v86d
        #~ emerge tmux byobu
         
        # 设置自启动
        rc-update add netif.eth0 default
        rc-update add sshd default
        rc-update add rsyslog default
        rc-update add vixie-cron default
         
        # 安装并配置GRUB引导管理器
        emerge boot-update
        grub-install --no-floppy /dev/sda
        boot {
                generate grub
                default "Funtoo Linux"
                timeout 3
        }
         
        display {
                gfxmode 1024x768x32
        }
         
        "Funtoo Linux" {
                kernel bzImage
                params quiet root=/dev/sda4 video=uvesafb:1024x768-32,mtrr:3,ywrap
        }
        DELIM
        boot-update
         
        # 添加用户并修改密码
        useradd -m -G audio,cdrom,cron,portage,usb,users,video,wheel -s /bin/bash zhong
        echo "zhong:zhong" > passwd.txt
        echo "root:root" >> passwd.txt
        chpasswd < passwd.txt
        rm passwd.txt
         
        # 清理安装包并退出chroot
        rm /*-current.tar.xz.xz
        exit
         
        # 卸载文件系统并重启
        cd
        umount /mnt/funtoo/{boot,dev,proc,}
        reboot
http://wiki.zhonglog.com/virtualbox?do=backlink
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP