Reply
MattyShack
Aspirant

Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.24

###################################################################
###################################################################
### VirtualBox is available in a number of package formats native to various common Linux distributions
### Editor: Matty Shack
### Document Version: 4.3.2 (VirtualBox-4.3.2-90405)
### Publication Date: 22-November-2013
### VBox: 4.3.2
### PURPOSE: Provide instructions to install a functioning VBox on the ReadyNAS x86 running OS 4.2.x

This Guide will help you Install:
Python [2.7.6]
Php5 [5.4.21]
phpMyAdmin [4.0.9]
VirtualBox [4.3.2-90405]
phpVBoxManager [4.3-0]

# Oracle VirtualBox References:
# Home: http://www.oracle.com/technetwork/serve ... index.html
# Latest Version: http://download.virtualbox.org/virtualbox/LATEST.TXT
# User Manual: http://download.virtualbox.org/virtualb ... Manual.pdf
# SDK Ref: http://download.virtualbox.org/virtualbox/SDKRef.pdf

These Instructions can be found here: https://drive.google.com/file/d/0B1y_OP ... sp=sharing
PHPVBoxMgr_0.4-readypro-0.1.1.bin can be found here: https://drive.google.com/file/d/0B1y_OP ... sp=sharing

This is my final Update -> Mission Control: End of Mission!
Message 1 of 12
dildano
Aspirant

Re: Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.2

MattyShack, thanks for the detailed instructions. After factory resetting my Pro, I was able to get VBox up and running. I will eventually have some questions about the install, but I just wanted to thank you for the time and effort you put into this.
ReadyNAS Pro Business RNDP6000 fw 4.2.24
6 x Western Digital WD20EADS-00R6B0 fw 01.00A01
(TLER enabled, IDLE disabled)
Message 2 of 12
dildano
Aspirant

Re: Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.2

MattyShack, when I reboot my Pro, the vboxwebsrv doesn't start automatically. Or maybe it's just not starting properly. Anyway, if I simply run "vboxwebsrv -b", then everything is fine. Any tips on how to resolve this? As a side note, I do NOT have ReadyNAS Photos II installed. I'm able to install it, but I can't get the service to start. It's weird. Don't know if that has anything to do with vboxwebsrv not starting properly.
ReadyNAS Pro Business RNDP6000 fw 4.2.24
6 x Western Digital WD20EADS-00R6B0 fw 01.00A01
(TLER enabled, IDLE disabled)
Message 3 of 12
JamieSinn
Aspirant

Re: Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.2

Thank you for the great tutorial, just one problem.
the phpvboxmgr does not exist at the link you put up for the bin, is there a way to fix it?
@mattyshack
Message 4 of 12
MattyShack
Aspirant

Re: Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.2

This is my final Update -> Mission Control: End of Mission!
Message 5 of 12
dsm1212
Apprentice

Re: Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.2

MattyShack wrote:
This is my final Update -> Mission Control: End of Mission!


Moved to OS6 or ?
Message 6 of 12
dsm1212
Apprentice

Re: Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.2

Mattyshack's links to the instructions are no longer valid. If anyone has them, please pm me a copy. I need to rebuild php and I think the instructions here were slightly different than mattyshack's earlier vbox instructions which are still here in the forum. Much better to have the text in the forum than a link IMHO anyhow.

thanks
steve
Message 7 of 12
dsm1212
Apprentice

Re: Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.2

Looks like I was able to rebuild and add what I needed. I'd still like to get the full instructions back online if we can. If anyone else builds virtual box and uses ajaxplorer (now called pydio) you need gd built into php after you update to pydio. To get that you just need to rebuild php and include --with-gd on the configure command line.

steve
Message 8 of 12
chirpa
Luminary

Re: Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.2

I sent him an email, hopefully he can put it back online.
Jedi Council Alumni | See my profile About page for my ReadyNAS history (2004-2012) |
https://twitter.com/chirpah/status/852389882764840960/photo/1
Message 9 of 12
dsm1212
Apprentice

Re: Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.2

I guess mattyshack disappeared permanently. Is there any way to get the instructions back from before editted them out and moved them to google?

steve
Message 10 of 12
sander11
Aspirant

Re: Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.2

Here is a copy of the last instructions I copied from when he posted them the passage below is (c) mattyshack 2014 "the Readynas community is forever in your debt!"

Replace weblink> with http:// and weblinks> with https:// had to replace due to forum posting constraints

###################################################################
###################################################################
### VirtualBox is available in a number of package formats native to various common Linux distributions
### Editor: Matty Shack
### Document Version: 4.3.2 (VirtualBox-4.3.2-90405)
### Publication Date: 22-November-2013
### VBox: 4.3.2
### PURPOSE: Provide instructions to install a functioning VBox on the ReadyNAS x86 running OS 4.2.x

This Guide will help you Install:
Python [2.7.6]
Php5 [5.4.21]
phpMyAdmin [4.0.9]
VirtualBox [4.3.2-90405]
phpVBoxManager [4.3-0]

# Oracle VirtualBox References:
# Home: weblink>www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html
# Latest Version: weblink>download.virtualbox.org/virtualbox/LATEST.TXT
# User Manual: weblink>download.virtualbox.org/virtualbox/UserManual.pdf
# SDK Ref: weblink>download.virtualbox.org/virtualbox/SDKRef.pdf

### WARNING: There may be typos and grammar missteps. I'm no expert or even a programmer,
### but this guide includes many hours of typing, trial, error and hair loss.
### I'm sure there are better ways to express different aspects of this guide and coding,
### so please be kind as you post recommendations for fixes and improvements.

### The lines that start with a ':' indicate that you have already followed this complete guide with success,
### but want to start over and try some new changes. For example, I messed up the permissions and could not
### get anything to work without deleting VBox and starting fresh. So I only needed to follow the ':' lines
### as all other relevant steps like, compiling the kernel, had not changed. Do not type the ': '. It is only
### used as a reference to identify the correct lines to focus on if you are conducting a partial rebuild.

### If the system reports that it cannot write because you are out of space, type 'df' to check disk space and 'df -i' to check for free i-nodes.
### Disk Space: There must be space available on the file system, meaning that there are still unused data blocks.
### i-Node Metadata blocks: Whenever a file is created on a file system, an inode is used to contain information about the file.
### Most file systems have a fixed amount of inodes. The available number of inodes are set during the mkfs operation of the file system.
### The only way to fix either problem is to free space/i-nodes by deleting files in /dev/md0. Start with your /root, /tmp, and /var/log directories.

### As you know, NetGear has moved on to their new ReadyNAS line [100/300/500 series] and, I assume, will give very little support to any prior model.
### That being said, VBox may extend the life of your server and allow it to be re-purposed beyond its creators' original intent.
### I ask that others on this forum continue to lend a helping hand as they share their knowledge and experiences
### with new users.
### Thanks

### *** My READYNAS Box Setup *** ###
# System: NetGear ReadyNAS Ultra 6, 6x3~18TB, 4GB Memory
# Installed Firmware: 4.2.24 ~ RNDP6xxx_4.2.24
# Linux OS: Debian v4.0 ~ Etch
# CPU Core: Intel dual core x86 (64 bit)
# NOTE: The original ReadyNAS series does not support CPU Hardware Virtualization (Hyper-V).
# This means that many advanced OS's like Windows8 or OSX will not run from these servers.
# I have upgraded my CPU from E2160 to an Intel dual core Q6600 running @ 2.4 GHz.
# As a result, I can now run Win8Pro in a VBox VM from my ReadyNAS.
# See thread weblink>www.readynas.com/forum/viewtopic.php?f=35&t=29284

### *** Target Files: Virtual Box 4.3.2-90405 (This install uses x86_64)*** ###
# VBox Runtime Linux x64: weblink>download.virtualbox.org/virtualbox/4.3.2/VirtualBox-4.3.2-90405-Linux_amd64.run
# VBox Runtime Linux x32: weblink>download.virtualbox.org/virtualbox/4.3.2/VirtualBox-4.3.2-90405-Linux_x86.run
# VBox Guest Additions ISO: weblink>download.virtualbox.org/virtualbox/4.3.2/VBoxGuestAdditions_4.3.2.iso
# VBox Extension Pack: weblink>download.virtualbox.org/virtualbox/4.3.2/Oracle_VM_VirtualBox_Extension_Pack-4.3.2-90405.vbox-extpack
#
### *** PHP Virtual Box Manager v4.3-0 *** ###
# REF: weblink>sourceforge.net/projects/phpvirtualbox/
# Remarks: VirtualBox 4.3.x Compatible --- 4.3-0 release
# This line may not work due to move from Google Code to Sourceforge
# wget `wget -q -O - weblink>phpvirtualbox.googlecode.com/files/LATEST.txt` -O phpvirtualbox-latest.zip
# wget -U IE6 -O phpvirtualbox-latest.zip weblink>downloads.sourceforge.net/project/phpvirtualbox/phpvirtualbox-4.3-0.zip

### KEY NOTES:
# These steps were performed on a 64bit x86 ReadyNAS system that was upgraded to firmware 4.2.24
# The ReadyNAS was also freshly cleaned using the 'Factory Default' boot setting.
# Therefore, you may experience dependency errors or system conflicts that I did not have during my VBox install.
# Also, I recommend that you set your ReadyNAS to a static IP Address so that VBox Manager will always see the same host IP.
# Lastly; If you are using Ethernet Teaming, ALB will interfer with VBox.

######################################################################################
### Section A: Clean APT Repository, remove locks, and clear all cached deb files ###
######################################################################################

### Refresh Packages from the APT repository ~ may help remove BADSIG messages ###
# Clear the APT Repositories
sudo killall apt apt-get aptitude
sudo -s -H
apt-get clean
rm -rf /var/lib/apt/lists/*
chmod 755 /var/lib/apt/lists
mkdir /var/lib/apt/lists/partial
chmod 755 /var/lib/apt/lists/partial
rm -rf /var/cache/apt/archives
mkdir -p /var/cache/apt/archives/partial
apt-get clean

# Replace File Locks
rm -rf /var/lib/dpkg/lock
sudo touch /var/lib/dpkg/lock
sudo chmod 640 /var/lib/dpkg/lock
rm -rf /var/lock/aptitude
sudo touch /var/lock/aptitude
sudo chmod 640 /var/lock/aptitude
rm -rf /var/lib/apt/lists/lock
sudo touch /var/lib/apt/lists/lock
sudo chmod 640 /var/lib/apt/lists/lock
rm -rf /var/cache/apt/archives/lock
sudo touch /var/cache/apt/archives/lock
sudo chmod 640 /var/cache/apt/archives/lock

### Update Sources.list ###
mv /etc/apt/sources.list /etc/apt/sources.list.bak
rm -rf /etc/apt/sources.list
#----------------------------------------------
sudo sh -c "cat >> /etc/apt/sources.list" <<EOF
deb weblink>archive.debian.org/debian etch main contrib non-free
deb weblink>www.readynas.com/packages readynas-x86/
deb weblink>www.readynas.com/packages 4.2.24/

deb weblink>packages.dotdeb.org squeeze-php54 all
deb-src weblink>packages.dotdeb.org squeeze-php54 all
deb weblink>packages.dotdeb.org stable all
deb-src weblink>packages.dotdeb.org stable all

#deb weblink>backports.debian.org/debian-backports squeeze-backports main contrib non-free
#deb weblink>ftp.debian.org/debian squeeze main contrib non-free
#deb weblink>download.virtualbox.org/virtualbox/debian squeeze contrib non-free
EOF
#----------------------------------------------

### Install Public Keys
gpg --keyserver pgpkeys.mit.edu --recv-key AED4B06F473041FA && gpg -a --export AED4B06F473041FA | sudo apt-key add -
gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553 && gpg -a --export 8B48AD6246925553 | sudo apt-key add -
wget -q weblink>www.dotdeb.org/dotdeb.gpg -O- | sudo apt-key add -
wget -q weblink>download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -

apt-get update
apt-get --reinstall install nano curl gettext gawk sysutils

# Remove 32 Bit Kernel Modules
#rm -rf /lib/modules/2.6.37.6.RNx86_32.1.4

# Setup Build Source Area on /c/ Share
mkdir -p /c/addons-config/sysbuild/src/build
mkdir -p /c/addons-config/sysbuild/system

# want to see ***'s when entering the password at login
sudo visudo
# \-> Add: Defaults env_reset

# Allow Windows SMB network access
chown -R nobody:nogroup /c/addons-config/sysbuild

# Save Key System Files
cp /etc/apt/sources.list* /c/addons-config/sysbuild/system
cp /etc/host* /c/addons-config/sysbuild/system
cp /etc/passwd /c/addons-config/sysbuild/system
cp /etc/resolv.conf /c/addons-config/sysbuild/system
cp /etc/sudoers /c/addons-config/sysbuild/system
cp /frontview/conf/enclosure.db /c/addons-config/sysbuild/system

# Update Logger
find / -name logger
cd /usr/bin
ls -aFl logg*
mv logger logger.real
nano logger
#-------------------------------------------------------------------
#!/bin/bash

while getopts ":stSmiley Tongue:" Option
do
case ${Option} in
s | t | p ) cmdline="${cmdline} -${Option} ${OPTARG}" ;;
esac
done
shift $((${OPTIND} - 1))

busybox logger "${cmdline}" "${*}"
#-------------------------------------------------------------------

chmod +x logger
cp /usr/bin/logger /c/addons-config/sysbuild/src

### Pin APT and DPKG using the apt-get preferences file
apt-cache policy
apt-cache policy apt
apt-cache policy dpkg
apt-cache policy host
# Add the following lines to the end of the file:
#--------------------------------------------------
echo "Package: apt" >> /etc/apt/preferences
echo "Pin: version 0.7.20.2+lenny2" >> /etc/apt/preferences
echo "Pin-Priority: 1001" >> /etc/apt/preferences
echo "" >> /etc/apt/preferences
echo "Package: dpkg" >> /etc/apt/preferences
echo "Pin: version 1.14.31" >> /etc/apt/preferences
echo "Pin-Priority: 1001" >> /etc/apt/preferences
echo "" >> /etc/apt/preferences
echo "Package: host" >> /etc/apt/preferences
echo "Pin: version 20000331-9" >> /etc/apt/preferences
echo "Pin-Priority: 1001" >> /etc/apt/preferences
echo "" >> /etc/apt/preferences
#--------------------------------------------------
cat /etc/apt/preferences
cp /etc/apt/preferences /c/addons-config/sysbuild/system
apt-get -f install && apt-get autoremove && apt-get update


###########################################################
### Section B: Install VirtualBox Development Framework ###
###########################################################

# Setup the Build Environment to compile Kernel and Python
# If asked, select the [Default] setting
apt-get install \
amd64-libs \
binutils \
bison \
build-essential \
dialog \
fakeroot \
flex \
gdb \
gpp \
kernel-package \
lib64ssp0 \
lib64stdc++6 \
libbz2-dev \
libc6-amd64 \
libc6-dev-amd64 \
libcompress-zlib-perl \
libcurl4-openssl-dev \
libdb3-dev \
libgdbm-dev \
libncurses5-dev \
libpcre3-dev \
libsqlite3-dev \
libssl-dev \
libtag1-dev \
libtool \
p7zip \
p7zip-full \
par2 \
parchive \
uuid-dev \
zlib1g-dev \
zlibc

# Add local libraries so that the System can find them
cat /etc/ld.so.conf #include /etc/ld.so.conf.d/*.conf
sed -i '$d' /etc/ld.so.conf
echo "/usr/local/lib" >> /etc/ld.so.conf
echo "/usr/local/lib" > /etc/ld.so.conf.d/local_libs.conf
ldconfig -v

### Report System Data ###
# These next few lines will tell you more about your NAS
uname -r && uname -m
readelf -h $(which apt-get)|grep -E "Class|Machine"

## Full Name: 2.6.37.6.RNx86_64.2.4
## Kernel Series: 2.6.37.6
## Kernel Base: x86_64
## System Base: x86_32 (80386)

## *This means, for things other than kernel modules
## you need to install x86_32 ~ i386 binaries

### Update Selected System Files from Source ###

### Install CheckInstall from source ###
# REF: weblink>asic-linux.com.mx/~izto/checkinstall/
# Other method: fpm ~ weblinks>github.comf/jordansissel/fpm/blob/master/README.md

cd /c/addons-config/sysbuild/src/build

wget weblink>asic-linux.com.mx/~izto/checkinstall/files/deb/aaa_base_1.0-1.deb
dpkg -i aaa_base_1.0-1.deb

wget weblink>asic-linux.com.mx/~izto/checkinstall/files/source/checkinstall-1.6.2.tar.gz
tar xzvf checkinstall-1.6.2.tar.gz

cd checkinstall-1.6.2
make && make install
find / -name checkinstall

#--- Build deb package
checkinstall -D make install
# Select [y] to create docs -> choose yes (y) and enter a short summary of your package
# Package Summary: CheckInstall installations tracker, version 1.6.2
#---
cp *.deb .. && cd ..
dpkg -i ./checkinstall_1.6.2-1_i386.deb
apt-get -f install && apt-get update
#---
apt-cache policy checkinstall
checkinstall --version

## Upgrade file [5.14][5.04-5+b1 is installed] (This will also upgrade libmagic)
# weblink>freecode.com/projects/file
# The version of libmagic installed on the ReadyNAS is a limited version
# that does not support text or encoding checks, and does not define
# MAGIC_NO_CHECK_TEXT and MAGIC_NO_CHECK_ENCODING.

# Later on we will use python to link libmagic to python apps
# Make sure you link file and libmagic with python even if you already have python installed

cd /c/addons-config/sysbuild/src/build
wget ftp://ftp.astron.com/pub/file/file-5.14.tar.gz
tar zxf file-5.14.tar.gz
cd file-5.14
./configure
#---
make && make install
#--- Build deb package
checkinstall -D make install
# Select [y] to create docs -> choose yes (y) and enter a short summary of your package
# Package Summary: file [5.14] compiled from source on Debian Etch (ReadyNAS 4.2.24)
#---
cp *.deb ..
dpkg -i file_5.14-1_i386.deb
#---
apt-get -f install && apt-get update
#---
apt-cache policy file
ldconfig
file --version

## Upgrade xz-Utils [5.0.5][5.0.0 is installed]
# weblink>tukaani.org/xz
cd /c/addons-config/sysbuild/src/build
wget weblink>tukaani.org/xz/xz-5.0.5.tar.gz
tar zxf xz-5.0.5.tar.gz
cd xz-5.0.5
./configure
#---
make && make install
#--- Build deb package
checkinstall -D make install
# Select [y] to create docs -> choose yes (y) and enter a short summary of your package
# Package Summary: xz-Utils [5.0.5] compiled from source on Debian Etch (ReadyNAS 4.2.24)
#---
cp *.deb ..
dpkg -i xz_5.0.5-1_i386.deb
#---
apt-get -f install && apt-get update
#---
apt-cache policy xz
ldconfig
xz --version

## Upgrade gZxx [1.6][1.3.12 is installed]
# weblink>ftp.gnu.org/gnu/gzip
# Installs ~ gzip/gunzip/gzexe
cd /c/addons-config/sysbuild/src/build
wget weblink>ftp.gnu.org/gnu/gzip/gzip-1.6.tar.gz
tar -zxf gzip-1.6.tar.gz
cd gzip-1.6
./configure
#---
make && make install
#--- Build deb package
checkinstall -D make install
# Select [y] to create docs -> choose yes (y) and enter a short summary of your package
# Package Summary: gZxx [1.6] compiled from source on Debian Etch (ReadyNAS 4.2.24)
#---
cp *.deb ..
dpkg -i gzip_1.6-1_i386.deb
#---
apt-get -f install && apt-get update
#---
apt-cache policy gzip
gzip --version
gunzip --version
gzexe --version

## Install fuseiso-20070708 because iso mounting capability is not compiled into the ReadyNAS Kernel
## Ref: weblink>fuse.sourceforge.net
# Using fuseiso on a simple iso file. With the -p option, you do not need to create the mount point directory
# The mount point dir will be created when the iso is mounted and automatically removed when its unmounted
# mounting: fuseiso -p testimage.iso testimage_mountpoint
# unmounting: fusermount -u testimage_mountpoint

# See Chirpa's DVD ISO Guide
# REF weblink>www.readynas.com/forum/viewtopic.php?f=35&t=29874

apt-get install fuse-utils libfuse-dev libglib2.0-dev util-linux genisoimage

cd /c/addons-config/sysbuild/src/build
wget --no-check-certificate "weblinks>launchpad.net/ubuntu/+archive/primary/+files/fuseiso_20070708.orig.tar.gz"
tar zxf fuseiso_20070708.orig.tar.gz
cd fuseiso-20070708/
./configure
#---
make && make install
#--- Build deb package
checkinstall -D make install
# Select [y] to create docs -> choose yes (y) and enter a short summary of your package
# Package Summary: fuseiso_20070708 compiled from source on Debian Etch (ReadyNAS 4.2.24)
#---
cp *.deb ..
dpkg -i fuseiso_20070708-1_i386.deb
#---
apt-get -f install && apt-get update
#---
apt-cache policy fuseiso
ln -s /usr/local/bin/fuseiso /usr/bin/fuseiso
fuseiso -h
fusermount -V

# To avoid the automatic indexing of a mounted iso, add "fuse.fuseiso" to the end of the PRUNEFS="..." declaration
# This should prevent the updatedb command from indexing mounted iso directories
sed -i 's/tmpfs usbfs udf"/tmpfs usbfs udf fuse.fuseiso"/' /etc/updatedb.conf
cp /etc/updatedb.conf /c/addons-config/sysbuild/system

## Install ccd2iso [0.3]
# weblink>downloads.sourceforge.net/project/ccd2iso/

cd /c/addons-config/sysbuild/src/build
wget -U IE6 weblink>downloads.sourceforge.net/project/ccd2iso/ccd2iso/ccd2iso-0.3/ccd2iso-0.3.tar.gz
tar -zxf ccd2iso-0.3.tar.gz
cd ccd2iso-0.3
./configure
#---
make && make install
#--- Build deb package
checkinstall -D make install
# Select [y] to create docs -> choose yes (y) and enter a short summary of your package
# Package Summary: ccd2iso [0.3] compiled from source on Debian Etch (ReadyNAS 4.2.24)
#---
cp *.deb ..
dpkg -i ccd2iso_0.3-1_i386.deb
#---
apt-get -f install && apt-get update
#---
apt-cache policy ccd2iso
ccd2iso --help

## Install Other Linux ISO Utilities
# weblink>aneeska.com/2009/06/22/howto-install-extlinux-bootloader/
# weblink>shallowsky.com/linux/extlinux.html

apt-get install bsdtar syslinux mtools
find / -name extlinux
extlinux --help
Usage: extlinux [options] directory
--install -i Install over the current bootsector
--update -U Update a previous EXTLINUX installation
--zip -z Force zipdrive geometry (-H 64 -S 32)
--sectors=# -S Force the number of sectors per track
--heads=# -H Force number of heads


#######################################################################################
## OPTIONAL (NOT NEEDED) OK to SKIP
## Create Symbolic links between system files and /usr/local/bin Updates
cd /c/addons-config/sysbuild/src
rm -rf /c/addons-config/sysbuild/src/create_sym_links.sh
nano /c/addons-config/sysbuild/src/create_sym_links.sh
#----------------------------------------------
#!/bin/bash

# Title: create_sym_links.sh
# version: 1.0
# Author: Matty Shack

# Purpose: Bash script that creates symbolic links between an original and a duplicate file.
# The original file is copied to filename.bak and a symbolic link is created from the duplicate
# file to replace the original. The intent behind this script is to compile bin files from source
# and link them into the place originally held by the system file.

echo ""

# Test for arguments
if [[ $# -ne 2 ]]
then
echo "Usage: $0 Source-Location Destination-Location"
echo " Source = Directory path to Priority Files"
echo " Destination = Directory path to the location of files that will be saved"
echo " Example: $0 /usr/local/bin /usr/bin"
echo ""
exit 1
fi

echo "Source Location: $1"
echo "Destination Location: $2"
echo ""

cd $1

for file in $1/*
do
echo "Testing `basename $file`"
echo "$2/`basename $file`"
if [[ -f "$2/`basename $file`" ]]
then
echo "`basename $file` exists at both locations"
if [[ ! -f "$2/`basename $file`.bak" ]]
then
mv $2/`basename $file` $2/`basename $file`.bak
ln -s $file $2/`basename $file`
echo "`basename $file` -> Linked"
else
echo "`basename $file` is already backed up -> Skipping"
fi
else
echo "`basename $file` does NOT exist at both locations -> Skipping"
fi
echo ""
done

echo ""
echo "Process Complete!"
echo ""
#----------------------------------------------

chmod +x /c/addons-config/sysbuild/src/create_sym_links.sh

/c/addons-config/sysbuild/src/create_sym_links.sh /usr/local/bin /bin
/c/addons-config/sysbuild/src/create_sym_links.sh /usr/local/bin /usr/bin
ls /usr/local/bin
ls /bin/*.bak
ls /usr/bin/*.bak


#######################################################################################
### Remove Pinned MySQL packages from apt-get preferences
apt-cache policy
nano /etc/apt/preferences
#--------------------------------------------------
# Remove the following using <CTRL-K>

Package: libmysqlclient15off
Pin: version 5.0.32-7etch8
Pin-Priority: 1001

Package: noflushd
Pin: version 2.7.5-2.netgear18
Pin-Priority: 1001
#--------------------------------------------------

# If asked, select the [Default] setting
apt-get update && apt-get -y install noflushd

# Fix noflushd Error
# Change TIMEOUT= to TIMEOUT=30
sed 's/^TIMEOUT=/TIMEOUT=30/' /etc/default/noflushd > /etc/default/noflushd1 &&
mv /etc/default/noflushd1 /etc/default/noflushd
apt-get -f install


#######################################################################################
## Install Python [2.7.6] [skip if Python is already at this version, but be sure to connect libmagic to python]
# weblink>www.python.org/ftp/python

# For compatibility with sabnzbd/couchpotato/sickbeard, make sure your python version does not exceed sabnzbd requirements
# weblink>wiki.sabnzbd.org/install-off-modules
# So for now we will stay with Python-2.7.x series

# Get the Python source
cd /c/addons-config/sysbuild/src/build
rm -rf Python*
wget weblink>www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar -xzvf Python-2.7.6.tgz
cd Python-2.7.6
./configure
#---
make && make install
#--- Build deb package
checkinstall -D make install
# Select [y] to create docs -> choose yes (y) and enter a short summary of your package
# Package Summary: Python 2.7.6 compiled from source on Debian Etch (ReadyNAS 4.2.24)
#---
cp *.deb ..
dpkg -i python_2.7.6-1_i386.deb
#---
apt-get -f install && apt-get update
#---
apt-cache policy python
python -V

# Install python's setuptools
# REF: weblinks>pypi.python.org/pypi/setuptools
# weblinks>pypi.python.org/packages/ -> "Look for your python version then goto ../s/setuptools/ for your specific version of setuptools"

cd /c/addons-config/sysbuild/src/build
rm -rf setuptools*
wget --no-check-certificate weblinks>pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea
sh setuptools-0.6c11-py2.7.egg

# Install Python PiP
find / -name easy_install
/usr/local/bin/easy_install pip
ln -s /usr/local/bin/pip /usr/bin/pip
pip install -U pip

# Connect libmagic to python
cd /c/addons-config/sysbuild/src/build/file-5.14
cd python && python setup.py install
file --version

# Install additional python packages
pip install libmagic
pip install ipython
pip install beautifulsoup4


#######################################################################################
## Install Binwalk [1.2.2-1]
# REF: weblink>binwalk.org/
# weblinks>github.com/devttys0/binwalk

# Install Python Prerequisites for Binwalk
apt-get install libpng12-dev libfreetype6=2.2.1-5+etch4 libfreetype6-dev
pip install numpy
pip install matplotlib
apt-get -f install && apt-get update

# Get BinWalk to start Walking
cd /c/addons-config/sysbuild/src/build
wget --no-check-certificate weblinks>binwalk.googlecode.com/files/binwalk-1.2.2-1.tar.gz
tar -zxvf binwalk-1.2.2-1.tar.gz
cd binwalk-1.2.2-1/src
python setup.py install
binwalk --help

# Extract UNRAR and UNDVD from PRO-LLink AddOn using Binwalk
cd /c/addons-config/sysbuild/src/build
wget weblink>www.readynas.com/contributed/super-poussin/PRO-LLINK_3.0.bin
binwalk -re PRO-LLINK_3.0.bin
cd _PRO-LLINK_3.0.bin.extracted
tar xfz files.tgz
cd /c/addons-config/sysbuild/src/build/_PRO-LLINK_3.0.bin.extracted/usr/local/llink
mv undvd unrar /usr/local/bin
rm -rf /usr/local/sbin/undvd
ln -s /usr/local/bin/undvd /usr/local/sbin/undvd
rm -rf /usr/local/sbin/unrar
ln -s /usr/local/bin/unrar /usr/local/sbin/unrar
unrar
undvd


#######################################################################################
## Install Php5 [Currently:5.4.19-1 from weblink>packages.dotdeb.org] [skip if Php5 is already at this version]
## Solutions to common errors: weblink>www.robo47.net/text/6-PHP-Configure-und-Compile-Fehler
## Installs version: 5.4.21

# If asked, select the [Default] setting
cd /c/addons-config/sysbuild/src/build
apt-get install \
apache-dev \
apache2-prefork-dev \
automake \
byacc \
libbz2-dev \
libmcrypt-dev \
libmcrypt4 \
libmysqlclient-dev \
libmysqlclient15off=5.0.32-7etch12 \
libonig2 \
libqdbm14 \
libreadline5-dev \
libxml2=2.6.27.dfsg-6+etch1 \
libxslt1-dev \
libxslt1.1 \
libzzip-0-12 \
lsof \
mysql-common=5.0.32-7etch12 \
re2c

# Add local libraries to System
ldconfig -v

# Download, compile and install php5 from source
cd /c/addons-config/sysbuild/src/build
rm -rf php5*
apt-get source php5
cd php5-5*
cd pear
wget weblink>pear.php.net/go-pear.phar
cd ..

# Setup PHP directories
rm -rf /usr/local/php
mkdir -p /etc/php5/conf
mkdir -p /etc/php5/conf.d
mkdir -p /usr/local/php

# Link system files to support php compile
ln -s /etc/frontview/apache/httpd.conf /etc/apache2/httpd.conf
find / -name apxs*
ln -s /usr/bin/apxs /usr/sbin/apxs
ln -s /usr/bin/apxs2 /usr/sbin/apxs2
updatedb

# Compile Source Code
./configure \
--enable-mbstring \
--enable-soap \
--enable-zip \
--prefix=/etc/php5 \
--with-apxs2=/usr/sbin/apxs2 \
--with-bz2 \
--with-config-file-path=/usr/local/php \
--with-config-file-scan-dir=/etc/php5/conf \
--with-gettext \
--with-mcrypt \
--with-mhash \
--with-mysql \
--with-mysqli \
--with-readline \
--with-zlib
#---
make && make install
#--- Build deb package
checkinstall -D make install
# Select [y] to create docs -> choose yes (y) and enter a short summary of your package
# Package Summary: PHP5 [5.4.21] compiled from source on Debian Etch (ReadyNAS 4.2.24)
#---
zip ../php5-5.4.21.zip *.deb *.ini-*
cd ..
unzip php5-5.4.21.zip
dpkg -i php5_5.4.21-1_i386.deb
#---
apt-get -f install && apt-get update
#---
apt-cache policy php5

# Configure PHP5-php.ini
# Make sure Apache and Php5 are talking to each other
cp *.ini-* /etc/php5/conf
cp php.ini-production /usr/local/php/php.ini
sed -i 's/;include_path = "\.:\/usr\/share\/php"/include_path = "\/usr\/share\/php5:\/usr\/local\/php:\/usr\/local\/php\/lib\/php"/' /usr/local/php/php.ini
sed -i 's/;mysqli\.allow_local_infile = On/mysqli\.allow_local_infile = On/' /usr/local/php/php.ini
cp /usr/local/php/php.ini /c/addons-config/sysbuild/system
mkdir -p /etc/php5/apache2
rm -rf /etc/php5/apache2/php.ini
ln -s /usr/local/php/php.ini /etc/php5/apache2/php.ini
mkdir -p /etc/php5/cli
rm -rf /etc/php5/cli/php.ini
ln -s /usr/local/php/php.ini /etc/php5/cli/php.ini

# Configure PHP5-libphp5.so
find / -name libphp5.so
cp -rf /usr/lib/apache2/modules/libphp5.so /c/addons-config/sysbuild/system
cp /c/addons-config/sysbuild/system/libphp5.so /c/addons-config/sysbuild/src/build/php5-5.4.19/libs
libtool --finish /c/addons-config/sysbuild/src/build/php5-5*/libs
chmod 644 /usr/lib/apache2/modules/libphp5.so

# Configure PHP5-httpd.conf
nano /etc/frontview/apache/httpd.conf
# After the "LoadModule addonhandler_module /frontview/lib/mod_addonhandler.so"
# Look for these 3 lines - ADD any that are missing
#----------------------------------------------
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
AddType application/x-httpd-php .php
PHPIniDir /etc/php5/apache2
#----------------------------------------------
cp /etc/frontview/apache/httpd.conf /c/addons-config/sysbuild/system

# Backup Apache config
find / -name httpd.conf
cp /etc/frontview/apache/httpd.conf /c/addons-config/sysbuild/system

# Configure PHP5-Phar
/c/addons-config/sysbuild/src/build/php5-5.4.21/build/shtool install -c /c/addons-config/sysbuild/src/build/php5-5.4.21/ext/phar/phar.phar /etc/php5/bin
ln -s -f /etc/php5/bin/phar.phar /etc/php5/bin/phar

# Configure PHP5-Links
/etc/php5/bin/php -v
cd /etc/php5/bin
ln -s /etc/php5/bin/pear /usr/bin/pear
ln -s /etc/php5/bin/peardev /usr/bin/peardev
ln -s /etc/php5/bin/pecl /usr/bin/pecl
ln -s /etc/php5/bin/phar /usr/bin/phar
ln -s /etc/php5/bin/php /usr/bin/php
ln -s /etc/php5/bin/php-cgi /usr/bin/php-cgi
ln -s /etc/php5/bin/php-config /usr/bin/php-config
ln -s /etc/php5/bin/phpize /usr/bin/phpize

# Show PHP5 version
php -v

#######################################################################################
## Add missing script usually found on Debian systems

nano /etc/mysql/debian-start
#-------------------------------------------------------------------
#!/bin/bash

# This script is executed by "/etc/init.d/mysql" on every (re)start.
#
# Changes to this file will be preserved when updating the Debian package.

source /usr/share/mysql/debian-start.inc.sh

MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf"
MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
MYCHECK_PARAMS="--all-databases --fast --silent"
MYCHECK_RCPT="root"

# The following commands should be run when the server is up but in background
# where they do not block the server start and in one shell instance so that they
# run sequentially. They are supposed not to echo anything to stdout. If you want
# to disable the check for crashed tables comment "check_for_crashed_tables" out.
# (There may be no output to stdout inside the background process!)

echo "Checking for corrupt, not cleanly closed and upgrade needing tables."
(
upgrade_system_tables_if_necessary;
check_root_accounts;
check_for_crashed_tables;
) >&2 &

exit 0
#-------------------------------------------------------------------

chmod +x /etc/mysql/debian-start
ln -s /etc/mysql/my.cnf /etc/mysql/debian.cnf
cp /etc/mysql/debian-start /c/addons-config/sysbuild/system

# Reboot NAS
reboot

#######################################################################################
## Install phpMyAdmin 4.0.9 is released (Mon, 04 Nov 2013 17:30:51 GMT). [If already installed, remove your version of phpMyAdmin and follow these steps]
REF: weblink>www.phpmyadmin.net/home_page/index.php

# Who owns Apache?
egrep 'User|Group' /etc/frontview/apache/httpd.conf
#>> Results: User:admin Group:admin
grep DocumentRoot /etc/frontview/apache/httpd.conf
#>> Results: DocumentRoot /frontview/ui/resource/html

rm -rf /frontview/ui/resource/html/info.php
#----------------------------------------------
sudo sh -c "cat >> /frontview/ui/resource/html/info.php" <<EOF
<?php
phpinfo();
?>
EOF
#----------------------------------------------
chown -R admin.admin /frontview/ui/resource/html/info.php

# Restart Apache
killall apache-ssl
apache-ssl -f /etc/frontview/apache/httpd.conf

# Temp Start MySQL Service
start-stop-daemon -S -q -b -x /usr/sbin/mysqld -- \
--basedir=/usr \
--datadir=/var/lib/mysql \
--pid-file=/var/run/mysqld/mysqld.pid \
--skip-locking \
--socket=/var/run/mysqld/mysqld.sock

## Show php5 Info Page
## <Goto URL> weblinks>ReadyNAS_IP_Address/info.php

# Release additional repositories
#sed -i 's/#deb/deb/' /etc/apt/sources.list
#apt-get update

# Install phpMyadmin Prereqs for Standard Repositories
# If asked, select the [Default] setting
apt-get install \
php5-common=5.2.0+dfsg-8+etch16 \
php5-mysql=5.2.0+dfsg-8+etch16 \
libmcrypt4 \
libmysqlclient15off \
mysql-common=5.0.32-7etch12

# Install Php Soap for VBox Remote Clients that may require it
apt-get install php-pear=5.2.0+dfsg-8+etch16 php-soap
rm -rf /etc/php5/apache/php.ini
ln -s /usr/local/php/php.ini /etc/php5/apache/php.ini
rm -rf /etc/php5/apache2/php.ini
ln -s /usr/local/php/php.ini /etc/php5/apache2/php.ini
rm -rf /etc/php4/cli/php.ini
ln -s /usr/local/php/php.ini /etc/php4/cli/php.ini
rm -rf /usr/lib/apache/1.3/libphp5.so
cp -rf /usr/lib/apache2/modules/libphp5.so /usr/lib/apache/1.3/

# Download phpMyadmin
cd /c/addons-config/sysbuild/src/build
rm -rf phpMyAdmin-*
rm -rf /frontview/ui/resource/html/phpmyadmin
wget weblink>downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.9/phpMyAdmin-4.0.9-all-languages.tar.gz
tar zxf phpMyAdmin-4.0.9-all-languages.tar.gz
mv phpMyAdmin-4.0.9-all-languages /frontview/ui/resource/html/phpmyadmin
cd /frontview/ui/resource/html
ls -aFl

# Setup phpMyAdmin config
cd /frontview/ui/resource/html
chown -R admin.admin phpmyadmin/
cd phpmyadmin
mkdir config
chmod o+rw config
cp config.sample.inc.php config/config.inc.php
chmod o+w config/config.inc.php

# Restart Apache
killall apache-ssl
apache-ssl -f /etc/frontview/apache/httpd.conf

# Temp Start MySQL Service
start-stop-daemon -S -q -b -x /usr/sbin/mysqld -- \
--basedir=/usr \
--datadir=/var/lib/mysql \
--pid-file=/var/run/mysqld/mysqld.pid \
--skip-locking \
--socket=/var/run/mysqld/mysqld.sock

###
## Setup phpMyAdmin to work with MySQL by using Wizard at URL

## NOTE: If you changed the MySQL User Root password
## Log into mysql as root and set it back to nothing ~ an empty password
mysql -uroot -p
mysql> UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> \q

## > Goto URL: weblinks>ReadyNAS_IP_Address/phpmyadmin/setup/
## Click on the <New Server> Button

## Look at /etc/mysql/my.cnf
## This will help set the
## Server configuration

## Your will see "Add a new server" {Basic settings} TAB
## [SELECT] <New Server>
## "Add a new server" {Basic settings} TAB
##-------------------
## Verbose Name of Server: ReadyNAS Pro/Ultra
## Server Hostname: localhost
## Server Port: 3306
## Server Socket: /var/run/mysqld/mysqld.sock
## Connection Type: socket
## PHP Ext to use: mysql
## [x] Connect without password

## "Add a new server" {Server configuration} TAB
##-------------------
## [x] Allow root login
## [x] Allow logins without a password

##-------------------
## <save>
##-------------------

##-------------------
## <save>
##-------------------

## Look for "Configuration saved" message
## Configuration saved to file config/config.inc.php in phpMyAdmin top level directory ...
## If you don't see this message, start over

## Close Browser Window

## Move Config File
cp -rf /etc/mysql/my.cnf /etc/mysql/my.cnf.bak
cp /etc/mysql/my.cnf /c/addons-config/sysbuild/system
cd /frontview/ui/resource/html/phpmyadmin
mv config/config.inc.php .
chown -R admin.admin config.inc.php
chmod 0755 config.inc.php
chmod o-rw config.inc.php
cp -rf config.inc.php /c/addons-config/sysbuild/system
rm -rf config

# Restart Apache
killall apache-ssl
apache-ssl -f /etc/frontview/apache/httpd.conf

# Temp Start MySQL Service
start-stop-daemon -S -q -b -x /usr/sbin/mysqld -- \
--basedir=/usr \
--datadir=/var/lib/mysql \
--pid-file=/var/run/mysqld/mysqld.pid \
--skip-locking \
--socket=/var/run/mysqld/mysqld.sock

###
## Test phpMyAdmin

## > Goto URL: weblinks>ReadyNAS_IP_Address/phpmyadmin/index.php

## Username: root
## PasswordSmiley Sadempty)
## <GO>

# you should see these databases or more: information_schema, mysql, and slimserver

## Close Browser Window

########################################################################################
## NOW: Install the ReadyNAS {Photos II} addon to permanently activate the ReadyNAS MySQL Server
## Once activated, MySQL will start during boot


#######################################################################################
## Clear the Root Directory and copy files to /c/addons-config/sysbuild/root.bak
# Clear /root/src to avoid inode space issues
df && df -i
cd /root
mkdir -p /c/addons-config/sysbuild/root.bak
cp -rf * /c/addons-config/sysbuild/root.bak
rm -rf /root/*

# Create tar.xz backup to USB @ /USB_FLASH_1/
#cd /c/addons-config/sysbuild
#rm -rf /USB_FLASH_1/sysbuild.tar.xz
#tar -Jcvf /USB_FLASH_1/sysbuild.tar.xz .

# Restore tar.xz backup from USB @ /USB_FLASH_1/
#rm -rf /c/addons-config/sysbuild
#mkdir -p /c/addons-config/sysbuild
#cd /c/addons-config/sysbuild
#tar -Jxvf /USB_FLASH_1/sysbuild.tar.xz -C /c/addons-config/sysbuild


#######################################################################################
### Section C: Build and Patch the Kernel ###
#############################################
### Compile new Kernal with VBOX Modules

# The Kernel must be built on the /c/ drive to avoid space limitations
mkdir -p /c/addons-config/VirtualBox/backup

# Install Oracle Key from source
cd /c/addons-config/VirtualBox/backup
wget weblink>download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
sudo apt-key add oracle_vbox.asc
apt-get update

##################################################
### Section C1: Download the Kernel Patch Kit ###
##################################################
### Get ReadyNAS Kernel-Build-Tools [RAIDiator-x86-V4.2.24_WW_src.zip]
# weblink>www.downloads.netgear.com/files/GPL/ReadyNAS/RAIDiator-x86-V4.2.24_WW_src.zip

### Download ReadyNAS Kernel-Build-Tools
cd /c/addons-config/VirtualBox
rm -rf kernel
rm -rf /usr/src/linux*
cd /c/addons-config/VirtualBox/backup
wget weblink>www.downloads.netgear.com/files/GPL/ReadyNAS/RAIDiator-x86-V4.2.24_WW_src.zip
unzip -q RAIDiator-x86-V4.2.24_WW_src.zip "kernel/*"
mv kernel ..

#######################################################
### Section C2: Build VirtualBox Kernel Environment ###
#######################################################

## Make a copy of unmodified ReadyNAS Linux Kernel Source
cd /c/addons-config/VirtualBox/kernel/2.6.37
cp -rf linux-2.6.37.6 ./linux-2.6.37.6-original

# <> Starting Over? : Restore the copy of the unmodified ReadyNAS Linux Kernel Source you just made
# : cd /c/addons-config/VirtualBox/kernel/2.6.37 && rm -rf linux-2.6.37.6 && rm -rf /usr/src/linux* && cp -rf linux-2.6.37.6-original linux-2.6.37.6

## Apply NetGear patches to ReadyNAS 2.6.37.6 Kernel Code
: cd /c/addons-config/VirtualBox/kernel/2.6.37/linux-2.6.37.6/
: chmod +x ../netgearize_kernel.sh
: ../netgearize_kernel.sh

##########################################

## Align Kernel Tree with location of Linux Source
cd /c/addons-config/VirtualBox/kernel/2.6.37/linux-2.6.37.6
rm -rf /usr/src/linux
ln -snf `pwd` /usr/src/linux
export KERN_DIR=/usr/src/linux

## Link Linux headers to build modules properly
cd /usr/src/linux/include/linux
ln -s ../generated/autoconf.h .
ln -s ../generated/utsrelease.h .

rm -rf /usr/src/linux-headers-*/
ln -s /usr/src/linux /usr/src/linux-headers-$(uname -r)

cd /lib/modules/$(uname -r)
rm -rf build
rm -rf source
ln -s /usr/src/linux-headers-$(uname -r) source
ln -s /usr/src/linux-headers-$(uname -r) build

## Setup the Build Process for a ReadyNAS Kernel
: cd /c/addons-config/VirtualBox/kernel/2.6.37/linux-2.6.37.6
: cp arch/x86/configs/defconfig.smp .config
: make ARCH=x86_64 oldconfig
: mkdir -p /usr/src/linux/include/config
: rm -rf /usr/src/linux/include/config/auto.conf
: ln -s /usr/src/linux/.config /usr/src/linux/include/config/auto.conf
: make prepare
: make modules_prepare

## Start the Build!
: make
: make -C /lib/modules/`uname -r`/build modules


#######################################################################################
### Section D: Install VirtualBox-4.3.2-90405 ###
##################################################
### REF: weblink>download.virtualbox.org/virtualbox/
### Note: Python must be installed and working before continuing

# Download VBox Runtime and Ext Pack
: cd /c/addons-config/VirtualBox/backup
wget weblink>download.virtualbox.org/virtualbox/4.3.2/VirtualBox-4.3.2-90405-Linux_amd64.run
wget weblink>download.virtualbox.org/virtualbox/4.3.2/Oracle_VM_VirtualBox_Extension_Pack-4.3.2-90405.vbox-extpack

: chmod 755 VirtualBox-4.3.2-90405-Linux_amd64.run

## Make sure System is Clean from prior install
: cd /c/addons-config/VirtualBox/backup
: ./VirtualBox-4.3.2-90405-Linux_amd64.run uninstall
: rm -rf /opt/VirtualBox
: mkdir /opt && chown -R root:root /opt
: rm -rf /root/.VirtualBox
: rm -rf /etc/vbox
: rm -rf /home/vbox
: rm -rf /usr/src/vboxhost*
: rm -rf /var/log/vbox-*.log
: rm -rf /etc/init.d/vbox*
: rm -rf /etc/default/virtualbox
: rm -rf /usr/share/virtualbox
: rm -rf /lib/modules/`uname -r`/vbox*.ko
: rm -rf /lib/modules/`uname -r`/kernel/drivers/target/vbox*.ko

## Install VBox Runtime with source code for VBox Kernel modules
# This creates the '/opt/VirtualBox' directory and compiles VBox kernel modules
# A user's manual can be found at '/opt/VirtualBox/UserManual.pdf'
: cd /c/addons-config/VirtualBox/backup
: ./VirtualBox-4.3.2-90405-Linux_amd64.run
: modprobe -l
: dmesg | grep vbox
: nano /var/log/vbox-install.log

## Fix error while loading shared libraries: libcrypt.so.1
# Apparently, the 32-bit libcrypt.so is in the root image, but not the 64-bit one.
apt-get --reinstall install libc6-amd64
apt-get -f install && apt-get update

# Check that root owns the /opt Directory
ls -ld /opt

# Execute this line to change owner to "root"
: chown root /opt

# Install VirtualBox Extension Pack
: cd /c/addons-config/VirtualBox/backup
: /usr/bin/VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack"
: /usr/bin/VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.2-90405.vbox-extpack
: /usr/bin/VBoxManage list extpacks

# Setup default VirtualMachine folders of VBox
# I store all original downloaded VM's into backup/images (leave compressed)
# I store all downloaded VM's into importimage that I'm using in VBox (uncompressed)
# I save all VBox exported VM's into exportimage (give them to all your friends)
cd /c/addons-config/VirtualBox
mkdir -p /c/addons-config/VirtualBox/backup/images/unpacked
mkdir -p /c/addons-config/VirtualBox/VirtualMachines/importimage
mkdir /c/addons-config/VirtualBox/VirtualMachines/exportimage
mkdir /c/addons-config/VirtualBox/VirtualMachines/working

# Allow Windows SMB File Service access
chown -R nobody:nogroup /c/addons-config/VirtualBox/backup
chown -R nobody:nogroup /c/addons-config/VirtualBox/kernel
chown -R nobody:nogroup /c/addons-config/VirtualBox/VirtualMachines

# Use linked directories to put the VBox Guest Additions ISO into a location that is searched by the phpVirtualBox Manager
: ln -snf /opt/VirtualBox/additions /usr/share/virtualbox

# Compile VirtualBox kernel modules
cd /usr/src/vboxhost-4.3.2
make

# Copy VBox Modules into the directory matching your kernel release from uname -r
# If you have RAIDiator 4.2.24 installed, it should match 2.6.37.6.RNx86_64.2.4
# This should allow VBox to survive a ReadyNAS firmware upgrade as long as the kernel base version remains 2.6.37.6.RNx86_64.2.4
ls -aFl
uname -r
cp -rf *.ko /lib/modules/`uname -r`/
cp -rf *.ko /lib/modules/`uname -r`/kernel/drivers/target/

# Just to be sure everything worked, we will now force the recompilation of the VBox Kernel modules
# If there are errors, check the /var/log/vbox-install.log file to find out why the compilation failed
: sudo /etc/init.d/vboxdrv setup

### Test VBox System for Driver Install ###
# Stop VirtualBox Service
/etc/init.d/vboxdrv stop

# Start VirtualBox Service
/etc/init.d/vboxdrv restart
### End Test

## Backup Kernel Directory into a TAR file named "VBox_Linux_Kernel_2.6.37.6_ReadyNAS_4.2.24.tar"
cd /c/addons-config/VirtualBox/kernel/2.6.37/linux-2.6.37.6
cd ../ && tar -cf /c/addons-config/VirtualBox/VBox_Linux_Kernel_2.6.37.6_ReadyNAS_4.2.24.tar linux-2.6.37.6/ && cd linux-2.6.37.6/
mv /addons-config/VirtualBox/VBox_Linux_Kernel_2.6.37.6_ReadyNAS_4.2.24.tar /addons-config/VirtualBox/backup
rm -rf /c/addons-config/VirtualBox/kernel

## <> Starting Over? : Restore the Backup you just made!
#mkdir -p /c/addons-config/VirtualBox/kernel/2.6.37/
#cd /addons-config/VirtualBox/backup
#tar xf VBox_Linux_Kernel_2.6.37.6_ReadyNAS_4.2.24.tar -C ../kernel/2.6.37/


#######################################################################################
### Section E: Install phpVirtualBox and FSniper ###
####################################################
# phpVirtual Box allows you to work with your ReadyNAS VirtualBox from a web browser
# It is an open source, AJAX implementation of the VirtualBox user interface written in PHP.
# As a modern web interface, it allows you to access and control remote VirtualBox instances.
# Much of its verbage and some of its code is based on the (inactive) vboxweb project.
# phpVirtualBox was designed to allow users to administer VirtualBox in a headless environment
# - mirroring the VirtualBox GUI through its web interface.

#
### Note: PHP must be installed and working before continuing ###
#

## Six (6) Easy Steps: This will surely get you to Narnia or Never Never Land

## You should complete Steps [1 - 4]. However, Steps [5 - 6] are optional.
# Let's get this party started

## Step 1: Add user VBOX to group VBOXUSERS
addgroup vboxusers
adduser vbox --no-create-home --ingroup vboxusers

## Sample Output: You will provide a new xxx password
# Adding user `vbox' ...
# Adding new user `vbox' (1004) with group `vboxusers' ...
# Not creating home directory `/home/vbox'.
# Enter new UNIX password: xxx
# Retype new UNIX password: xxx
# passwd: password updated successfully
# Changing the user information for vbox
# Enter the new value, or press ENTER for the default
# Full Name []: vbox
# Room Number []:
# Work Phone []:
# Home Phone []:
# Other []:
# Is the information correct? [Y/n] Y

# Give User vbox ownership of Image Storage Directories
adduser vbox vboxusers
cd /c/addons-config/VirtualBox
chown vbox:vboxusers ./VirtualMachines/importimage/
chown vbox:vboxusers ./VirtualMachines/exportimage/
chown vbox:vboxusers ./VirtualMachines/working/

## Create addons-config Share using FrontView:
# FrontView: [Shares] [Add Shares] [Name: addons-config] [Description: Addons-config Share] [Apply]
# FrontView: [Share Listing] [CIFS ~ addons-config] [Advanced Options]
# Share folder owner: nobody
# Share folder group: nogroup
# Share folder owner rights: read/write
# Share folder group rights: read/write
# Share folder everyone rights: read/write
# [x] Set ownership and permission for existing files and folders in this share to the above settings.
# [x] Grant rename and delete privileges to non-owner of files.
# [Apply]

## Step 2: Install phpVBoxManager for ReadyNAS
# Download PHPVBoxMgr_0.4-readypro-0.1.1.bin
# Site: weblink>netgear.tonidoid.com/app/webshare/share/NETGEAR%20ReadyNAS%20Tech%20Documents/Add-on/x86/?vm=list

## NOTE: If PHPVBoxMgr_0.4-readypro-0.1.1.bin is missing and cannot be downloaded, no big deal. Just skip to Step 3.
cd /c/addons-config/VirtualBox/backup
wget weblink>netgear.tonidoid.com/app/webshare/share/NETGEAR%20ReadyNAS%20Tech%20Documents/Add-on/x86/PHPVBoxMgr_0.4-readypro-0.1.1.bin?action=download
mv PHPVBoxMgr_0.4-readypro-0.1.1.bin\?action\=download PHPVBoxMgr_0.4-readypro-0.1.1.bin

## Install phpVBoxManager using FrontView:
# FrontView: [Add-ons][Add New] then [Browse]: \\ReadyNAS_IP_Address\addons-config\VirtualBox\backup
# <Select>: PHPVBoxMgr_0.4-readypro-0.1.1.bin
# FrontView: [Upload and verify image..][Warning][OK] then [Install]
# FrontView: [Add-ons][Installed] -> Verify that you see PHPVBoxMgr
# Do not attempt to Edit or [Load Config] from FrontView's VirtualBox Manager

## Now, close the Browser Window and go back to the terminal screen
cp /frontview/ui/resource/html/phpvboxmgr/config.php /addons-config/VirtualBox/backup/PHPVBoxMgr_0.4-readypro-0.1.1-config.php.orig

## Step 3: Upgrade phpVBoxManager from v0.4 to v4.3-0
### *** PHP VirtualBox Manager v4.3-0 *** ###
# REF: weblink>sourceforge.net/projects/phpvirtualbox/
# Remarks: VirtualBox 4.3.x Compatible = VirtualBox Manager 4.3-0 release

## Download the Latest version of phpVBoxManager:
: cd /c/addons-config/VirtualBox/backup

rm -rf phpvirtualbox*
wget -U IE6 -O phpvirtualbox-latest.zip weblink>downloads.sourceforge.net/project/phpvirtualbox/phpvirtualbox-4.3-0.zip
unzip phpvirtualbox-latest.zip -d phpvirtualbox-4.3-0

cp /addons-config/VirtualBox/backup/phpvirtualbox-4.3-0/config.php-example /addons-config/VirtualBox/backup/phpvirtualbox-4.3-0/config.php
: rm -rf /frontview/ui/resource/html/phpvboxmgr/
: cp -rf /addons-config/VirtualBox/backup/phpvirtualbox-4.3-0 /frontview/ui/resource/html/phpvboxmgr

## Step 4: Edit PHP VirtualBox Manager Configuration File
# Location of file: /frontview/ui/resource/html/phpvboxmgr/config.php

: nano /frontview/ui/resource/html/phpvboxmgr/config.php
# >> Line 12: var $username = 'vbox'; vbox is the username you created in step 3 above
# >> Line 13: var $password = 'xxx'; where xxx is the password you created in step 3 above
# >> Line 58: var $consoleHost = 'ip.address.of.ReadyNAS'; also <remove> the '#' to activate this feature
# >> Line 175: var $enableAdvancedConfig = true; <remove> the '#' to activate this feature
# >> Line 181: var $startStopConfig = true; <remove> the '#' to activate this feature

## Step 5: Install fsniper to make life even more easier: This is Genius. Pure Genius!
# Fsniper is a directory monitor that can be used to execute predefined actions on files that enter the monitored directory.
# This can, for example, be used to monitor your downloads folder and sort downloaded files automatically into your file system.
# Unlike cron jobs or bash scripts, fsniper uses inotify to monitor file changes.
# This enables it to react immediately and efficiently to changes of the file system.
#
# Common uses include making a single drop directory and having semi-intelligent scripts figure out what to do with those files.
# More information can be found at the sources below:
# Source 1: weblink>blog.secaserver.com/2011/06/fsniper-monitor-newly-created-files-in-directory/
# Source 2: weblinks>wiki.archlinux.org/index.php/Fsniper
# Source 3: weblink>translate.google.com/translate?hl=en&sl=auto&tl=en&u=http%3A%2F%2Fwww.ruderwiki.de%2Fwiki_neu%2Findex.php%2FEfa_unter_Linux
#
# We will use fsniper to automatically make VBox the ower of image files placed in the
# /addons-config/VirtualBox/VirtualMachines/importimage directory and to automatically
# unpack files placed in the VBox backup image directory.
#
# I place all images from the iNet into the /addons-config/VirtualBox/VirtualMachines/importimage directory.
# For example, I get ClearOS VBox images from weblink>www.clearfoundation.com/Software/downloads.html
# You can also find a plethora of images from weblink>virtualboxes.org/images
#
# The "sudo sh -c" line creates the fsniper config file. Copy and past all at once into your terminal screen.
# The 'EOF' tells sh to stop reading. You may have to hit <Enter> after you pasted the code to close the file.
# All comments are placed in the fsniper log file: /root/.config/fsniper/log
# fsniper will not notice the file until it is unpacked from the tar/7z/zip/rar container.
#
# Added Bonus, VDI files are automatically compressed to make them smaller.
# Remember this will be done only once when a *.vdi file is first placed into the directory.

# Compile fsniper
cd /c/addons-config/VirtualBox/backup
rm -rf fsniper-1.3.1
wget weblink>projects.l3ib.org/fsniper/files/fsniper-1.3.1.tar.gz
tar -xzf fsniper-1.3.1.tar.gz
cd fsniper-*
sudo ./configure
sudo make

# The fsniper binary will be placed in /usr/local/bin
sudo make install
fsniper --version

# Setup the config file
killall fsniper
rm -rf /root/.config
fsniper
killall fsniper
touch /root/.config/fsniper/log
#----------------------------------------------
sudo sh -c "cat >> /root/.config/fsniper/config" <<EOF
watch {
# Let's watch My Vbox backup image directory
# Unpacked all storage containers
/addons-config/VirtualBox/backup/images {
recurse = false
# lets monitor based on file ext
*.7z {
handler = echo New 7z %% File Detected; cd /addons-config/VirtualBox/backup/images/unpacked; 7za e %%
}
*.bz2 {
handler = echo New bz2 %% File Detected; cd /addons-config/VirtualBox/backup/images/unpacked; bunzip2 -k %%
}
*.tar.gz {
handler = echo New tar.gz %% File Detected; cd /addons-config/VirtualBox/backup/images/unpacked; tar -zxvf %%
}
*.tgz {
handler = echo New tgz %% File Detected; cd /addons-config/VirtualBox/backup/images/unpacked; gunzip -c %% | tar -xvf -
}
*.rar {
handler = echo New rar %% File Detected; cd /addons-config/VirtualBox/backup/images/unpacked; unrar e %%
}
*.tar {
handler = echo New tar %% File Detected; cd /addons-config/VirtualBox/backup/images/unpacked; tar -xf %%
}
*.zip {
handler = echo New zip %% File Detected; cd /addons-config/VirtualBox/backup/images/unpacked; unzip %%
}
}
# Let's watch My Vbox backup image directory
# Move unpacked files to the vBox importimage directory
/addons-config/VirtualBox/backup/images/unpacked {
recurse = true
# lets monitor based on file ext
*.ova {
handler = echo Moving OVA %% Image File; mv %% /addons-config/VirtualBox/VirtualMachines/importimage
}
*.vdi {
handler = echo Moving VDI %% Image File; mv %% /addons-config/VirtualBox/VirtualMachines/importimage
}
*.vmdk {
handler = echo Moving VMDK %% Image File; mv %% /addons-config/VirtualBox/VirtualMachines/importimage
}
*.vhd {
handler = echo Moving VHD %% Image File; mv %% /addons-config/VirtualBox/VirtualMachines/importimage
}
*.vbox {
handler = echo Moving VBOX %% Image File; mv %% /addons-config/VirtualBox/VirtualMachines/importimage
}
*.hdd {
handler = echo Moving HDD %% Image File; mv %% /addons-config/VirtualBox/VirtualMachines/importimage
}
}
# Let's watch the VBox import image directory
# Make sure all images are owned by User VBox in group VBoxUsers
/addons-config/VirtualBox/VirtualMachines/importimage {
recurse = false
# lets monitor based on file ext
*.ova {
handler = echo New IMPORT OVA %% File Detected; chown vbox:vboxusers %%
}
*.vdi {
handler = echo New IMPORT VDI %% File Detected; chown vbox:vboxusers %%
}
*.vmdk {
handler = echo New IMPORT VMDK %% File Detected; chown vbox:vboxusers %%
}
*.vhd {
handler = echo New IMPORT VHD %% File Detected; chown vbox:vboxusers %%
}
*.vbox {
handler = echo New IMPORT VBOX %% File Detected; chown vbox:vboxusers %%
}
*.hdd {
handler = echo New IMPORT HDD %% File Detected; chown vbox:vboxusers %%
}
}
# Let's watch the VBox export image directory
# Make sure all images are owned by User nobody in group nogroup
/addons-config/VirtualBox/VirtualMachines/importimage {
recurse = false
# lets monitor based on file ext
*.ova {
handler = echo New IMPORT OVA %% File Detected; chown nobody:nogroup %%
}
*.vdi {
handler = echo New IMPORT VDI %% File Detected; chown nobody:nogroup %%
}
*.vmdk {
handler = echo New IMPORT VMDK %% File Detected; chown nobody:nogroup %%
}
*.vhd {
handler = echo New IMPORT VHD %% File Detected; chown nobody:nogroup %%
}
*.vbox {
handler = echo New IMPORT VBOX %% File Detected; chown nobody:nogroup %%
}
*.hdd {
handler = echo New IMPORT HDD %% File Detected; chown nobody:nogroup %%
}
}
# Let's watch the VBox working image directory
# Make sure all images are owned by User nobody in group nogroup
/addons-config/VirtualBox/VirtualMachines/working {
recurse = true
# lets monitor based on file ext
*.ova {
handler = echo New IMPORT OVA %% File Detected; chown vbox:vboxusers %%
}
*.vdi {
handler = echo New IMPORT VDI %% File Detected; chown vbox:vboxusers %%
}
*.vmdk {
handler = echo New IMPORT VMDK %% File Detected; chown vbox:vboxusers %%
}
*.vhd {
handler = echo New IMPORT VHD %% File Detected; chown vbox:vboxusers %%
}
*.vbox {
handler = echo New IMPORT VBOX %% File Detected; chown vbox:vboxusers %%
}
*.hdd {
handler = echo New IMPORT HDD %% File Detected; chown vbox:vboxusers %%
}
}
}
EOF
#----------------------------------------------

# Check to make sure all is well
nano /root/.config/fsniper/config

## Step 6: Install dameontools to make life even more easier
# daemontools is a collection of tools for managing UNIX/Linux services.
# Services created with daemontools will restart automatically if stopped
# Source: weblink>www.bytereef.org/howto/djb/daemontools-install.html
# Source: weblink>cr.yp.to/daemontools.html
cd /c/addons-config/VirtualBox/backup
rm -rf daemontools
mkdir daemontools && cd daemontools
wget weblink>cr.yp.to/daemontools/daemontools-0.76.tar.gz
wget weblink>smarden.org/pape/djb/manpages/daemontools-0.76-man.tar.gz
wget weblink>www.rickwidmer.com/software/netqmail-1.06.tar.gz
wget weblink>thedjbway.b0llix.net/patches/daemontools-0.76.sigq12.patch

# Install Daemontools:
# supervise, svc, svok, svscan, svscanboot, and svstat into /usr/sbin
tar xzf daemontools-0.76.tar.gz
tar xzf netqmail-1.06.tar.gz
cp netqmail-1.06/other-patches/daemontools-0.76.errno.patch .
cd admin/daemontools-0.76
patch -Np1 -i ../../daemontools-0.76.errno.patch
patch -Np1 -i ../../daemontools-0.76.sigq12.patch
package/compile
cd package

# Finalize svscanboot Setup
sed 's|/command|/usr/sbin|' boot.inittab > boot.inittab~ &&
mv -f boot.inittab~ boot.inittab &&
cd ../command &&
sed -e 's|/command:/usr/local/bin:/usr/local/sbinSmiley Indifferent|' \
-e 's|/command/svc|/usr/sbin/svc|' svscanboot > svscanboot~ &&
mv -f svscanboot~ svscanboot &&
chmod +x svscanboot &&
/bin/cp * /usr/sbin &&
cd ../package &&
cat /etc/inittab boot.inittab > /etc/inittab~ &&
mv -f /etc/inittab~ /etc/inittab &&
mkdir /service &&
telinit q

# Install Daemontools Man Pages:
apt-get install man
cd /c/addons-config/VirtualBox/backup/daemontools
tar xvzf daemontools-0.76-man.tar.gz
cd daemontools-man
gzip *.8
cp *.8.gz /usr/share/man/man8

# Install fsniper as an automatic service
# Advantage: if stopped, daemontool services automatically restart without using cron or inittab
# If the log file found at /root/.config/fsniper/log is > 2048 bytes, it is deleted and a new one started
killall fsniper supervise svscanboot
cd /
rm -rf /service
mkdir -p /service/fsniper
#-----------------------------------------------------
sudo sh -c "cat >> /service/fsniper/run" <<EOF
#!/bin/sh
export HOME=/root
find ~/.config/fsniper/log -size +2048c -delete
touch ~/.config/fsniper/log
exec /usr/local/bin/fsniper
EOF
#-----------------------------------------------------
chmod 755 /service/fsniper/run
/usr/local/bin/fsniper --daemon
killall fsniper

# Stop fsniper
svc -d /service/fsniper

# Start fsniper
svc -u /service/fsniper

# Test fsniper
ps aux | grep svs && ps aux | grep fsniper && svstat /service/fsniper

reboot

#######################################################################################
### Section F: Starting the VirtualBox ReadyNAS Server ###
###########################################################
# This is your moment of Happiness not Happyness - Can you name the movie?
# This allows VirtualBox to run as user 'vbox'

# Check that root owns the /opt Directory
ls -ld /opt

# Execute this line again if you ever get the error: "Failed to load VMMR0.r0"
: chown root /opt

# Create VBox Web User ID for VBox Web Server Daemon
: echo "VBOXWEB_USER=vbox" >> /etc/default/virtualbox
: echo "VBOXWEB_HOST=0.0.0.0" >> /etc/default/virtualbox
: echo "VBOXWEB_TIMEOUT=300" >> /etc/default/virtualbox

# Give root Permission to Start the VBox Server as user 'vbox'
: rm -rf /home/vbox
: mkdir -p /home/vbox/.VirtualBox/
: chown vbox:vboxusers /home/vbox
: chown vbox:vboxusers /home/vbox/.VirtualBox
: VBoxManage setproperty websrvauthlibrary default
: login vbox
: VBoxManage setproperty websrvauthlibrary null
: VBoxManage setproperty machinefolder "/c/addons-config/VirtualBox/VirtualMachines"
: exit

## Automatically Start Virtual Machines within VBox
# VBox will start automatically due to daemons vboxdrv and vboxweb-service
# /etc/init.d/vboxdrv loads VBox Kernel drivers into memory
# /etc/init.d/vboxweb-service starts the VBox Web Server
# This step allows VM's that are installed into VBox to start Automatically when your ReadyNAS boots

# NOTE: This is related to Step 4, line 181.
# For this to work, the VM's 'Startup Mode' must be set to 'automatic'
cp /frontview/ui/resource/html/phpvboxmgr/vboxinit /etc/init.d
: chmod u+rx /etc/init.d/vboxinit
: sudo chown root /etc/init.d/vboxinit
update-rc.d vboxinit defaults

# Sample Output:
# >> Adding system startup for /etc/init.d/vboxinit ...
# >> /etc/rc0.d/K20vboxinit -> ../init.d/vboxinit
# >> /etc/rc1.d/K20vboxinit -> ../init.d/vboxinit
# >> /etc/rc6.d/K20vboxinit -> ../init.d/vboxinit
# >> /etc/rc2.d/S20vboxinit -> ../init.d/vboxinit
# >> /etc/rc3.d/S20vboxinit -> ../init.d/vboxinit
# >> /etc/rc4.d/S20vboxinit -> ../init.d/vboxinit
# >> /etc/rc5.d/S20vboxinit -> ../init.d/vboxinit

######################################
##*** Start your VBox Engine ***##
######################################
# VBox does not use the ReadyNAS Apache Web Server
# The VBox Web Server runs on port 18083.
# It allows you to access the PHP VBox Manager from a web browser

## Start VBox Driver Service ##
: /etc/init.d/vboxdrv restart

## Start VBox Web Server ##
: /etc/init.d/vboxweb-service restart

## Here are some ways to Check on the VBox Web Server that is running on port 18083
netstat -an|grep 18083
# >> # tcp 0 0 127.0.0.1:18083 0.0.0.0:* LISTEN
netstat -lpn | grep 18083
# >> # tcp 0 0 127.0.0.1:18083 0.0.0.0:* LISTEN 17344/vboxwebsrv
# The 17344 represents the PID of the process that owns port 18083

ps axfu | grep 17344
# >> # vbox 17344 0.2 0.2 200476 10476 ? Sl 10:34 0:50 /opt/VirtualBox/vboxwebsrv --background
# We know that VBox's web server was started by /etc/init.d/vboxweb-service start or restart
# However, did you know that it actually issued this command "/opt/VirtualBox/vboxwebsrv --background"

# Easiest way to show VBox Server Info
/etc/init.d/vboxweb-service status
/etc/init.d/vboxdrv status
vboxwebsrv -b

## Start the "Automatically Start Virtual Machines" Service
# Fix corrupted vboxinit
: dos2unix /etc/init.d/vboxinit
: /etc/init.d/vboxinit restart
: chown root /opt
: apt-get -f install && apt-get update

## [Reboot] ReadyNAS
reboot

## NOW: Access VirtualBox Manager from: weblink>IP_of_your_ReadyNAS_Box/phpvboxmgr
# 1. Login as User 'admin' using the PHP VirtualBox Manager with an ID/PW of admin/admin
# 2. GOTO: [File] -> [Preferences] -> [Users] to add User 'vbox' as an (Admin User)
# 3. Logout and log back in as User 'vbox'
# 4. [Delete] User 'admin'

# Now that you are logged in as User 'vbox', deactivate the login security dialog box
# Location of file: /frontview/ui/resource/html/phpvboxmgr/config.php
: nano /frontview/ui/resource/html/phpvboxmgr/config.php
# >> Line 55: var $noAuth = true; <remove> the '#' to activate this feature which removes login requirements

# If you installed fsniper, check to make sure it is running
ps -ef | grep svscan && ps -ef | grep supervise

# Sample Output:
#root 3495 1 0 19:24 ? 00:00:00 /bin/sh /usr/sbin/svscanboot
#root 3497 3495 0 19:24 ? 00:00:00 svscan /service
#root 3499 3497 0 19:24 ? 00:00:00 supervise fsniper

## Change the default VirtualMachine folder of VBox
# First, from the command line:
: login vbox
: VBoxManage setproperty machinefolder "/c/addons-config/VirtualBox/VirtualMachines/working"
: exit

# Second, using phpVBoxManager:
: Access: weblink>IP_of_your_ReadyNAS_Box/phpvboxmgr/
: Check this just to be sure: [Preferences] -> [General] -> [Default Machine Folder]: /c/addons-config/VirtualBox/VirtualMachines/working

# If everything worked, you should have a smile on your faceSmiley Happy
# VBox will start automaticall when you boot.
# You can also manually start the VBox Web Server using '/opt/VirtualBox/vboxwebsrv'
# I run it this way to trouble-shoot vbox permission issues.

## Example: How to create a Ubuntu VM from the command line
# Stats: Ubuntu 13.04 (Raring Ringtail) Server with 512MB memory and a 10GB hard drive from the Ubuntu Server iso image
# REF: weblink>releases.ubuntu.com/
# If you are interested in the Ubuntu Edge Cell Phone kickstarter, goto: weblink>igg.me/at/ubuntuedge/x/4048109
cd /addons-config/VirtualBox/backup/images
wget weblink>releases.ubuntu.com/raring/ubuntu-13.04-desktop-amd64.iso
wget weblink>releases.ubuntu.com/raring/ubuntu-13.04-server-amd64.iso

# NOTE: When using VBoxManage from the command line, you must do it as user vbox
# If you do not create the VM as user vbox, it will be "invisible" and cannot be controlled by phpVBoxManager
# If you create VM's using phpVBoxManager, you are automatically doing it as user vbox.
login vbox
VBoxManage createvm --name "Ubuntu 13.04 Server" --ostype "Ubuntu_64" --register
VBoxManage modifyvm "Ubuntu 13.04 Server" --memory 512 --vram 12 --ioapic on --boot1 dvd --boot2 disk --boot3 none --boot4 none
VBoxManage modifyvm "Ubuntu 13.04 Server" --nic1 bridged --bridgeadapter1 eth0
VBoxManage createhd --filename "/c/addons-config/VirtualBox/VirtualMachines/working/Ubuntu 13.04 Server/Ubuntu_13_04_Server.vdi" --size 10000
VBoxManage storagectl "Ubuntu 13.04 Server" --name "IDE Controller" --add ide
VBoxManage storageattach "Ubuntu 13.04 Server" --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium /addons-config/VirtualBox/backup/images/ubuntu-13.04-server-amd64.iso
VBoxManage storagectl "Ubuntu 13.04 Server" --name "SATA Controller" --add sata --controller IntelAHCI
VBoxManage storageattach "Ubuntu 13.04 Server" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "/c/addons-config/VirtualBox/VirtualMachines/working/Ubuntu 13.04 Server/Ubuntu_13_04_Server.vdi"
exit

# Did you know that you can assign an iSCSI device as the attached VM Storage?
# REF1: weblink>scarygliders.net/2011/11/04/virtualbox-and-iscsi-nas-how-to-linux-windows
# REF2: weblink>www.thecus.com/download/howtoguide/HowtoConnecttoaniSCSITargetUsingWindows.pdf

#######################################################################################
Virtual Machine Ideas:
1. ClearOS Firewall (Great due to 2x Ethernet ports: weblink>www.clearcenter.com/Software/clearos-professional-downloads.html)
> although written for IPCop in a VM, this related discussion may help with ip/port setup and configuration ( weblink>greenpossum.awardspace.com/ipcop-in-vbox.html)
2. Music Brainz Server: weblink>musicbrainz.org/doc/MusicBrainz_Server/Setup
> Network Settings:Bridged Adapter, eth0, Intel PRO/1000 MT Desktop
> username: musicbrainz password: musicbrainz
> sudo ~/run_replication.sh
> ifconfig | grep eth0 -A 1
> ~/run_server.sh
> Access: weblink>current.ReadyNAS.ip.address:5000
3. Kolab Server 3.0 via CentOS VM: weblink>bmts.us/wiki/doku.php?id=article:kolab:centos && weblink>kolab.org/get-kolab
4. Android 4.x:
a. weblink>www.androidjuegosfull.com/how-to-install-android-in-virtualbox/aplicaciones-android
b. weblink>www.maketecheasier.com/run-android-4-3-in-virtualbox/2013/08/02?utm_source=facebook
5. ChromimumOS (weblink>chromeos.hexxeh.net/)
> Instructions @ weblink>www.androidauthority.com/howto-test-drive-chrome-os-features-the-chromium-way-155084/
6. Amahi Server 7, Ubuntu 12.04 (weblink>www.amahi.org/)
> for Ubuntu 12.04 build a VM (weblink>blog.coolaj86.com/articles/how-to-install-ubuntu-in-virtualbox.html)
> and follow this process (weblink>docs.amahi.org/ubuntu-12.html)
7. Synology DSM 4.1 (weblink>xpenology.com/forum/viewtopic.php?f=2&t=3&sid=c766ced785bd2610629e8b24bddd3d45)
8. Windows 8 (weblink>www.youtube.com/watch?v=u5rk4E-5yVU)
#######################################################################################

End of Mission!
Message 11 of 12
dsm1212
Apprentice

Re: Update: Running VirtualBox VM host on ReadyNAS Pro 4.2.2

Thanks Sander!
Message 12 of 12
Top Contributors
Discussion stats
  • 11 replies
  • 8344 views
  • 0 kudos
  • 6 in conversation
Announcements