Prepare in QNAP NAS QTS GUI:
I. Create user and share name:
II. Install Optware (Development) from QTS App Center
II-1. Once Optware is enabled, use PuTTY or any SSH client and login as
II-2. Execute following commands in SSH session:
III. Prepare and download Ubuntu debootstrap
III-1. Download debootstrap
III-2. Set debootstrap directory path:
To make sure path is correctly set, execute:
You should see:
III-3. Set env. settings
If you have 64-bit processor, change
You can also change the mirror server by replacing
IV. Initiate debootstrap
V. Download QEMU
VI. Run debootstrap second stage using QEMU arch
VII. Configurue Ubuntu packages
VIII-1. Download Ubuntu apt repository sources list
All servers in
VIII-2. Make backup of the original sources list and use the downloaded one instead:
IX. Mount essential directories using
X. Install common packages
XI. Download and set GPG repository keys
XII. Update apt repository
XIII. Enjoy debootstrap
XIV. Optional - upgrade packages
XV. Optional - install xfce and xrdp
First - set password for root user:
Second - install xfce:
Third - install xrdp:
Now you can connect to Ubuntu desktop via Windows Remote Desktop 
HAPPY HACKING …
APPEND - Useful scripts:
I. Create user and share name:
Backup
II. Install Optware (Development) from QTS App Center
II-1. Once Optware is enabled, use PuTTY or any SSH client and login as
admin
II-2. Execute following commands in SSH session:
Bash:
ipkg install binutils
ipkg install coreutils
ipkg install perl
ipkg install nano mc
III. Prepare and download Ubuntu debootstrap
III-1. Download debootstrap
Bash:
cd /share/Backup
mkdir -p chroot; cd chroot
wget -c http://mirror.esc7.net/pub/Ubuntu/pool/main/d/debootstrap/debootstrap_1.0.40~precise2_all.deb
ar -x debootstrap_1.0.40~precise2_all.deb
tar xvf data.tar.gz
III-2. Set debootstrap directory path:
Bash:
export DEBOOTSTRAP_DIR=`pwd`/usr/share/debootstrap
To make sure path is correctly set, execute:
Bash:
ls $DEBOOTSTRAP_DIR
Kod:
devices.tar.gz functions scripts/
III-3. Set env. settings
Bash:
export ARCH=i386
export RELEASE=precise
export MIRROR=http://pl.archive.ubuntu.com/ubuntu/
If you have 64-bit processor, change
i386
to amd64
.You can also change the mirror server by replacing
pl
to another country code.IV. Initiate debootstrap
Bash:
./usr/sbin/debootstrap --arch $ARCH --foreign $RELEASE ./$RELEASE\_$ARCH $MIRROR
V. Download QEMU
Bash:
wget -c http://launchpadlibrarian.net/118258808/qemu-user-static_1.0.50-2012.03-0ubuntu2.1_amd64.deb
ar -x qemu-user-static_1.0.50-2012.03-0ubuntu2.1_amd64.deb
tar xvf data.tar.gz
VI. Run debootstrap second stage using QEMU arch
Bash:
cp ./usr/bin/qemu-x86_64-static ./$RELEASE\_$ARCH/usr/bin
export DEBOOTSTRAP_DIR=""
LC_ALL=C LANGUAGE=C LANG=C chroot $RELEASE\_$ARCH /debootstrap/debootstrap --second-stage
VII. Configurue Ubuntu packages
Bash:
LC_ALL=C LANGUAGE=C LANG=C chroot $RELEASE\_$ARCH dpkg --configure -a
VIII-1. Download Ubuntu apt repository sources list
Bash:
wget --no-check-certificate https://help.ubuntu.com/12.04/sample/sources.list
All servers in
sources.list
are located in US, so you can change them:
Bash:
sed -i "s/us\.archive/pl.archive/g" sources.list
VIII-2. Make backup of the original sources list and use the downloaded one instead:
Bash:
mv $RELEASE\_$ARCH/etc/apt/sources.list $RELEASE\_$ARCH/etc/apt/sources.list.orig
cp sources.list $RELEASE\_$ARCH/etc/apt/sources.list
IX. Mount essential directories using
mountall.sh
script (see the end of the post):
Bash:
./mountall.sh $RELEASE\_$ARCH
X. Install common packages
Bash:
LC_ALL=C LANGUAGE=C LANG=C chroot $RELEASE\_$ARCH /bin/bash -c "apt-get update; apt-get install vim mc sudo gnupg -y; apt-get update; locale-gen en_US.UTF-8; echo \"Europe/Warsaw\" > /etc/timezone; dpkg-reconfigure -f noninteractive tzdata"
XI. Download and set GPG repository keys
Bash:
LC_ALL=C LANGUAGE=C LANG=C chroot $RELEASE\_$ARCH apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3E5C1192
XII. Update apt repository
Bash:
LC_ALL=C LANGUAGE=C LANG=C chroot $RELEASE\_$ARCH apt-get update
XIII. Enjoy debootstrap
Bash:
chroot $RELEASE\_$ARCH /bin/bash
XIV. Optional - upgrade packages
Bash:
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
apt-get update && apt-get upgrade
XV. Optional - install xfce and xrdp
First - set password for root user:
Bash:
passwd
touch ~/.Xauthority
Bash:
apt-get install xubuntu-desktop
Bash:
apt-get install xrdp
HAPPY HACKING …
APPEND - Useful scripts:
Bash:
# ====mountall.sh====
cat > mountall.sh << EOF
#!/bin/bash
if [ -z \$1 ]; then
CHROOT_PATH=ubuntu
else
CHROOT_PATH=\$1
fi
DROOT=\`pwd\`/\$CHROOT_PATH
mount -t proc proc \$DROOT/proc
mount --bind /dev \$DROOT/dev
mount -t sysfs sysfs \$DROOT/sys
mount --bind /dev/pts \$DROOT/dev/pts
EOF
chmod +x mountall.sh
# =================
Bash:
# ====first.sh====
chroot ubutu /bin/bash
apt-get update
apt-get install vim sudo gnupg -y
apt-get updatelocale-gen en_US.UTF-8
echo "Europe/Warsaw" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
exit
# =============