Hacking the POGOplug. The definitive guide in progress. [PT1]

[Pt1]

GOAL:
To setup from beginning to end a personalized Pogoplug server.  Installation of Arch Linux, with addition of Apache, PHP, MySQL and whatever else we may decide upon.

THINGS YOU WILL NEED:

  • Pogoplug v2 (Pink/Gray)
  • 2gb+ Clean flashdrive or external hard drive
  • Mac Terminal or Windows Terminal Program (I like PuTTY)
  • Basic Linux knowledge and the ability to follow a manual :P
  • Install time.  (This varies greatly, but figure about 45 min for a Linux veteran, maybe about 90+ for novices.  Depending on what it is you would like to do, configuring this beast could take hours or days..)

** NOTE **


Following this guide will void your manufacturer’s warranty, and will lead to very little official support in the event of imminent failure.  Do not blame me if you mess something up as I assume no responsibility for what you do with this guide.  With that being said.


Preface:
Intro to the Pogoplug

Recently I have taken a keen liking to a little pink web device, the Pogoplug.  When I first read about the Pogoplug, the concept sounded very intriguing.  The ability to run your own cloud server from the home seemed like an excellent idea.  Kick in the ability to hack and run Linux? That would be awesome! I was sold.  I had to have one.

I browsed around for a good deal, as I was on a limited budget.   I found a friend that was selling his device, he didn’t want it and parted with it cheap.  A Pogoplug Pink v2! Let the hacking begin!

Upon first boot, everything appeared to go well.  I plugged it in, and shortly after the device was fully illuminated and ready to go.  I attempted to access it with the Pogoplug software, but found that I could not.  There was a big problem.  These devices are tied to users Pogoplug accounts by the serial numbers, so if a user does not unregister the device, you cannot do much with it; however I did read that in some cases customer support can grant you access to a device.


In my case it was not that bad. I contacted my friend, he removed it from his account, and it was good to go.

** HINT **

It would be to write down your MAC address, which is located under the bar-code on the bottom of the device.  Next, log into your routers administrative page.  You should be able to find a section of your routers configuration services, that allow you to set static leases.  You would want to set a static lease on a headless setup like this, so that you always know at what address you can access your Pogoplug.

Have the USB device that you plan to install to handy.  I am using just some old drive that I had laying around.  2 GB PNY.  Nothing special.
Be aware that anything on the drive is going to be erased during the setup process, so make sure to back it up.

** NOTE **
This setup guide is only for (PogoPlug v2)

Similar setup guides for this and OTHER compatible devices can be found HERE.


Step 1:

Prepare your Pogoplug

First with the device on and online, remove all of the attached devices.  Attempt to SSH to the IP of the device set by the DHCP. If you are unable to SSH, register and enable SSH through my.pogoplug.com. The default login (unless changed through my.pogoplug.com) is root/ceadmin.

Once you are able to connect via SSH make sure you stop the Pogoplug software before continuing.

 killall hbwd

You will only need to do this once as the Pogoplug software will be disabled later in the install

While connected to your Pogoplug, run these commands to download the bootloader that enables booting from USB drives.

cd /tmp
wget http://joepetruska.com/pogoplug/install_uboot_mtd0.sh chmod +x install_uboot_mtd0.sh ./install_uboot_mtd0.sh
chmod +x install_uboot_mtd0.sh
./install_uboot_mtd0.sh

After the bootloader finishes downloading, insert the USB drive you intend to use EVERYTHING WILL BE ERASED.
Insert the drive into either the front, or the top back USB port.
You will now run fdisk to partition the drive.

Step 2:
Fdisk
Fdisk will partition your USB flash or hard drive for use by Arch

 /sbin/fdisk /dev/sda

fdisk will delete your old partitions

o ## this will remove all partitions
p ## lists any partitions

Now we will make the new partitions

n ##first
p ##second
1 ##third

Press ‘enter’ to continue with defaults.
Exit by pressing ‘w’

Here we create the ext2 filesystem

wget http://archlinuxarm.org/os/pogoplug/mke2fs
chmod 755 mke2fs
./mke2fs /dev/sda1
mkdir usb
mount /dev/sda1 usb

Step 3:
Installing Arch Linux

Now we will download and install Arch Linux

cd usb
wget http://archlinuxarm.org/os/ArchLinuxARM-armv5te-latest.tar.gz
tar -xzvf ArchLinuxARM-armv5te-*.tar.gz ## This will take some time
rm ArchLinuxARM-armv5te-*.tar.gz
sync ## Flash drives take longer

Now we will clean up and reboot.

cd ..
umount usb
/sbin/reboot

If you are running this process from a MAC or Linux machine, your SSH key will be different, and need to be cleared out, to do this run the following

ssh-keygen -R 192.168.1.123 ## Your Pogoplug IP

Log back in after your Pogoplug reboots using username:: root and password:: root.

Congratulations, you just installed ArchLinux onto your new Pogoplug.  Before we finish there are a few things we should do.

Step 4:
Change Your Root Password

This is something should be done ASAP.  It is very easy just run the following command and follow the prompts:

passwd root ## change user password

Make sure not to forget your root password, as you will use this to login from now on.

** Basic Commands **

reboot ## reboots Pogoplug
poweroff ## shuts down Pogoplug to be unplugged

These commands should be used for exactly what they imply.  Try not to unplug your Pogoplug while it is running, this could potentially damage your install.
A short repair guide is in the works, so if you have an issue with not booting post it in the comments.

Next time we will take a closer look at some applications to update and install, and start to lay the groundwork for your web-server!

Please let me know of any questions that you may have!

If I helped you out consider buying me a beer :P

[ PART 2 ] 

Hacking the POGOplug. The definitive guide in progress. [PT2]

[Pt2]

GOAL:
Install all system updates and a handful of useful tools as well as the Webmin utility.

THINGS YOU WILL NEED:

  • Pogoplug that has been hacked from Part 1

LETS GET STARTED:

Fire up your terminal program.  We will do a little maintenance and install a few apps you may want/need down the line.  Copy and paste the following code boxes in order, one at a time.
Make sure to read the content as not all boxes are copy paste.

Step 1:
Updates and Tools:

Lets start by making sure the system is totally up to date with all installed packages

## Update Pacman Sources
pacman -Syy ## package sync
pacman -Syu ## system update

Next lets update the pacman installer.  This step may not be needed but it does not hurt.

## Update Pacman Installer
pacman -S pacman

Followed by some zip and archive tools

## update various apps
pacman -S ntp bzip2 zip p7zip gftp unzip libzip ##tools for later

And then two popular terminal based text editors

## Text Editors Installation
pacman -S vim nano  ## nano and vim text editors

Step 2:
Fixing the clock

From here we are going to edit a file to fix the system clock.  This pogoplug does not support the hwclock, so we will replace it with ntpd.

nano /etc/rc.conf

At the top find TIMEZONE

## REPLACE WITH YOUR TIMEZONE
TIMEZONE="America/Chicago"
## EXAMPLE
TIMEZONE="America/NewYork"

Scroll down to the bottom, and find DAEMONS

Find hwclock replace with ntpd

## BEFORE ##
DAEMONS=(hwclock syslog-ng network netfs crond sshd)
## AFTER ##
DAEMONS=(ntpd syslog-ng network netfs crond sshd)

Hit control+x, follow by “y”, follow by enter.

You have now successfully fixed your system time.

Reboot your Pogoplug.

Step 3:
Webmin Install

Start by downloading webmin

pacman -S webmin perl-net-ssleay ##webmin and perl modules

Once installed you can start the server with

rc.d start webmin

Once you have webmin installed, you can access the admin interface by pointing your browser to https://youriphere:10000

Upon first visit you will be presented with an access denied message, to allow access to more than just localhost we will need to do some slight modifications.

nano /etc/webmin/miniserv.conf

Scroll down to the very bottom and find that line that begins with ALLOW

## add an ALLOW line for whatever IP you plan on accessing the interface from or a range of IPs
ALLOW=127.0.0.1
## Example address configuration
ALLOW=127.0.0.1
ALLOW=192.168.1.0 ## allows all users in that IP range

Hit control+x, follow by “y”, follow by enter.
Return to the boot setup.

nano /etc/rc.conf

Scroll down to the bottom, and find DAEMONS
Add webmin to startup

## BEFORE ##
DAEMONS=(ntpd syslog-ng network netfs crond sshd)
## AFTER ##
DAEMONS=(ntpd syslog-ng network netfs crond sshd webmin)

Save the file.

Reboot your pogoplug.

Once it comes back online you can access many of the pogoplug servers through the webmin page.
Log in with your root username and passwords.

From here you have a fully functional Linux based headless server.  This is a great vanilla start to install anything you want, the possibilities are really unlimited.

** Basic Commands **

rc.d (start/restart/quit) webmin ## basic webmin controls
date - displays device date

In the next installment of “Hacking the POGOplug.  The definitive guide.” We will turn the light on, with a fully functional LAMP server!

Please let me know of any questions that you may have!

If I helped you out consider buying me a beer :P

[ Part 3 ]

Hacking the pogoplug. the definitive guide in progress. [PT3]

[Pt3]

GOAL:
Install the web control panel including Apache/PHP/MySQL and phpMyadmin.

THINGS YOU WILL NEED:

  • Pogoplug that has been hacked from Part 2

LETS GET STARTED:

Fire up your terminal program.  Where we left off is perfect for setting up the webportal.
Make sure to read the content as not all boxes are copy/paste.

Step 1:
Apache / PHP / MySQL:

Lets start by installing apache, php and mysql.

pacman -S apache php php5 php-apache mysql</strong> ## web stuff

Start Apache by running the following

rc.d start httpd ## Starts Apache

Step 2:
Setting up PHP 

To setup PHP Add these lines in /etc/httpd/conf/httpd.conf:
Place this in the “LoadModule” list anywhere after LoadModule dir_module modules/mod_dir.so:

LoadModule php5_module modules/libphp5.so

Place this line at the end of the ‘include’ list:

Include conf/extra/php5_module.conf

Make sure that the following line is uncommented in httpd.conf in the section/(after the line)<IfModule mime_module>:

TypesConfig conf/mime.types

Add this line in /etc/httpd/conf/mime.types:

application/x-httpd-php		php php5

Restart Apache to save changes

rc.d restart httpd

Step 3:
Configuring MySQL

Now we will configure MySQL.
Edit /etc/php/php.ini (this is in /usr/etc on older systems) to uncomment the following lines (By removing ):

;extension=mysqli.so
;extension=mysql.so

Start MySQL

rc.d start mysqld

You may need to restart Apache

MySql should now be running,lets change the root password

mysqladmin -u root password 'password' ## replace 'password' with your password do not include (',') 

Step 4:
Autostart Apache and MySQL

Finally lets add apache and MySQL to the startup.

nano /etc/rc.conf

Scroll down to the bottom to find the following lines

## BEFORE ##
DAEMONS=(ntpd syslog-ng network netfs crond sshd webmin)
## AFTER ##
DAEMONS=(ntpd syslog-ng network netfs crond sshd webmin httpd mysqld)

Hit control+’x’, follow by ‘y’, follow by ‘enter’.

You have now successfully installed apache php mysql.

Reboot your Pogoplug. 

A longer, more in depth guide can be found HERE

** Basic Commands **

rc.d (start/restart/quit) httpd ## basic apache controls
rc.d (start/restart/quit) mysqld ## basic mysql controls</pre>

In the next installment of “Hacking the POGOplug.  The definitive guide. Part 4” We will look into additional web server software.

Please let me know of any questions that you may have!  Also, if there are any other features in which you would like to explore!

If I helped you out consider buying me a beer :P

Go to the forums and post your results!

CLICK HERE