Skip to content

Instantly share code, notes, and snippets.

@ShenXuGongZi
Created November 13, 2013 02:54
Show Gist options
  • Save ShenXuGongZi/7442918 to your computer and use it in GitHub Desktop.
Save ShenXuGongZi/7442918 to your computer and use it in GitHub Desktop.
泡泡云 29元安炸那个debian
Debian with Popobox v1.0
原文链接:http://pear.xiaojiublog.net/2013/11/debian-with-popobox-v1-0/
## 部分内容由 felix021 修正、简化 ##
1: 制作Debian系统
mkdir chroot && cd chroot
sudo debootstrap --foreign --arch=armel wheezy debian http://ftp.debian.org/debian
打包:
sudo tar zcf debian.tar.gz debian
2: 复制镜像到popobox(如果你的scp使用dropbear跳过该步骤,直接scp到/mnt/flash/sandbox/debian.tar.gz即可)
On popobox:
mkdir /mnt/flash/sandbox
cd /mnt/flash/sandbox
nc -l 0.0.0.0 -p 3333 > debian.tar.gz
On host:
nc POPO_IP 3333 < debian.tar.gz
解压(popobox):
tar zxf debian.tar.gz
3: 制作安装脚本
cat > /mnt/flash/sandbox/debian_start.sh
debian_root=/mnt/flash/sandbox/debian
mkdir -p $debian_root
mount -o bind /proc $debian_root/proc
mount -o bind /dev $debian_root/dev
mount -o bind /sys $debian_root/sys
mount -o bind /dev/pts $debian_root/dev/pts
chroot /mnt/flash/sandbox/debian /bin/bash
EOF(Press ctrl+D)
cat > /mnt/flash/sandbox/deb.sh
chroot /mnt/flash/sandbox/debian /bin/bash
EOF(Press ctrl+D)
chmod +x *.sh
4: 执行安装
/mnt/flash/sandbox/debian_start.sh
/mnt/flash/sandbox/deb.sh
5: Now you should in the debian root, there are some extra works to be done
配置
export LD_LIBRARY_PATH=/lib/arm-linux-gnueabi
/debootstrap/debootstrap --second-stage
cat > /etc/apt/sources.list
deb http://ftp.cn.debian.org/debian wheezy main non-free contrib
deb-src http://ftp.cn.debian.org/debian wheezy main non-free contrib
deb http://ftp.cn.debian.org/debian wheezy-updates main non-free contrib
deb-src http://ftp.cn.debian.org/debian wheezy-updates main non-free contrib
EOF(Ctrl+D again)
apt-get update
dpkg-reconfigure tzdata
aptitude install locale (need to downgrade 2 package to bypass the dependency problem )
dpkg-reconfigure locale(choose zh_CN.utf8 and en_US.utf8)
cat > /etc/mtab
/dev/loop0 / ext4 rw,relatime,barrier=1,data=ordered 0 0
EOF(Ctrl+D again)
6: 其他
添加 /mnt/flash/sandbox/debian_start.sh 到 /etc/rc.local 实现开机启动
Or customize debian_start.sh to make it run your own service in debian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment