NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
chirpa
Mar 07, 2009Luminary
Running VirtualBox VM host on ReadyNAS Pro
What is VirtualBox?
So, I got bored while laundry was going... and decided to see how well a virtual OS would run on the Pro. My first choice of VM was VirtualBox, just cause I'm familiar with it after using it for ages, plus its open and free :) Eventually, I may look into VMWare as well.
After a bit of messing around, got it installed. Since the system is based off of Debian, was easy to get VirtualBox itself there (deb package). The trickiest part was getting the kernel modules required installed (see end of post).
In the end, I've got Windows 2003 R2 running on my Pro, interacting with it via RDP, and I am happy with the performance. I've added an extra 1GB memory (for a total of 2GB). I assigned 1GB of ram to my virtual OS, which still leaves the default configuration of 1GB for the NAS itself (which is more than enough still, 800MB+ is always cached).
I made a 10GB virtual disk to install the OS on. If I need more space later for extra applications, I can just add another virtual drive to that installation. And since I always like a bit extra security, I went a bit beyond the usual, and also have TrueCrypt running full disk encryption in the virtual OS. So no one can even boot and read the data in that OS without my bootup password.
I don't really have any screenshots to show, just a standard Windows installation. Here is a few of the steps I used while creating the VM on the console:
VirtualBox 3.1 has changed the CLI configuration. Until I update this how-to, please reference this: http://www.uhleeka.com/blog/2009/12/vir ... 9-04-host/
With the OS booted up and just sitting at the desktop, top reports:
Ad-hoc installation of VirtualBox. Should work for RAIDiator 4.2.4. Download links for the kernel modules, for those who don't want to go through the mess of compiling them.
So, I got bored while laundry was going... and decided to see how well a virtual OS would run on the Pro. My first choice of VM was VirtualBox, just cause I'm familiar with it after using it for ages, plus its open and free :) Eventually, I may look into VMWare as well.
After a bit of messing around, got it installed. Since the system is based off of Debian, was easy to get VirtualBox itself there (deb package). The trickiest part was getting the kernel modules required installed (see end of post).
In the end, I've got Windows 2003 R2 running on my Pro, interacting with it via RDP, and I am happy with the performance. I've added an extra 1GB memory (for a total of 2GB). I assigned 1GB of ram to my virtual OS, which still leaves the default configuration of 1GB for the NAS itself (which is more than enough still, 800MB+ is always cached).
I made a 10GB virtual disk to install the OS on. If I need more space later for extra applications, I can just add another virtual drive to that installation. And since I always like a bit extra security, I went a bit beyond the usual, and also have TrueCrypt running full disk encryption in the virtual OS. So no one can even boot and read the data in that OS without my bootup password.
I don't really have any screenshots to show, just a standard Windows installation. Here is a few of the steps I used while creating the VM on the console:
VirtualBox 3.1 has changed the CLI configuration. Until I update this how-to, please reference this: http://www.uhleeka.com/blog/2009/12/vir ... 9-04-host/
# Creating the Virtual Machine.
$ VBoxManage createvm -name "Windows2003" -register
$ VBoxManage modifyvm "Windows2003" -memory "1024MB" -acpi on -boot1 dvd -nic1 nat
$ VBoxManage createvdi -filename "/c/backup/VirtualBox/Windows2003.vdi" -size 10000 -register
$ VBoxManage modifyvm "Windows2003" -hda "/c/backup/VirtualBox/Windows2003.vdi"
$ VBoxManage registerimage dvd /c/backup/VirtualBox/Windows2003Ent.iso
$ VBoxManage modifyvm "Windows2003" -dvd /c/backup/VirtualBox/Windows2003Ent.iso
$ VBoxHeadless -startvm "Windows2003" &
# Connected via Remote Desktop at this point.
# After the installation, first page requires Ctrl-Alt-Del, so I sent the keycodes.
$ VBoxManage controlvm "Windows2003" keyboardputscancode 1d 38 53
# System is up and running, time to install GuestAdditions for better video, etc.
$ wget http://download.virtualbox.org/virtualbox/2.2.2/VBoxGuestAdditions_2.2.2.iso
$ VBoxManage registerimage dvd /c/backup/VirtualBox/VBoxGuestAdditions_2.2.2.iso
$ VBoxManage controlvm "Windows2003" dvdattach /c/backup/VirtualBox/VBoxGuestAdditions_2.2.2.iso
With the OS booted up and just sitting at the desktop, top reports:
top - 16:17:10 up 1 day, 17:58, 1 user, load average: 0.00, 0.01, 0.00
Tasks: 93 total, 1 running, 92 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.7%us, 0.2%sy, 0.0%ni, 99.2%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 2072432k total, 2020100k used, 52332k free, 6120k buffers
Swap: 1048536k total, 144k used, 1048392k free, 784620k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
10297 root 20 0 1104m 1.0g 4720 S 4 52.5 57:31.53 VBoxHeadless
12792 root 20 0 46092 9520 1720 S 1 0.5 59:54.51 motion
12196 root 20 0 9196 7688 980 S 0 0.4 0:57.72 wastesrv
1 root 20 0 1948 600 508 S 0 0.0 0:01.30 init
Ad-hoc installation of VirtualBox. Should work for RAIDiator 4.2.4. Download links for the kernel modules, for those who don't want to go through the mess of compiling them.
$ mkdir /lib/modules/`uname -r`/miscOr, if you want to compile the kernel modules yourself:
$ cd /lib/modules/`uname -r`/misc
$ wget http://www.readynas.com/contributed/chirpa/modules/virtualbox/pro/vboxdrv.ko
$ wget http://www.readynas.com/contributed/chirpa/modules/virtualbox/pro/vboxnetflt.ko
$ echo "deb http://download.virtualbox.org/virtualbox/debian etch non-free" >> /etc/apt/sources.list
$ wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | apt-key add -
$ apt-get update
$ apt-get install virtualbox-2.1
$ /etc/init.d/vboxdrv start
envyious:/c/backup# echo "deb http://download.virtualbox.org/virtualbox/debian etch non-free" >> /etc/apt/sources.listInstall of VirtualBox 2.2.2, before Sun updates the Debian Repository...
envyious:/c/backup# wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | apt-key add -
envyious:/c/backup# apt-get update && apt-get install build-essential
...
Setting up build-essential (11.3) ...
envyious:/c/backup# wget -q http://www.readynas.com/download/GPL/RNDP6xxx_4.2.4_WW_src.zip
envyious:/c/backup# unzip -q RNDP6xxx_4.2.4_WW_src.zip -d ./GPL
envyious:/c/backup# cd GPL/linux-x86-2.6/
envyious:/c/backup/GPL/linux-x86-2.6# make && make prepare
...
envyious:/c/backup/GPL/linux-x86-2.6# ln -s /c/backup/GPL/linux-x86-2.6/ /usr/src/linux
envyious:/c/backup/GPL/linux-x86-2.6# KERN_DIR=/usr/src/linux
envyious:/c/backup/GPL/linux-x86-2.6# apt-get install virtualbox-2.1
...
Setting up virtualbox-2.1 (2.1.4-42893_Debian_etch) ...
Adding group `vboxusers' (GID 101) ...
Done.
Messages emitted during module compilation will be logged to /var/log/vbox-install.log.
Success!
Starting VirtualBox kernel module: done.
envyious:/c/backup/GPL/linux-x86-2.6# cd
envyious:/c/backup/GPL/linux-x86-2.6# VBoxManage list vms
VirtualBox Command Line Management Interface Version 2.1.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
# wget -q http://www.readynas.com/download/GPL/RNDP6xxx_4.2.4_WW_src.zip
# unzip -q RNDP6xxx_4.2.4_WW_src.zip -d ./GPL
# cd GPL/linux-x86-2.6/
# make && make prepare
# ln -s /c/backup/GPL/linux-x86-2.6/ /usr/src/linux
# export KERN_DIR=/usr/src/linux
# apt-get install libfontconfig1 libglib2.0-0 libice6 libsdl1.2debian libsm6 libx11-6 libxcursor1 libxext6 libxi6 libxmu6 libxrandr2 libxrender1 libxslt1.1 libxt6 python2.4
# wget -q http://download.virtualbox.org/virtualbox/2.2.2/virtualbox-2.2_2.2.2-46594_Debian_etch_i386.deb
# dpkg -i virtualbox-2.2_2.2.2-46594_Debian_etch_i386.deb
Setting up virtualbox-2.2 (2.2.2-46594_Debian_etch) ...
Recompiling VirtualBox kernel module: done.
Starting VirtualBox kernel module: done.
441 Replies
Replies have been turned off for this discussion
- dsm1212ApprenticeOh wait, I had skipped a couple of steps with colon's because I thought they were not needed. I had not really updated to the latest phpvboxmr version. I'm past that message but now it is reporting that it's not logged in. Will recheck passwords next...
steve - The colons are the steps you should repeat because you are starting over for some reason. Optional parts are commented as remarks.
- dsm1212ApprenticeOk, I'm in but it required admin/admin even though I put different strings in config.php. You mentioned the same thing happened to you. When did it switch? I've logged out and in but it still wants admin/admin.
thanks!!
steve - Don't know why, but follow the instructions using VBox manager to add the vbox user, then delete admin. Make sure you give it admin rights.
# The user was 'admin' not 'vbox'. I then used [File] -> [Preferences] -> [Users] to add User 'vbox' as an (Admin User).
# At this point, you should logout and log back in as User 'vbox' and [Delete] User 'admin'. - dsm1212ApprenticeVery nice. Most things are working. One typo in the instructions. Where you have the command to softlink the httpd.conf you need to include the path to the source file. Only other thing I can't figure out is how the heck the fsniper config ever worked for you. As far as i can tell it really doesn't handle having two targets for the same directory. If I drop a .7z file into backup/images it gets unpacked, but the output .vdi file never gets moved. So I created a backup/downloads and changed the directory name on the first rule. I also had to change some of the uncompress commands to specify an output directory. After that it works fine. Should come in handy for other things.
Some ubuntu server tips: If you use an ubuntu image from the internet you need to get the vbox mac address to match what is in /etc/udev/rules.d/70-persistent-net.rules or you won't have a network. Also, if your keyboard doesn't match what was configured in the ubuntu image find the hyphen :-) and use "sudo dpkg-reconfigure console-setup" to get it corrected.
Two minor problems. For some reason I can't do an ACPI shutdown. I get an error in the phpvboxconnector script. Second thing is that I need to figure out how to get the ubuntu/vbox network set up correctly. I've only tried nat and that doesn't leave inbound connections as far as I can tell, but I think that is expected.
thanks MattyShack!!!!
steve - Steve,
Thanks for the feedback and Ubuntu tips. Based on your comments, I started testing fsniper and realized that I did not test fsniper after incorporating the use of Daemontools. My first versions of this guide did not use Daemontools. It appears that all of the extractions are being placed in /service/fsniper. Apparently, Daemontools changes fsniper's working location.
httpd.conf is linked in the same directory, so source and destination are the same and no path is needed.
Whether or not a VM shuts down properly using ACPI is usually the fault of the VM. VBox sends an ACPI signal to the VM using the same process that generates an interrupt when you press the power button. I have found that ACPI binary modules, specifically DSDT.dat code, does not work as planned when run inside of a VM. As a matter of fact, the only VM that I'm using that seems to shut down properly using ACPI is Windows8Pro. I know that using phpvboxmanager to shut down a VM is a point of convenience and peace of mind over using the "Power Off" option. You can always use the console viewer or web portal [if one is available] to shut down from inside the VM.
Thanks,
Matt - dsm1212ApprenticeAh, regarding httpd.conf, I skipped the php section because I already had it installed, but the links and whatnot to fix up /etc/apache2 were in there. I went back and cleaned that up, but you might want to move those out of the php install or highlight them as steps to take if you already have it. Thanks again!
steve - ###################################################################
### VirtualBox is available in a number of package formats native to various common Linux distributions
### Editor: Matty Shack
### Document Version: 2.10 (VirtualBox-4.2.10-84104)
### Date: 21 March 2013
### VBox: 4.2.10
### PURPOSE: Provide instructions to install a functioning VBox on the ReadyNAS x86
# Oracle VirtualBox References:
# Home: http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html
# Latest Version: http://download.virtualbox.org/virtualbox/LATEST.TXT
# User Manual: http://download.virtualbox.org/virtualbox/UserManual.pdf
# SDK Ref: http://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 others have voiced, NetGear does not appear to be interested in the ReadyNAS line anymore.
### 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.22 ~ RNDP6xxx_4.2.22
# Linux OS: Debian v4.0 ~ Etch
# CPU Core: Intel dual core x86 (64 bit)
# NOTE: Based on the stock ReadyNAS CPU, it does not support Hardware Virtualization (Hyper-V).
# This means that many advanced OS's like Windows8 or OSX will not run from these servers.
# However, I've upgraded my CPU from E2160 to E7600. I can now run Win8Pro in a VBox VM.
# See thread http://www.readynas.com/forum/viewtopic.php?f=35&t=29284
### *** Target Files: Virtual Box 4.2.10-84104 (This install uses x86_64)*** ###
# VBox Runtime Linux x64: http://download.virtualbox.org/virtualbox/4.2.10/VirtualBox-4.2.10-84104-Linux_amd64.run
# VBox Runtime Linux x32: http://download.virtualbox.org/virtualbox/4.2.10/VirtualBox-4.2.10-84104-Linux_x86.run
# VBox Guest Additions ISO: http://download.virtualbox.org/virtualbox/4.2.10/VBoxGuestAdditions_4.2.10.iso
# VBox Extension Pack: http://download.virtualbox.org/virtualbox/4.2.10/Oracle_VM_VirtualBox_Extension_Pack-4.2.10-84104.vbox-extpack
#
### PHP Virtual Box Manager v4.2-4
# REF: http://code.google.com/p/phpvirtualbox/
# Remarks: VirtualBox 4.2.x Compatible --- 4.2-4 release
# wget `wget -q -O - http://phpvirtualbox.googlecode.com/files/LATEST.txt` -O phpvirtualbox-latest.zip
# http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.2-4.zip
# NOTE: These steps were performed on a system after a 'Factory Default' was performed. Therefore, you may experience conflicts that I did not have during my VBox travels.
######################################################################################
### Section A: Clean APT Repository, remove locks, and clear all cached deb files
######################################################################################
### 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 http://www.readynas.com/packages readynas-x86/
deb http://www.readynas.com/packages 4.2.21/
deb http://www.readynas.com/packages 4.2.22/
deb http://archive.debian.org/debian etch main
deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all
deb http://php53.dotdeb.org stable all
deb-src http://php53.dotdeb.org stable all
#deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free
#deb http://backports.debian.org/debian-backports squeeze-backports main contrib non-free
EOF
#----------------------------------------------gpg --keyserver pgpkeys.mit.edu --recv-key E9C74FEEA2098A6E && gpg -a --export E9C74FEEA2098A6E | sudo apt-key add -
gpg --keyserver pgpkeys.mit.edu --recv-key 54422A4B98AB5139 && gpg -a --export 54422A4B98AB5139 | sudo apt-key add -
gpg --keyserver pgpkeys.mit.edu --recv-key AED4B06F473041FA && gpg -a --export AED4B06F473041FA | sudo apt-key add -
# Setup Root Directory Source Area
mkdir /root/src
mkdir /root/system
# Save Key System Files
cp /etc/apt/sources.list* /root/system
cp /etc/host* /root/system
cp /etc/resolv.conf /root/system
cp /etc/passwd /root/system
cp /etc/sudoers /root/system
cp /frontview/conf/enclosure.db /root/system
### 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
# Freshen up APT Repository Packages
# Say [Y/n] 'y'es to continue.
apt-get update
# Install Basic apps
apt-get install nano curl gettext gawk noflushd dpkg-dev
# Fix noflushd
# This changes TIMEOUT from empty to =30
sed 's/^TIMEOUT=/TIMEOUT=30/' /etc/default/noflushd > /etc/default/noflushd1 \
&& mv /etc/default/noflushd1 /etc/default/noflushd
apt-get -f install && apt-get update
###########################################################
### Section B: Install VirtualBox Development Framework
###########################################################
# Setup the Build Environmentapt-get install build-essential libncurses5-dev libtag1-dev libssl-dev zlibc &&
apt-get install libpcre3-dev libcurl4-openssl-dev &&
apt-get install gdb uuid-dev amd64-libs lib64stdc++6 &&
apt-get install par2 parchive bzip2 gpp p7zip p7zip-full &&
apt-get install git kernel-package fakeroot
### Report System Data ###
uname -r && uname -m
## Full Name: 2.6.37.6.RNx86_64.2.4
## Kernel Series: 2.6.37.6
## Kernel Base: x86_64
## but, system is based on x86_32 (80386)
readelf -h $(which apt-get)|grep -E "Class|Machine"
## This means, for things other than kernel modules
## you need to install x86, 32 bit binaries
# Display HD Raid Device Info
mdadm --misc -D /dev/md0
sudo lvdisplay
mount
# Add local libraries to Systemcat /etc/ld.so.conf
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
## Install file [5.12] (upgrades libmagic)
# http://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 installedcd /root/src
wget ftp://ftp.astron.com/pub/file/file-5.12.tar.gz
tar zxf file-5.12.tar.gz
cd file-5.12
./configure
make && make install
mv /usr/bin/file /usr/bin/file.bak
ln -s /usr/local/bin/file /usr/bin/file
echo "/usr/local/lib" > /etc/ld.so.conf.d/magic.conf
ldconfig
file --version
## Install xz-Utils [5.0.4]cd /root/src
wget http://tukaani.org/xz/xz-5.0.4.tar.gz
tar zxf xz-5.0.4.tar.gz
cd xz-5.0.4
./configure
make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/lzma.conf
ldconfig
xz --version
## Update gZxx [1.5] [1.3.12 is installed]
# Installs ~ gzip/gunzip/gzexecd /root/src
wget http://ftp.gnu.org/gnu/gzip/gzip-1.5.tar.gz
tar -zxf gzip-1.5.tar.gz
cd gzip-1.5
./configure
make && make install
mv /bin/gzip /bin/gzip.bak
ln -s /usr/local/bin/gzip /bin/gzip
mv /bin/gunzip /bin/gunzip.bak
ln -s /usr/local/bin/gunzip /bin/gunzip
mv /bin/gzexe /bin/gzexe.bak
ln -s /usr/local/bin/gzexe /bin/gzexe
gzip --version
gunzip --version
gzexe --version
## Update Bash [4.2] [3.1.17 is installed]cd /root/src
wget http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz
tar -zxf bash-4.2.tar.gz
cd bash-4.2
./configure
make && make install
mv /bin/bash /bin/bash.bak
ln -s /usr/local/bin/bash /bin/bash
bash --version
## Install fuseiso because iso capability is not compiled into ReadyNAS Kernel
# 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_mountpointapt-get install build-essential fuse-utils libfuse-dev libglib2.0-dev
cd /root/src
wget --no-check-certificate "https://launchpad.net/ubuntu/+archive/primary/+files/fuseiso_20070708.orig.tar.gz"
tar zxf fuseiso_20070708.orig.tar.gz
cd fuseiso-20070708/
./configure
make install
fuseiso -h
fusermount -h
# To avoid the automatic indexing of a mounted iso add "fuse.fuseiso" to the end of the PRUNEFS="..." declaration
# This should prevent the updatedb/locate database from indexing mounted iso files
nano /etc/updatedb.conf
>> Line 7: PRUNEFS="NFS nfs nfs4 afs binfmt_misc proc smbfs autofs iso9660 ncpfs coda devpts ftpfs devfs mfs shfs sysfs cifs lustre_lite tmpfs usbfs udf fuse.fuseiso"
## Update Loggercd /usr/bin
nano logger
ls -aFl logg*
mv logger logger.real
#-------------------------------------------------------------------#!/bin/bash
while getopts ":st:p:" Option
do
case ${Option} in
s | t | p ) cmdline="${cmdline} -${Option} ${OPTARG}" ;;
esac
done
shift $((${OPTIND} - 1))
busybox logger "${cmdline}" "${*}"
#-------------------------------------------------------------------chmod +x logger
apt-get update
## Replace 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 0chmod +x /etc/mysql/debian-start
ln -s /etc/mysql/my.cnf /etc/mysql/debian.cnf
#######################################################################################
## Install Python [2.7.3] [skip if Python is already installed, but be sure to connect libmagic]
# For compatibility, make sure your python version does not exceed sabnzbd/couchpotato/sickbeard requirementscd /root/src
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar xzf Python-2.7.3.tgz
cd Python-2.7.3
./configure
make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/python.conf
ldconfig
# Install Python setuptools
cd /root/src
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
python -V
# Connect libmagic to python [5.12]
cd /root/src/file-5.12
cd python && python setup.py install
file --version
# Install Python PiP + beautifulsoup utility
/usr/local/bin/easy_install pip
ln -s /usr/local/bin/pip /usr/bin/pip
pip install -U pip
pip install beautifulsoup4
pip install libmagic
#######################################################################################
## Link Apache2 to Frontviewrm -rf /etc/apache
ln -s /etc/frontview/apache /etc/apache
cp -rf /etc/apache2/* /etc/frontview/apache
rm -rf /etc/apache2
ln -s /etc/frontview/apache /etc/apache2
ln -s /etc/frontview/apache /usr/local/apache2
ln -s /etc/frontview/apache/httpd.conf /etc/frontview/apache2.conf
ln -s /etc/frontview/apache/httpd.conf /etc/frontview/apache/apache2.conf
#######################################################################################
## Install Php5 [5.3.22] [skip if Php5 is already installed]apt-get install byacc automake libtool re2c flex bison &&
apt-get install apache-dev apache2-prefork-dev libbz2-dev libmcrypt-dev &&
apt-get install libmysqlclient-dev libmysqlclient18 mysql-common=5.5.30-1~dotdeb.0 &&
apt-get install libxml2=2.6.27.dfsg-6+etch1 &&
apt-get install libxslt-dev
ln -s /usr/bin/apxs /usr/sbin/apxs
ln -s /usr/bin/apxs2 /usr/sbin/apxs2
updatedb
cd /root/src
rm -rf php5*
apt-get source php5
cd php5-5*
cd pear
wget http://pear.php.net/go-pear.phar
cd ..
./configure --with-apxs2=/usr/sbin/apxs2 \
--prefix=/usr/local/php5 \
--enable-soap \
--with-mysql \
--with-bz2 \
--with-zlib \
--enable-zip \
--enable-mbstring \
--with-mcrypt \
--with-mysqli \
--with-config-file-path=/usr/local/php/php.ini \
--with-config-file-scan-dir=/usr/local
make && make install
apt-get install php5-common
# Configure PHP5
libtool --finish /root/src/php5-5*/libs
chmod 644 /usr/lib/apache2/modules/libphp5.so
cd /root/src/php5-5*
cp -rf php.ini-development /usr/local/lib/php.ini
nano /usr/local/lib/php.ini
#>> Line 796: change {;include_path = ".:/usr/share/php"} to {include_path = "/usr/share/php5:/usr/local/php5/lib/php"}
ln -s /usr/local/lib/php.ini /usr/local/php5/etc/php.ini
/root/src/php5-5.3.22/build/shtool install -c /root/src/php5-5.3.22/ext/phar/phar.phar /usr/local/php5/bin
ln -s -f /usr/local/php5/bin/phar.phar /usr/local/php5/bin/phar
/usr/local/php5/bin/php -v
ln -s /usr/local/php5/bin/pear /usr/bin/pear
ln -s /usr/local/php5/bin/peardev /usr/bin/peardev
ln -s /usr/local/php5/bin/pecl /usr/bin/pecl
ln -s /usr/local/php5/bin/phar /usr/bin/phar
ln -s /usr/local/php5/bin/php /usr/bin/php
ln -s /usr/local/php5/bin/php-config /usr/bin/php-config
ln -s /usr/local/php5/bin/phpize /usr/bin/phpize
php -v
#######################################################################################
## Install phpMyAdmin 3.5.7 [If already installed, remove your version of phpMyAdmin and follow these steps]cd /root/src
wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.5.7/phpMyAdmin-3.5.7-all-languages.tar.gz
tar zxf phpMyAdmin-3.5.7-all-languages.tar.gz
mv phpMyAdmin-3.5.7-all-languages /frontview/ui/resource/html/phpmyadmin
# Who owns Apache?
egrep 'User|Group' /usr/local/apache2/httpd.conf
#>> Results: User:admin Group:admin
grep DocumentRoot /usr/local/apache2/httpd.conf
#>> Results: DocumentRoot /frontview/ui/resource/html
# 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 Services
/etc/init.d/mysql restart
/etc/init.d/apache2 restart
## 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: https://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 Ultra
## Server Hostname: localhost
## Server Port: 3306
## Server Socket: /var/run/mysqld/mysqld.sock
## Connection Type: socket
## PHP Ext to use: mysql
## Connect without password: Checked
## "Add a new server" {Server configuration} TAB
##-------------------
## Allow root login: Checked
## Allow logins without a password: checked
##-------------------
## <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 Windowcp /etc/mysql/my.cnf /etc/mysql/my.cnf.bak
cd /frontview/ui/resource/html/phpmyadmin
cp -rf config/config.inc.php .
cp -rf config/config.inc.php /root/system
rm -rf config
# Restart Services/etc/init.d/mysql restart
/etc/init.d/apache2 restart
## 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 using root with no password
## > Goto URL: https://ReadyNAS_IP_Address/phpmyadmin/index.php
## Username: root
## Password:
## <GO>
# you should see these databases or more: information_schema, mysql, and slimserver
## Close Browser Window
## Install ReadyNAS {Photos II} addon to activate MySQL Server during boot
###
## Clear /root/src to avoid inode space issuesdf && df -i
cd ~
rm -rf /root/src/*
reboot
#############################################
### 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 of the root directory.mkdir /c/addons-config
mkdir /c/addons-config/VirtualBox
mkdir /c/addons-config/VirtualBox/backup
# Install Oracle Key from source
cd /c/addons-config/VirtualBox/backup
wget http://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 (Published: 4OCT12)
# Using RNDP6xxx_4.2.22_WW_src.zip
# http://www.readynas.com/download/GPL/RNDP6xxx_4.2.22_WW_src.zip
##################################
# NetGear makes a Kernel-Build-Tools set of patches to convert a Kernel.org Tar.bz2 source
# into a kernel capable of working on the ReadyNAS Hardware Box [buttons, lcd, fan control, etc]
# Note: There is only one kernel tree included in the RNDP6xxx_4.2.22_WW_src.zip file ~ 2.6.37.6.
### Download ReadyNAS Kernel-Build-Toolscd /c/addons-config/VirtualBox
rm -rf kernel
cd /c/addons-config/VirtualBox/backup
wget http://www.readynas.com/download/GPL/RNDP6xxx_4.2.22_WW_src.zip
unzip -q RNDP6xxx_4.2.22_WW_src.zip "kernel/*"
mv kernel ..
#######################################################
### Section C2: Build VirtualBox Kernel Environment
######################################################### Make a copy of umodified 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
# This will save time if you need to start again
# : cd /c/addons-config/VirtualBox/kernel/2.6.37 && rm -rf linux-2.6.37.6 && 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 Debian Systemcd /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-2.6.37.6.RNx86_64.2.4/
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
: make prepare
: make modules_prepare
## Start the Build!
: make
: make -C /lib/modules/`uname -r`/build modules
## You have finished the ReadyNAS 2.6.37 basic kernel build
#################################################
### Section D: Install VirtualBox-4.2.10-84104
#################################################
#
### Note: Python must be installed and working before continuing ###
#
# Download VBox Runtime and Ext Packcd /c/addons-config/VirtualBox/backup
wget http://download.virtualbox.org/virtualbox/4.2.10/VirtualBox-4.2.10-84104-Linux_amd64.run
wget http://download.virtualbox.org/virtualbox/4.2.10/Oracle_VM_VirtualBox_Extension_Pack-4.2.10-84104.vbox-extpack
chmod 755 VirtualBox-4.2.10-84104-Linux_amd64.run
## Make sure System is Clean from prior installcd /c/addons-config/VirtualBox/backup
: ./VirtualBox-4.2.10-84104-Linux_amd64.run uninstall
: rm -rf /opt/VirtualBox
: 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
## 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.2.10-84104-Linux_amd64.run
## 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
# 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.2.10-84104.vbox-extpack
# 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 /c/addons-config/VirtualBox/backup/images
mkdir /c/addons-config/VirtualBox/backup/images/unpacked
mkdir /c/addons-config/VirtualBox/VirtualMachines
mkdir /c/addons-config/VirtualBox/VirtualMachines/importimage
mkdir /c/addons-config/VirtualBox/VirtualMachines/exportimage
mkdir /c/addons-config/VirtualBox/VirtualMachines/working
# Allow Windows 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
# Using linked directories, 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 modulescd /usr/src/vboxhost-4.2.10
make
# Copy VBox Modules into the directory matching your kernel release from uname -r
# If you have RAIDiator 4.2.22 installed, it should match 2.6.37.6.RNx86_64.2.4ls -aFl
uname -r
cp *.ko /lib/modules/`uname -r`/
cp *.ko /lib/modules/`uname -r`/kernel/drivers/target/
# Force VBox Kernel module recompile - just to be sure everything worked.
# If Errors, Please have a look at /var/log/vbox-install.log 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 Kernal Directory into a TAR file named "VBox_Linux_Kernel_2.6.37.6_ReadyNAS_4.2.22.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.22.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.22.tar /addons-config/VirtualBox/backup
rm -rf /c/addons-config/VirtualBox/kernel
## SKIP; unless you need to Restore the backup you just made
mkdir /c/addons-config/VirtualBox/kernel
mkdir /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.22.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 verbiage 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 Users to VBoxUsers Groupadduser vbox --no-create-home --ingroup vboxusers
## Sample Output:
# >>
# Adding user `vbox' ...
# >>
# Adding new user `vbox' (1005) with group `vboxusers' ...
# >> Not creating home directory `/home/vbox'.
# >>
# Enter new UNIX password:
# >>
# Retype new UNIX password:
# >>
# 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]adduser vbox vboxusers
# Give User vbox ownership of Image Storage Directoriescd /c/addons-config/VirtualBox
chown vbox:vboxusers ./VirtualMachines/
chown vbox:vboxusers ./VirtualMachines/importimage/
chown vbox:vboxusers ./VirtualMachines/exportimage/
chown vbox:vboxusers ./VirtualMachines/working/
## Step 2: Install PHP VirtualBox Manager for ReadyNAS
# Download PHPVBoxMgr_0.4-readypro-0.1.1.bin
# Site: http://netgear.tonidoid.com/app/webshare/share/NETGEAR%20ReadyNAS%20Tech%20Documents/Add-on/x86/?vm=listcd /c/addons-config/VirtualBox/backup
wget http://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
## 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] [Owner: nobody] [Group: nogroup] [Rights: Reade/write] [Permissions: [x][x]] [Apply]
## Install PHPVBoxMgr 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
## Close Browser Window
## Step 3: Upgrade PHP VirtualBox Manager from v0.4 to v4.2-4
### *** PHP Virtual Box Manager v4.2-4 *** ###
# REF: http://code.google.com/p/phpvirtualbox/
# Remarks: VirtualBox 4.2.x Compatible --- 4.2-4 release
# Download Latest version of PHP VirtualBox Manager:: cd /c/addons-config/VirtualBox/backup
rm -rf phpvirtualbox*
wget `wget -q -O - http://phpvirtualbox.googlecode.com/files/LATEST.txt` -O phpvirtualbox-latest.zip
unzip phpvirtualbox-latest.zip
cp /frontview/ui/resource/html/phpvboxmgr/config.php /addons-config/VirtualBox/backup/phpvirtualbox-4.2-4/config.php.bak
mv /addons-config/VirtualBox/backup/phpvirtualbox-4.2-4/config.php-example /addons-config/VirtualBox/backup/phpvirtualbox-4.2-4/config.php
: rm -rf /frontview/ui/resource/html/phpvboxmgr/
: cp -rf /addons-config/VirtualBox/backup/phpvirtualbox-4.2-4 /frontview/ui/resource/html/phpvboxmgr
## Step 4: Edit PHP VirtualBox Manager Configuration File
# Location of file: /frontview/ui/resource/html/phpvboxmgr/config.php
# There is a bug in 4.2-4 that prevents the <console> preview from working, add line 14 to fix.
# Edit Instructions:
: 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 14: var $consoleHost = 'ip.address.of.ReadyNAS';
>> 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 enable 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: http://blog.secaserver.com/2011/06/fsniper-monitor-newly-created-files-in-directory/
# Source 2: https://wiki.archlinux.org/index.php/Fsniper
# Source 3: http://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 owner 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 http://www.clearfoundation.com/Software/downloads.html
# You can also find a plethora of images from http://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.
#
# Edit the fsniper config file to do what you want it to do - No worries, Be Happy!cd /c/addons-config/VirtualBox/backup
rm -rf fsniper-1.3.1
wget http://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 file will be placed in /usr/local/binsudo make install
fsniper --version
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 %%
}
}
# Not related to VBox - This is for my movies and TV Shows
/c/media/Video/Movies/New {
recurse = true
*.mkv {
handler = echo New Movie %% Detected; cd /c/media/Video/Movies/New; rmcleanvideoextra; chown nobody:nogroup %%
}
*.avi {
handler = echo New Movie %% Detected; cd /c/media/Video/Movies/New; rmcleanvideoextra; chown nobody:nogroup %%
}
*.mpg {
handler = echo New Movie %% Detected; cd /c/media/Video/Movies/New; rmcleanvideoextra; chown nobody:nogroup %%
}
*.mpeg {
handler = echo New Movie %% Detected; cd /c/media/Video/Movies/New; rmcleanvideoextra; chown nobody:nogroup %%
}
*.mp4 {
handler = echo New Movie %% Detected; cd /c/media/Video/Movies/New; rmcleanvideoextra; chown nobody:nogroup %%
}
}
}
EOF
#----------------------------------------------
##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: http://www.bytereef.org/howto/djb/daemontools-install.html
# Source: http://cr.yp.to/daemontools.htmlcd /c/addons-config/VirtualBox/backup
rm -rf daemontools
mkdir daemontools && cd daemontools
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
wget http://smarden.org/pape/djb/manpages/daemontools-0.76-man.tar.gz
wget http://www.rickwidmer.com/software/netqmail-1.06.tar.gz
wget http://thedjbway.b0llix.net/patches/daemontools-0.76.sigq12.patch
# Install Daemontools
# This will install supervise, svc, svok, svscan, svscanboot, and svstat into /usr/sbintar 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
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/sbin:||' \
-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 servicekillall fsniper
rm -rf /etc/init.d/fsniper
nano /etc/init.d/fsniper
#-----------------------------------------------------export HOME=/root
PID=$(pidof -o %PPID /usr/local/bin/fsniper)
case "$1" in
start)
echo -n "Starting Fsniper: "
/usr/local/bin/fsniper --daemon
echo -e "... [OK]"
;;
stop)
echo -n "Stopping Fsniper: "
[ ! -z "$PID" ] && kill -9 `ps aux | grep "fsniper" | grep -v grep | awk {'print $2'}` > /dev/null
if [ $? -gt 0 ]; then
echo -e "It is not running!"
else
echo -e "... [OK]"
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart"
exit 1
esac
exit 0
#-----------------------------------------------------chmod 755 /etc/init.d/fsniper
/etc/init.d/fsniper start
# Advantage: if stopped, daemontool services automatically restart without using cron or inittabkillall fsniper supervise svscanboot
rm -rf /service
mkdir /service
mkdir /service/fsniper
#-----------------------------------------------------sudo sh -c "cat >> /service/fsniper/run" <<EOF
#!/bin/sh
echo starting Fsniper using daemontools
touch ~/.config/fsniper/log
exec /etc/init.d/fsniper start
EOF
#-----------------------------------------------------chmod 755 /service/fsniper/run
# Check to make sure Daemontools are running
ps -ef | grep svscan && ps -ef | grep supervise
# Sample Output:
# >> root 7761 1 0 10:04 ? 00:00:00 /bin/sh /usr/sbin/svscanboot
# >> root 7763 7761 0 10:04 ? 00:00:00 svscan /service
###########################################################
### 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
# Give root Permission to Start the VBox Server as user 'vbox': rm -rf /home/vbox
: mkdir /home/vbox
: chown vbox:vboxusers /home/vbox
: mkdir /home/vbox/.VirtualBox/
: chown vbox:vboxusers /home/vbox/.VirtualBox
: 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
######################################
## Start VBox Driver Service ##: /etc/init.d/vboxdrv restart
## Start VBox Web Server ##
# NOTE: VBox does not use the ReadyNAS Apache Web Server
# The VBox Web Server allows you to access the PHP VBox Manager: /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 Infovboxwebsrv -b
## Start the "Automatically Start Virtual Machines" Service
# Fix corrupted vboxinitapt-get install sysutils
: dos2unix /etc/init.d/vboxinit
: /etc/init.d/vboxinit restart
: chown root /opt
## [Reboot] ReadyNAS
## Accessing PHP VirtualBox Manager: http://IP_of_your_ReadyNAS_Box/phpvboxmgr
## Note: Not sure why, but my first attempt to login using PHP VirtualBox Manager required an ID/PW of admin/admin.
# The user was 'admin' not 'vbox'. I then used [File] -> [Preferences] -> [Users] to add User 'vbox' as an (Admin User).
# At this point, you should logout and log back in as User 'vbox' and [Delete] User 'admin'.
# If you get a PHP soap error, install php-soap then remove the ';' from the extension=php_soap.dll entry in php.ini
sudo apt-get install php-soap
nano /usr/local/lib/php.ini
>> line 991: extension=php_soap.dll
reboot
## Change the default VirtualMachine folder of VBox
# 1) Using the command line
: VBoxManage setproperty machinefolder "/c/addons-config/VirtualBox/VirtualMachines/working"
# 2) Using a web Browser:
# Access: http://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 face:)
# You can also manually start the VBox Web Server using '/opt/VirtualBox/vboxwebsrv'
# I run it this way to trouble-shoot vbox permission issues.
####################################################
Virtual Machine Ideas:
1. ClearOS Firewall (Great due to 2x Ethernet ports: http://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 ( http://greenpossum.awardspace.com/ipcop-in-vbox.html)
2. Music Brainz Server (http://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: http://current.ReadyNAS.ip.address:5000
3. Kolab Server 3.0 (http://kolab.org/get-kolab)
4. Android 4.0 (http://www.kirsle.net/blog/kirsle/android-4-0-in-virtualbox)
5. ChromimumOS (http://chromeos.hexxeh.net/)
> Instructions @ http://www.androidauthority.com/howto-test-drive-chrome-os-features-the-chromium-way-155084/
6. Amahi Server 6.1, Ubuntu 12.04 or Fedora 14 (http://www.amahi.org/)
> for Ubuntu 12.04 build a VM (http://blog.coolaj86.com/articles/how-to-install-ubuntu-in-virtualbox.html)
and follow this process (http://docs.amahi.org/ubuntu-12.html)
7. Synology DSM 4.1 (http://xpenology.com/forum/viewtopic.php?f=2&t=3&sid=c766ced785bd2610629e8b24bddd3d45)
8. Windows 8 (http://www.youtube.com/watch?v=u5rk4E-5yVU)
#################################################### - dsm1212ApprenticeOne more tip: My network problems were due to having my nas configured to use alb network bonding. Found online that Virtualbox doesn't work in bridged network mode if the host is using alb bonding (at least for linux guests this is true, I didn't dig any deeper than that). I switched to tlb bonding and all my network problems cleared up for the ubuntu guest.
thanks,
steve - sander11AspirantA couple of questions since this thread has picked up again.
1) has anyone else noticed occasional lags in virtualbox which have remained until a vm was stopped?
I've had a couple instances where the vm just dragged to a crawl and when I logged into the Readynas the %wa (i/o waits) in top as at 90%. Stopping (actually suspending) the vm and restarting it resolved this behavior. It may be because of the software hypervisor, but I was curious if anyone else has seen this.
2) how much has anyone really pushed this?
I'm pretty timid as I only went this route to keep from messing up the main Readynas config too much and for portability of other services. I started this when I had to factory flash the firmware and had to migrate my Squeezebox config which was pretty customized. Not wanting to be shackled to the the root OS or run the risk of undermining the whole situation I moved all of the add-ons except for virtualbox to a vm and it's been awesome except for some performance issues which I hope to address with a new CPU.
That said has anyone run more than 2 vms or a bunch of multi-core vms without melting their NAS? My CPU temp idles around 90 degrees with the mid 90s if there's steady activity and up to 107-8 under heavy load (if my Yahoo widget is to be believed). I'd be curious if anyone can sustain multiple vms with reasonably low temperatures.
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!