Raspberry Pi as a dedicated “Twitch Plays Pokemon” Viewer

I’m not too proud of this but my laptop couldn’t handle streaming ‘Twitch Plays Pokemon’ and me doing day to day tasks and I can’t stop watching now. I’ve decided to use a spare Raspberry Pi have to keep the stream open 24/7 on a spare monitor I have.

Here’s a video:

Thanks to Livestreamer it is unbelievably easy to view this stream.

The following command will install Livestreamer:

apt-get install python-pip
pip install livestreamer

To make things even simpler, I have also written the following python program that will open the stream to HDMI. You can set the line that runs this program as a cron job to run at boot if you wish.

import os
os.system("livestreamer twitch.tv/twitchplayspokemon best -np  'omxplayer -o hdmi'")

Which you can get on your pi with:

wget http://www.esologic.com/source/TPP/raspberry_TPP.py

Once it is downloaded you can run it with:

python raspberry_TPP.py

And it will open on your HDMI monitor.

My Research at WPI

Hi! I am now a researcher for Sabyasachi Sarkar at WPI, the college I go to. You can check out some of the work I’ve done here!

 

I got this gig because of my work on this website so thanks guys.

Server Upgrade | Migrating WordPress

Like I said in my first post for this server upgrade, a secondary purpose of this new server was to migrate my wordpress blog to a more stable server setup.

For my particular setup, I’ll be running my blog inside of a virtual machine running ubuntu 12.04 inside of a new server running ubuntu 12.04 as detailed in this post. This migration method does not care what kind of server you are using, so whatever setup you’re currently running should be fine.

The migration itself is remarkably easy thanks to a wordpress plugin called duplicator. Essentially the process is this.

On the old server, update wordpress and install duplicator. Go through the instructions listed in duplicator and save your files in a place where you can get them.

On the new server, install the latest version of wordpress and makes sure it is working 100%. You can use this guide if you need help doing that.

The only thing that stuck for me was the fact that after you finish the wordpress install, you need to run the following command.

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

This will give apache user permissions to write to disk.

Other than that, just follow the duplicator instructions.

Creating an Email Server at Home Inside of a Virtual Machine Using Linux & Citadel

Citadel makes this pretty sophisticated and money saving procedure really easy. Once I figured out what I was doing, the install took me about 45 minutes to complete, here are the steps I took!

I’m running PHPvirtualbox on ubuntu server 12.04 as detailed in this post.

First thing’s first, get a virtual machine with a debian based OS loaded up.

3

I’m using 12.04 for the VM as well

4

Then go through the OS install, only installing openssh-server as additional software.

5

6

First we need to give the server a Fully Qualified Domain Name (FQDN)

7

You will need to edit the

/etc/hosts
/etc/hostname

files.

8

Change whatever name you chose in the install process to ‘mail’ in the /etc/hostname

9

10

Modify your /etc/hosts as follows. The green box is the domain you will be using.

11

After rebooting, you will be greeted with a your hostname set to mail. You can still log in with your regular username & password.

12

Running

hostname
hostname -f

Should yield very similar results.

13

Now we need to establish a static for our virtual machine.

14

15

In PHPvirtualbox, set the network mode to ‘Bridged Adapter’

16

17

Running the following commands

hostname
hostname -f
ifconfig

And getting these results means our configuration is ready to go!

18

I am now using the Putty window so I can copy commands in. First log in as root.

19

Run

</pre>
apt-get install build-essential curl g++ gettext shared-mime-info libssl-dev
curl http://easyinstall.citadel.org/install | bash
<pre>

and go through the citadel install process.

20

21

22

23

24

25

26

27

28

29

30

I’m changing the default port to 80 for now, just for simplicity.

31

32

After the install, reboot the VM.

33

Now log in to citadel!

34

35

Now we need to do MX forwarding. My DNS host is network solutions, but the process is very similar regardless to which provider you use.

36

37

Again, your domain is represented by the green box.

38

39

The yellow box is your IP

40

41

You can use whatismypi to determine your IP address. If it is dynamic, you can use No-IP to get a static one .

42

43

The records should look something like this.

44

Now in citadel, you need to go to ‘Administration’ -> ‘Domain names and Internet mail configuration’ and add your domain.

45

Now open the following ports on your router. This is dangerous, but IMO worth it.

50

Now we test!

46

47

48

49

There we go! Pretty much no cost email addresses!

Thanks for reading, leave any improvements in the comments.

Server Upgrade | Citadel Install Inside of a Virtual Machine

Okay! So for now, I’ve landed on Citadel for the email server software that I’m going to use. I’ve bounced around between four different clients (iredmail, Citadel, Ubuntu’s Suite, and Zimbra) and have landed on Citadel because I can install it (lol) and because it suites my needs better. The other software suites are basically wrappers of a bunch of smaller discrete softwares that build up the Ubuntu Suite. This is fine for dedicated servers, but since I’m going to be running this inside of a Virtual Machine, it is more convenient for me to use Citadel.

The install is pretty simple once you get the prerequisites installed and prep the VM itself.

Since it’s a server, a static IP address on the network will be very useful. Setting the IP address of a Virtual Machine is surprisingly simple, or at least it is in my case.

You set the IP you want manually as done here, and to configure the VM you set the network to be attached to a bridged adapter as seen here:

To install citadel, run the following commands per the citadel install guide.

</p>

<pre>apt-get update
apt-get install build-essential curl g++ gettext shared-mime-info libssl-dev
curl http://easyinstall.citadel.org/install | bash</pre>
<p style="text-align: left;">

And the install should go off without a hitch. You can then navigate to yourserverip/mail to access citadel.

Server Upgrade | Stress Testing

So I wrote a program that makes really big numbers in python in an attempt to break a VM. Here’s the code:

number = 2
count = 0
while 1:
 number = number*number
 count = count + 1
 print str(count) + ' Compounds , ' + str(len(str(number))) + ' Digits'

I left it on for a few days and ended up with this:

Someone try and beat 26 compounds!

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

</pre>
sudo nano /etc/apt/sources.list.d/virtualbox.list
Add deb http://download.virtualbox.org/virtualbox/debian raring contrib non-free
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
<pre>

Then install phpvirtualbox


sudo apt-get install apache2 php5 libapache2-mod-php5
sudo service apache2 restart
sudo adduser --ingroup vboxusers vbox and enter a password
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 and make $username and $password match the user you created earlier
Also add this line to disable phpVirtualbox's authentication var $noAuth = true;
sudo nano /etc/default/virtualbox
Add VBOXWEB_USER=vbox
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