Server Upgrade | Understanding and Accessing VM’s

Eventually, I’d like to migrate this website to the new server that I’m working on now, and to be able to do that I’m probably going to need to be able to use SSH to access the server, access files from it using S/FTP, use some sort of apache webserver etc etc.

Turns out, it is comically easy change the ports on a virtual machine using phpvirtualbox, and I was expecting to have to write a much longer post than this.

 

Server Upgrade | Getting a VM running

Alright! Time to get VM’s rolling.

I’m going to be running phpvirtualbox on Ubuntu Server 12.04.3. The phpvirtualbox software will work really well because it’s web based and the server is headless.

Basically I’m following these guides:

http://www.howtoforge.com/vboxheadless-running-virtual-machines-with-virtualbox-4.1-on-a-headless-ubuntu-12.04-server

http://www.howtoforge.com/managing-a-headless-virtualbox-installation-with-phpvirtualbox-ubuntu-12.04

https://gist.github.com/dominicsayers/3012172

And doing the following:

Install VirtualBox – note you will most likely need to upgrade

sudo nano /etc/apt/sources.list.d/virtualbox.list

Add the line

deb http://download.virtualbox.org/virtualbox/debian raring contrib non-free

To that file then exit by hitting ^X. Continuing:

wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install dkms unzip
sudo apt-get install virtualbox-4.2 --no-install-recommends
wget http://download.virtualbox.org/virtualbox/4.2.12/Oracle_VM_VirtualBox_Extension_Pack-4.2.12.vbox-extpack
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.12.vbox-extpack

Then install phpvirtualbox

sudo apt-get install apache2 php5 libapache2-mod-php5
sudo service apache2 restart
sudo adduser --ingroup vboxusers vbox
wget 'http://sourceforge.net/projects/phpvirtualbox/files/latest/download' -O phpvirtualbox-latest.zip
sudo unzip phpvirtualbox-latest.zip -d /var/www
cd /var/www
sudo mv phpvirtualbox-latest phpvirtualbox
cd phpvirtualbox
sudo mv config.php-example config.php
sudo nano config.php

Edit this file to set $username and $password match the user you created earlier
Also add the following disable phpVirtualbox’s authentication:

var $noAuth = true;

Then ^X to exit. Continue with the installation:

sudo nano /etc/default/virtualbox

Add the line:

VBOXWEB_USER=vbox

Then ^X to exit. Start virtualbox with:

sudo /etc/init.d/vboxweb-service start

And then navigate to yourserversip/phpvirtualbox

Then getting a virtalbox VM running inside of that is easy!

Server Upgrade | Pictures!

Alright so the build works, here are a bunch of pictures!

The final setup!

Server Upgrade | Initial Build Spec

Hello! Long time no write!

Lemme jump right in, the server that hosts all of my content is dying. Right now, I get around 200 hits a day, and that’s only rising (thanks youtube dudes!) which is really taking a toll on the server. It’s an HP laptop that has been on for almost two years straight, in addition to being my only computer for 4 years before that.

The only reason this is worth writing about is because I intend on using this machine for a few things other than hosing a WordPress server (hopefully I’ll write a post about migrating a content rich blog across servers).

I also want to run a series of email servers on the machine as well! It would appear that a series of virtual machines would be the most efficient way to accomplish this.

Here is a list of the components that I have ordered: http://pcpartpicker.com/user/egg/saved/3deW

Raspberry Pi Media Server | Mounting Hard Drive & Better Minidlna Config

Please note that this is more for my sake. To mount a hard drive in raspbian do the following: Make sure you have ntfs-3g installed by running:

sudo apt-get install ntfs-3g

Then mount the drive read/write with the following command:

sudo mkdir /media/USBHDD
sudo mount -t ntfs-3g /dev/sda1/ /media/USBHDD/

And it shout be mounted. /dev/sda1 is the location of your hard drive. Now to configuring minidlna. Location of minidlna.conf file and access command:

sudo vi /etc/minidlna.conf

This is the file I’m running right now. As I type this i’m successfully streaming to my Kindle Fire HD (the reason why I’ve decided to really make this thing work) but I’m not sure if it’s stable. It’s also able to stream to VLC as of now.

Raspberry Pi Media Server | Moving Backwards to go Forwards

It’s time to face facts, minidlna and XBMC won’t run at the same time in Raspbmc. The basic UPNP included in Raspbmc won’t work consistently and Raspmc and is not nearly as stable as minidlna. OpenELEC is fast enough, but does not have the expandability of a full linux OS. I need to restart this project.

 

First thing’s first I’m going to straight up speed this thing up as much as I can. At the base level, this begins with the SD card. I’m going to go from a junk 4gb standard speed SD card to a 8gb SanDisk Ultra 30mb/s SDHC. On this I’m going to install the latest version of Raspian and overclock it to the maximum 1GHz.

 

I’ll keep you posted on how I progress.

Raspberry Pi Media Server | Speeding Up Raspberry Pi [Documentation]

So although I haven’t written about it yet, right now I’ve gotten a Raspbmc Server up and running along with Minidlna. It works great for about an hour at a time and then it really bogs down. This seems to be caused by a combination of Raspbmc and the hard drive spinning down. My solution is to try OpenELEC, overclock the Raspberry Pi, and change out the SD card for one with a faster read/write speed.

Encoding A LOT of video in linux | [Documentation]

For my Raspberry Pi Media Server to be able to stream to mobile (a topic I haven’t yet covered here) I need to convert ALL of the video in my family’s 700+ file, 400+ gb, media collection to H.264/MPEG-4 AVC. I recently acquired a hard drive to consolidate and store all of this hard drive on. For the past week or so I’ve been making some progress in converting the video. On my windows tower I’ve been using the program Format Factory to convert the video. I’m running into a few problems with this. For one, my windows computer is my main machine, and multithread converting really bottlenecks it. It also takes a long time – having to watch it while it does it’s thing waiting for it to convert instead of just going to the next set of files is annoying. I could just convert

So I’ve decided to get back into python and write a program that will perfect the conversion process. Like in my PiScanner project, I’ll be using an existing program within python and my code will automate the process.

Goals are as follows:

1. Convert the video

2. Make sets of folders for the video

3. Have it all done on the external HDD

4. Have it be more “efficient” than the setup I’m running now. I.E be able to be on all the time – which shouldn’t be a problem as the server you’re viewing this website on is on all time time and I can just run the script here.

5. Make the end program useable for anyone.

WordPress installation on ubuntu 10.04

There are probably a million tutorials out there to do this, but as I’m doing it for the second time, I figure that I should probably write it down.

First thing’s first, make sure you’re all updated:

sudo apt-get update

Then install lamp

sudo apt-get install lamp-server^

and run through the install process. Make sure you write all of that info down.

Then download wordpress. Assuming they still have their download architecture the same as the time I’m writing this, you can just use this command.

wget http://www.wordpress.org/latest.tar.gz

And unzip this file.

tar -xzvf latest.tar.gz

You should see a LOT of stuff unzipping.

Then remove the tarball

rm latest.tar.gz

Now you need to create a database.

mysql -u WHATEVER YOUR USERNAME IS -p YOUR PASSWORD
mysql> CREATE DATABASE wordpress;
mysql> GRANT ALL PRIVILEGES ON wordpress_risp.* to "AUSERNAME"@"localhost"
#hit enter and make a new line
 -> IDENTIFIED BY "password";
FLUSH PRIVILEGES;
EXIT

Write down this information.

Next move your wordpress folder to where it’s going to be seen by the web, in my case /opt/bitnami/wordpress/risp

mv wordpress /opt/bitnami/wordpress/risp

rename the file “wp-config-sample.php” to “wp-config.php”

mv wp-config-sample.php wp-config.php

edit it using your favorite text editor, in my case vim

vi wp-config.php

Follow the instructions in the document to add your MySQL DB stuff that you established earlier.

At this point you’re pretty much done. Navigate you localhost/wp-admin/install.php in your favorite browser to set it all up.


To be able to upload images, you will need to run the following command:

 sudo chown -R 755 www-data:www-data /var/www

To be able to use custom permalinks within wordpress, we’ll need to make a couple modifications. The first is modify the apahce2 virtual host settings with:

sudo nano /etc/apache2/sites-enabled/000-default

Change the /opt/bitnami/wordpress/ settings so AllowOverride None is set to all like so:

We will also need to give the proper permissions of apache to the .htaccess (found in the root directory of your wordpress install, mine is /opt/bitnami/wordpress/) file by running the following commands:

sudo chown -v :www-data /opt/bitnami/wordpress/.htaccess
sudo chown -v 664 /opt/bitnami/wordpress/.htaccess

Note: If the file does not exist, you can create it with:

sudo nano /opt/bitnami/wordpress/.htaccess

Raspberry Pi Media Server | Streaming To Any Source Using miniDLNA [Documentation]

I’ve made some progress on the RPi Streaming Server.

To replicate this you’ll need to do the following:

1. Install miniDLNA

sudo apt-get install minidlna

2. Edit the config file to how you want it. Edit it using vim

sudo vi /etc/minidlna.conf

3. Here’s what I’m working with, and it works.

# This is the configuration file for the MiniDLNA daemon, a DLNA/UPnP-AV media
# server.
#
# Unless otherwise noted, the commented out options show their default value.
#
# On Debian, you can also refer to the minidlna.conf(5) man page for
# documentation about this file.

# Path to the directory you want scanned for media files.
#
# This option can be specified more than once if you want multiple directories
# scanned.
#
# If you want to restrict a media_dir to a specific content type, you can
# prepend the directory name with a letter representing the type (A, P or V),
# followed by a comma, as so:
#   * "A" for audio    (eg. media_dir=A,/var/lib/minidlna/music)
#   * "P" for pictures (eg. media_dir=P,/var/lib/minidlna/pictures)
#   * "V" for video    (eg. media_dir=V,/var/lib/minidlna/videos)
#
# WARNING: After changing this option, you need to rebuild the database. Either
#          run minidlna with the '-R' option, or delete the 'files.db' file
#          from the db_dir directory (see below).
#          On Debian, you can run, as root, 'service minidlna force-reload' instead.
media_dir=A,/home/pi/stream_files/media/audio
media_dir=P,/home/pi/stream_files/media/pictures
media_dir=V,/home/pi/stream_files/media/video
media_dir=/home/pi/stream_files/media

# Path to the directory that should hold the database and album art cache.
db_dir=/var/lib/minidlna

# Path to the directory that should hold the log file.
#log_dir=/var/log

# Minimum level of importance of messages to be logged.
# Must be one of "off", "fatal", "error", "warn", "info" or "debug".
# "off" turns of logging entirely, "fatal" is the highest level of importance
# and "debug" the lowest.
#log_level=warn

# Use a different container as the root of the directory tree presented to
# clients. The possible values are:
#   * "." - standard container
#   * "B" - "Browse Directory"
#   * "M" - "Music"
#   * "P" - "Pictures"
#   * "V" - "Video"
# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root
#root_container=.

# Network interface(s) to bind to (e.g. eth0), comma delimited.
#network_interface=

# IPv4 address to listen on (e.g. 192.0.2.1).
#listening_ip=

# Port number for HTTP traffic (descriptions, SOAP, media transfer).
port=8200

# URL presented to clients.
# The default is the IP address of the server on port 80.
#presentation_url=http://example.com:80

# Name that the DLNA server presents to clients.
#friendly_name=

# Serial number the server reports to clients.
serial=12345678

# Model name the server reports to clients.
#model_name=Windows Media Connect compatible (MiniDLNA)

# Model number the server reports to clients.
model_number=1

# Automatic discovery of new files in the media_dir directory.
#inotify=yes

# List of file names to look for when searching for album art. Names should be
# delimited with a forward slash ("/").
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg

# Strictly adhere to DLNA standards.
# This allows server-side downscaling of very large JPEG images, which may
# decrease JPEG serving performance on (at least) Sony DLNA products.
#strict_dlna=no

# Support for streaming .jpg and .mp3 files to a TiVo supporting HMO.
#enable_tivo=no

# Notify interval, in seconds.
#notify_interval=895

# Path to the MiniSSDPd socket, for MiniSSDPd support.
#minissdpdsocket=/run/minissdpd.sock

You can grab the file itself here. The only thing that’s different is where I put the media directories. The rest of the instructions are still in the .conf, it’s much simpler than mediatomb for example.

Here’s a video of the whole thing working on 3 devices!