BeagleBone Black : WordPress On Ubuntu


wordpress

Installing LAMP and WordPress on Ubuntu Running on A BeagleBone Black

Since I have been using WordPress with a couple blogs for almost 8 years now, I am fairly comfortable with the platform.  With my weekly BeagleBone Black challenges of late, I felt that installing WordPress would be a great idea to try.  I can tell you that the BeagleBone Black, once again, didn’t disappoint.

Before we begin, I want to just say that running WordPress on the BBB is an academic endeavor.  I wouldn’t think about hosting a public blog due to performance with this configuration but it is perfect for my needs as a teaching tool.  My oldest son just turned seven and is incredibly inquisitive about science.  He catches bugs, lizards, etc. and takes pictures of them.  He loves astronomy and never stops asking when the sun will go supernova.  I thought it would be a great for him to document his findings in a blog to teach him more about the scientific method, documenting his findings and getting more comfortable with the computer.  As an added bonus, I want to see where this takes him.

Getting Started

penguin-ubuntuAs I mentioned my previous blog, I created a “snapshot” of sorts by starting off with a fresh version of Ubuntu then adding my base setup changes then finally creating the tarball of the entire OS.  This way, I can simply reflash the card, restore my base install and begin on the next project.  That’s what I am doing with this.  This is basically my setup:

BeagleBone Black – Installing Ubuntu – Part 1

BeagleBone Black – Installing Ubuntu – Part 2

Beaglebone Black : Back Up Ubuntu

I didn’t include the wireless, cloud9, or OpenGate for this because I wasn’t sure where I was going to put WordPress and was concerned with space.  Turns out, that space wasn’t an issue (other than bleeding off CPU cycles).

Once I had my base install configured, I needed to install and configure three additional components before WordPress:

  • mySQL Database
  • Apache Web Server
  • PHP Scripting Language

This comprises what is called a LAMP server (Linux Apache Mysql Php)

Installing LAMP on BeagleBone Black Ubuntu

At first, I thought this was going to be easy.  I found a package in the package manager for installing LAMP and tried it out.  I’m not saying it doesn’t work, but I will say that I had to reflash a couple times and it never really worked well for me.  Also, I really wanted to have a little more control over what I was installing, so I ended up installing and configuring each component separately.  We’re going to do that here.  I based my steps off a couple walk-through guides found on Ubuntu Server Guide and  DigitalOcean.com (links to these and other resources will be found at the end of this walk-through).

MySQL Installation and Configuration

Real quick, before we start installing packages, let’s make sure we’re up to date with everything:

sudo apt-get update
sudo apt-get upgrade

Since we already have the Linux part of LAMP, let’s move to mySQL. You can install this with a simple command of:

sudo apt-get install mysql-server

You will be prompted to provide a password for the root account.  It is always strongly advised to do so and remember this password.  If you forget, you won’t be able to move forward.

Once the install is complete, we need to test the install and then create a database for our installation.  Before we continue, think about the name or type of WordPress site you want to create.  Since mine is to help teach my son about science, I will call mine, ‘science’.  You want to keep it small and if you have more than two words, separate with underscores or dashes (‘_’ or ‘-’).

To test your installation, type:

mysql -u root -p

You will be prompted to for the password you provided during the installation.  Once you have successfully done this, type:

show databases;

This command will list out a table of databases that are currently available.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.01 sec)

If you have made it this far, you are ready to continue.

Now we need to create a user, a table, and provide permissions.  I used ‘scienceadmin‘ for the username and ‘science‘ for the database.  Simply replace these with your credentials.  Oh, and with these commands, don’t forget the semicolon. If you do, it’s not a big deal, just type `;` on the next line and the command will execute.

Create the Database:

create database science;

Create the user:

create user scienceadmin@localhost;

Set a password for this user:

set password for scienceadmin@localhost=password("squirrelhunter01");

Create the permissions for this user to use the database:

grant all privileges on science.* to scienceadmin@localhost identified by 'squirrelhunter01';

Finally, let’s refresh MySQL:

flush privileges;

To get out of mySQL:

exit

Installing Apache Web Server

beagleThis will be pretty straight forward.  To install the web server, you enter in:

sudo apt-get install apache2

After the install you can start it up with this command:

sudo service apache2 start

and test it in your browser: “http<beaglebone IP or personalized hostname>/”

You should see the “It Works!” page.

We’re done with Apache for now.

Installing PHP

To install or update PHP, run the following command:

sudo apt-get install php5 libapache2-mod-php5 php5-mysql

Once this is complete, let’s test it.  Navigate to /var/www and create a file named, ‘test.php‘ then add the following text:

<?php
 phpinfo();
?>

Next, fire up a web browser and navigate to `http://<bbb_IP>/test.php`.

You should see a page filled with server/site/php goodness.

And we are done with the LAMP installation.  Easy right?

WordPress Install and Configuration

Now we get to the meat of this walk-through.  Let’s first decide where we’re going to put our WordPress site.  When you download WordPress and unpack it, you can put it in your root or in a sub-folder.  You an even have several instances running at the same time in several folders.  When I was working through this, I went a road less traveled by putting the site on a thumb drive and created a symlink from the web server root.  This creates quite a mess (I will write up a way to do this shortly) but for the purpose of getting a wordpress site up and running, we’ll start with the easy way.

The Easy Way

At this point, I am showing 1.1 GB of free drive space.  This should be more than apache_featherplenty to run WordPress right off the BBB.  First let’s download the WordPress files.  I can simply download the latest version to my home directory like this:

dfrey@ubuntu-armhf:~$ cd
dfrey@ubuntu-armhf:~$ wget -O wordpress.tar.gz http://wordpress.org/latest.tar.gz
...
dfrey@ubuntu-armhf:~$ tar -xvpzf wordpress.tar.gz

...

Now, we should have the WordPress site files that I can copy to any directory.  Let’s try it out in the root of our web site.

sudo cp -r wordpress/* /var/www/

This just copied all the files to the root of my web server.  Let’s go check it out in the browser: `http://<bbb_ip>/`

huh?  We still get the same message as before.  Well, this is because we need to configure a couple things.  Since this is a manual installation of WordPress, we have a little more work to do but it’s easy.

In your browser, navigate to, `http://<bbb_ip>/wp-admin/`

You should see a message indicating the wp-config.ini is missing.  Click the `Create a Configuration File` button and you will navigate to the setup configuration introduction page.  You are going to need to have the following ready (we did most of this already so it’s no big deal).  I’ll add my info from above as an example:

  1. Database name – ‘science
  2. Database username ‘scienceadmin
  3. Database password ‘squirrelhunter01
  4. Database host ‘localhost
  5. Table prefix (if you want to run more than one WordPress in a single database) – You can create whatever prefix you like.  If I were going to put more than one WP site in the same database on this BBB, I would choose, ‘sci_‘, but for now we’ll go with ‘wp_

And click ‘Submit

When I ran this, The wp-config.php file couldn’t be written.  Not that this is a huge problem now but it will be shortly so let’s address this issue now.

We installed Apache as root, so the folders that where created by the installer are owned by root.  Apache runs under a user named www-data.  We need to change the ownership of the www folder so that apache can do it’s magic.  Navigate to /var then run this command:

sudo chown -R www-data:www-data www

This will change the ownership and group membership of the www folder and everything underneath it.  Now we can continue.  Hit your back button in the browser so you can see the configuration form again.  Click submit again and you should now get the “All right Sparky…” message indicating the config file was created successfully.

Now, let’s head on to setting up the actual WordPress site.   Click the “Run the Install” button.  Here, you will enter the title of the site that displays on the header,  the user name of the site administrator and the password for this user.  Don’t worry.  You didn’t miss anything, we’ll create this account inside of WordPress now.  These are for the site not the database.  They can be completely different or exactly the same.  It’s up to you.

Site Title:     Science
Username:  scienceguy
Password:   tesla@24
Email:          scienceguy@gmail.com (just made that up)
Privacy:       (turned this off)

Now click on the ‘Install WordPress` button.  The scripts will run for a while then take you to the `Success Page`.  Click Login then enter your username and password.  If everything was done correctly, you now have a spanky brand new WordPress site.

After installing, I still have just under 1GB of space left.  If you intend to install other things on your BBB, you might want to install other things off the board, on a thumb drive.  That walk-though will be coming in a couple days.

Oh, I forgot one thing.   You need to remove two files from your /var/www folder:

  1. index.html – this will override the WordPress pages (its why we didn’t get an error when we tried it before configuring WordPress)
  2. test.php – this has some server-specific information that a hacker could use against your BBB.

Now got to `http://<bbb_ip>/&gt;` in your browser and you will see the public version of your site.  Go WordPress Crazy and have fun.

Feel free to leave comments if you have any questions or if you found this walk-though useful.

I got so excited to post this, I forgot my link references.  Here you go:

http://codex.wordpress.org/Installing_WordPress

https://help.ubuntu.com/community/ApacheMySQLPHP

http://ubuntuserverguide.com/2012/05/how-to-install-latest-wordpress-in-ubuntu-server-12-04-lts.html

http://www.pantz.org/software/mysql/mysqlcommands.html

http://www.cyberciti.biz/faq/how-do-i-test-php-installation-with-a-phpinfo-page/

https://www.evernote.com/Home.action#st=p&n=01d839eb-0539-47a5-b341-e04b59320d66

https://www.digitalocean.com/community/articles/how-to-install-wordpress-on-ubuntu-12-04

About these ads

9 thoughts on “BeagleBone Black : WordPress On Ubuntu

  1. I did some looking at the PandaBoard a while back. Looking at it now, this is at least worth looking into. It has a LOT more bells an whistles on it including a dual 1Ghz ARM processor and 1GB of low-power ram plus lots of other gizmos. Personally, I would love to get my hands on one and put it through its paces.

    Here’s a link to the specs for the Pandaboard: http://pandaboard.org/content/resources/references

    Please let me know if you decide to go with the Panda and how it works out for you.

    Best regards…

  2. Hi David,
    Thanks for suggestions. You have written that for a production solution, you would recommend something else. I would like to know the name/details of that ARM processor based single board computer which can be used a desktop PC with a lightweight Linux distribution for software development work in LAMP environment. Due to low power consumption and low cost of ARM processor I want to use this processor as a desktop computer. Since my main work is software development work in LAMP environment and most of the single computer solution based on ARM processor are supporting Linux environment and so I want to use it is as primary desktop solution. At this moment I am using a Pentium IV computer with 1GB RAM and ArchLinux operating system. And I am satisfied with its performance. So if you can suggest me a ARM alternative for Pentium-IV desktop then it will be very much helpful for this. Please note that in case of using a single board computer with ARM processor the same computer can be used as a desktop computer as well as a laptop computer. Only I will have to keep two sets of keyboard, mouse and monitor. The other components of computer will remain same. That is why I am searching for ARM computer. If know any one then please suggest me.

    Best Regards …
    Pankaj Kumar

  3. Hi David, Thanks for suggestions. You have written that for a production solution, you would recommend something else. I would like to know the name/details of that ARM processor based single board computer which can be used a desktop PC with a lightweight Linux distribution for software development work in LAMP environment. Due to low power consumption and low cost of ARM processor I want to use this processor as a desktop computer. Since my main work is software development work in LAMP environment and most of the single computer solution based on ARM processor are supporting Linux environment and so I want to use it is as primary desktop solution. At this moment I am using a Pentium IV computer with 1GB RAM and ArchLinux operating system. And I am satisfied with its performance. So if you can suggest me a ARM alternative for Pentium-IV desktop then it will be very much helpful for this. Please note that in case of using a single board computer with ARM processor the same computer can be used as a desktop computer as well as a laptop computer. Only I will have to keep two sets of keyboard, mouse and monitor. The other components of computer will remain same. That is why I am searching for ARM computer. If know any one then please suggest me.

    Best Regards … Pankaj Kumar

  4. Pankaj,

    While building the LAMP stack on the BBB was an academic endeavor, I found the end result to be lethargic. For small proof-of-concept projects with little to no budget, the BBB shines. For a production solution, I would recommend something else.

    Having said that, I was able to backup another WordPress blog of mine (digitalrecordingonline.com) and import it into my BBB with WordPress running and all the content was preserved. After moving the assets around as well, I was able to recreate my production blog on the BBB without issue. Well, the latency was about 3-5 seconds greater on average for page loads. I was sure that it was going to buckle under the strain and catch on fire but it soldiered on. So, I guess it all depends on what type of development you are talking about.

    Also, I have been able to compile and run Java apps, groovy scripts, and I was even able to get Grails running on it. All of this was done before I discovered the ability to open up an 8GB SD Card and the performance was slow.

    Your questions are valid and intriguing. Perhaps after I finish my walk-through with FFMPEG and FSWebcam, I will start a series on using the BBB as a development platform.

    To sum up, I think making the BBB is a valid platform for writing code if performance is not your #1 requirement. It’s a little beast and capable of a lot more than I originally gave it credit for.

    Lastly, I have not attempted ArchLinux yet, but I have read a lot of makes, especially quadcopter builders, use it. That’s another walkthrough I should attempt.

    Hope that helps and thanks for your comment.

  5. Hi,
    I am also planning to start LAMP development work on BeagleBone Black as a primary workstation. Can you please clarify whether the performance of a BeagleBlack Bone computer is good enough to be used a day to day computer by a Linux developer? Is there any performance issue associated with it like hanging out the processor etc. Have you ever tried ArchLinuxARM on this computer?

    Best Regards …
    Pankaj Kumar

  6. Pingback: จับ Wordpress ยั&...

  7. Pingback: BeagleBone Black : WordPress On Ubuntu | SEO We...

  8. Pingback: BeagleBone Black : WordPress On Ubuntu | Raspbe...

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s