PiPlanter 2 | Getting Started Again

So I have decided to re write the PiPlanter from the ground up. In essence, it will accomplish the same exact thing but I’d like it to be a lot more of a stable platform to expand upon in the future. I’d also like PiPlanter to be professional enough to bring to market. First off there are a few things you’d need install & a few modifications you’d need to make to Raspian. First thing’s first, you’ll need to enable SPI in the kernel so:

Comment out the spi-bcm2708 line so it looks like this:

Then run this to make it more permanent.

Now for the real meat of it. You’ll need these packages for SPI and the WiringPi library makes things a whole lot easier for us. This program also relies very heavily

Revised python code next post.

Raspberry Pi as a dedicated “Twitch Plays Pokemon” Viewer

Update: 12 October 2016

Thanks to commenter Fishscene for pointing out the following:

livestreamer for twitch is broken. Twitch made a change to require an OAUTH token and disallow annonymous viewing. livestreamer hasn’t been updated in over a year. Project was forked to streamlink and includes twitch fix:

https://github.com/streamlink/streamlink

I’ll leave this for prosperity, it has been linked to several time.

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:

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.

Which you can get on your pi with:

Once it is downloaded you can run it with:

And it will open on your HDMI monitor.

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.

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

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

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

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

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.

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:

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

Add the line

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

Then install phpvirtualbox

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

Then ^X to exit. Continue with the installation:

Add the line:

Then ^X to exit. Start virtualbox with:

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!