[Linux-bruxelles] FYI: turn a Pogoplug into a Full-Featured Linux Web Server

INFO info at brlspeak.net
Mar 24 Jan 10:11:23 CET 2012


Voilà qui pourrait en intéresser plus d'un ici, et qui montre toute la
souplesse d'un O S tel que Gnu/Linux!


Turn a Pogoplug into a Full-Featured Linux Web Server
	http://youtu.be/PwPN7jp_A24

Pogoplugs are great little storage devices, but they can do more than they let
on. Let's take a look at how you can hack a Pogoplug into a LAMP (Linux,
Apache, MySQL, PHP) web server.

This is a fun little project, but it does take some time and patience. Be sure
to set aside a few hours this weekend to get it up and running. That said,
let's get started!


The video above will take you through the entire process, which is mostly based
on the great tutorials at plugapps.com. The video won't cover backing up your
Pogoplug, which is something you should probably do, and also how to install
NginX in place of Apache.

Here's what you'll need:

A Pogoplug
A USB flash drive
A computer
Installing Plugbox Linux

Full size

First things first, make sure SSH is enabled on your Pogoplug. You can't
connect to it without it. To turn on SSH and set your SSH password, log in at
my.pogoplug.com, click Settings, then Security, and check the box to enable SSH.

With SSH enabled, you can connect to your Pogoplug. You'll need its IP address,
so check your router's DHCP client table to find it. Once you've got it, open
up whatever application you use to SSH and enter:

root@[YOUR POGOPLUG'S IP ADDRESS]
You'll be prompted for the password you just set on my.pogoplug.com. Enter it,
and you're in! Before we get started, let's kill Pogoplug's services so they
don't get in the way:

killall hbwd
Backing up your Pogoplug's flash memory is probably a good idea at this point,
but we're not going to go into the details here. The next step you need to take
is install the new uBoot onto mtd0. To do this, enter the following:

cd /tmp

wget http://plugapps.com/os/pogoplug/uboot/install_uboot_mtd0.sh

chmod +x install_uboot_mtd0.sh

./install_uboot_mtd0.sh
You'll be prompted about three times. Any sort of hack like this could
potentially brick your device, so beware. Also, even if you follow these
instructions verbatim your installation could fail. The new uBoot install
script thought I'd already installed a new uBoot. It gave me an option to
override which worked just fine (but is a risky move):

./install_uboot_mtd0.sh --no-uboot-check
Once uBoot's installed, plug in your flash drive and unplug any hard drives
currently connected. We're going to destroy all data on the flash drive, so if
there's anything on it you're going to miss I'd back it up now. To partition
properly we're going to need to run fdisk:

/sbin/fdisk /dev/sda
In fdisk, type p to see all the partitions on your flash drive. You're going to
need to get rid of them, so type d 1 to get rid of the first. Depending on how
many partitions you have you'll need to keep going. Use d 2 for the second
partition, d 3 for the third, etc. When you're done, type p to list the
partitions again. You should see no partitions at all. Success? Then it's time
to create a new partition. You can do that by typing n. Press enter, then type
p to designate this partition as the primary partition. Press enter again and
type 1 to specify that this is the first partition on the flash drive. After
that you'll need to press enter a few more times to accept the defaults and
fdisk will do its job. When it's all done, type w to exit.

After you've created the partition you'll need to download mke2fs to format the
flash drive. Use the following commands to make that happen:

wget http://plugapps.com/os/pogoplug/mke2fs

chmod 755 mke2fs

./mke2fs /dev/sda1

mkdir usb

mount /dev/sda1 usb
Next, download and install Plugbox Linux (this is going to take awhile):

cd usb

wget http://plugapps.com/os/1.1/Plugbox-Linux-1.1-rootfs.tar.gz

tar -xzvf Plugbox-Linux-1.1-rootfs.tar.gz # This will take a long time

rm Plugbox-Linux-1.1-rootfs.tar.gz
If everything worked out well, change back to the tmp directory (either cd ..
or cd /tmp will do) and unmount the USB drive:

umount usb
Now, reboot:

/sbin/reboot
If everything worked well, your Plugbox should be accessible again shortly. It
may have been assigned a new IP address, so check your router's DHCP table
again. If names are displayed with the IP addresses, it should be labeled
"Plugbox."

SSH back in again, because there are a few more things we'll want to do. First,
update your Plugbox's packages:

pacman -Syu
You may need to run this a couple of times because pacman, itself, may need an
update. Once pacman's done, you'll want to do a couple of other things.

Set a new root password by typing passwd, pressing enter, and then typing the
new password you want.
Set the date by typing date MMDDhhmmYYYY, replacing MM with the two-digit
month, DD with the two-digit date, hh with the two-digit hour (in 24-hour
time), mm with the two-digit minute, and YYYY with the four-digit year.
That's it! Now you have Linux up and running on your Plugbox.

Installing (L)AMP

If you didn't catch it earlier, LAMP stands for Linux, Apache, MySQL, and PHP.
We have Linux taken care of, so here's how to install the rest.

We'll need Pacman to install a couple of things. First, let's have Pacman grab
the latest Apache, MySQL and PHP:

pacman -Sy apache mysql php
This will take a few minutes, but when it's done we'll also need to install
apachectl so we can actually start apache:

pacman -Sy lynx
Some of the next steps were already taken care of for me, but just in case
here's what you need to do. If you don't already have an http user, you'll need
to add one:

useradd -d /srv/http -r -s /bin/false -U http
If you already have one and the command fails, no harm done. In some cases you
may not be able to add one if you haven't changed your root password. Log out
of your Plugbox and ssh back in to set a new root password if you're having any
trouble.

Next, you need to edit your /etc/hosts file:

nano /etc/hosts
You should see something like 127.0.0.1 localhost.localdomain localhost. That
last part (localhost) may need to change. Basically, it needs to match what's
in /etc/rc.conf. If it doesn't, starting Apache will fail. In my case, I just
needed to change localhost to Plugbox, because Plugbox was the hostname set in
/etc/rc.conf. Really, you just need to change one. To check out what your
hostname is in rc.conf, use the following command (and scroll down until you
see it):

nano /etc/rc.conf
Once you've got both names matching and saved, you can try to start Apache:

/etc/rc.d/httpd start
It'll say [DONE] if it worked, but you'll want to head to your Pogoplug's local
IP address to make sure.

Further configuration is up to you at this point, but be sure to check out
plugapps.com for lots more information on what you can do with your brand new
Pogoplug web server.

Src:
http://lifehacker.com/5637092/turn-a-pogoplug-into-a-fully+featured-linux-web-server


== 
  |  Verstuurd vanaf mijn GNU/Linux  |  Envoyé de mon GNU/Linux  | 
  |  -----------------  Sent from GNU/Linux  ------------------  | 
 




Plus d'informations sur la liste de diffusion Linux-bruxelles