This tutorial explains how to have a LAMP server running Drupal on a PandaBoard. These instructions will apply to any other Cortex-A platform with few or no changes.
The growing variety of ARMv7-based inexpensive and easy to use devices, like PandaBoard, opens the door to leveraging ARM energy efficient and small form factor performance with server software. The availability of the Ubuntu Linux distribution for ARM, makes this a really simple task. The possible applications are many: domestic server, small business server, hobbyist experimentation, web development.
It can also be used to gain experience and become more prepared for the arrival of large-scale, ARM-based server systems.
One of the most well-known server software stacks is LAMP. There are many varieties of LAMP, but the most common is the combination of
Drupal is a versatile, well-known, open source platform running on top of this stack. The software is a generic Content Management System, used as the basis for many sites, from blogs to community forums to government web pages. Notable examples are The White House, Ubuntu, FastCompany, KernelTrap, AOL Corporation, AOL Developer, Sony music, NASA - Appel, Warner Bros., Greenpeace UK, United Nations end proverty 2015, Harvard's Science and Engineering department, Amnesty international, GigaOM - Ostatic or Bob Dylan.
Current there are two stable versions available Drupal 6 and Drupal 7. The latest version was released recently and includes many new features. However, Drupal 6 installation has been completely automated in Ubuntu Maverick, making it much easier to get started. For this reason we have included in this tutorial instructions for both. You can install Drupal 6 just doing steps 1 and 2 or install Drupal 7 doing steps 1 to 7. You can find more about Drupal 7's new features here.
We start with Ubuntu Maverick 10.10 installed on our PandaBoard. Other linux distributions should work, but this tutorial is tailored to Ubuntu Maverick 10.10.
The instructions to install Ubuntu on the PandaBoard can be found here:http://omappedia.org/wiki/Ubuntu_Pre-built_Binaries_Guide
This tutorial is console based. Although the level of integration in Ubuntu makes it possible to do most or all of the tasks in this tutorial using the GUI, we considered the console to be a more natural way of configuring a server. Actually, you probably want to administer it by SSH.
Before you start, check that your PandaBoard is correctly connected to the internet and the distribution is updated. Then, you should access the console. Click on Accessories in the left panel and then on Terminal in the main panel.
This step is optional and you can do all the next steps using a terminal on the PandaBoard. However, you probably will need to administer your web server remotely.
To install a SSH server all we need to do is to execute the following command. Remember that when you issue 'sudo' commands, the system may ask you for your password sometimes.
$ sudo apt-get install openssh-server
SSH server is installed, and we can connect remotely to our PandaBoard console. If the installation fails and you see error messages, you can check the Ubuntu manual at https://help.ubuntu.com/10.10/add-applications/C/installing.html.
We need to know the PandaBoard IP address. For this we can issue the following command:
$ ip addr
Its output is something like:
1: lo: mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: usb0: mtu 1492 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 10.1.67.53/24 brd 10.1.67.255 scope global usb0
3: tiwlan0: mtu 1500 qdisc pfifo_fast state DORMANT qlen 100
If you are connecting your PandaBoard to the network using wired ethernet you should look in the usb0section, if you are connect by wifi look in the tiwlan0 section. There we should see a inet subsection, the first four numbers separated by dots is the IP address of your PandaBoard. In this example it is:
10.1.67.53
If you cannot find your IP address, you are probably not connected to the internet, you can check the Ubuntu manual about this in https://help.ubuntu.com/10.10/internet/C/index.html. Now it is possible to connect to the PandaBoard console from any computer connected to the network, or the whole internet if your router is appropriately configured. All you need to do if you want to connect from another computer (another PandaBoard for example) in the LAN is to execute:
$ ssh username@10.1.67.53
Where username is your user name on the PandaBoard and substituting the IP address y the one you found earlier. When you execute this you will be asked for your password and then you will be at the console in your board from a remote computer.
You can now proceed with rest of this tutorial from your desktop computer, mobile phone, tablet or another PandaBoard using SSH. Also, you can do the rest of the tutorial using the console in the PandaBoard itself.
If you would like to install Drupal 6 you just need to complete this step, ignoring steps 3 to 7. If you prefer to install Drupal 7 and experience all the new features you need to jump to the next section (Step 2b) and follow from there to the end of the tutorial
Ubuntu provides a Drupal 6 package which makes the task of installing Drupal extremely easy.
We start with:
$ sudo apt-get install drupal6 mysql-server
You will see something like this
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common curl dbconfig-common fontconfig-config libapache2-mod-php5 libapr1
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libcurl3 libdbd-mysql-perl libdbi-perl libfontconfig1 libgd2-xpm libidn11 libmysqlclient16
libnet-daemon-perl libplrpc-perl libt1-5 libxpm4 mysql-client-5.1 mysql-client-core-5.1 mysql-common mysql-server-5.1 mysql-server-core-5.1 php5
php5-common php5-gd php5-mysql postfix ssl-cert ttf-dejavu-core wwwconfig-common
Suggested packages:
www-browser apache2-doc apache2-suexec apache2-suexec-custom ufw virtual-mysql-client mysql-client postgresql-client php-pear libgd-tools
libterm-readkey-perl tinyca mailx php5-suhosin procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre sasl2-bin libsasl2-modules resolvconf
postfix-cdb mail-reader openssl-blacklist apache apache-ssl
Recommended packages:
php5-cli libhtml-template-perl
The following NEW packages will be installed:
apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common curl dbconfig-common drupal6 fontconfig-config libapache2-mod-php5 libapr1
libnet-daemon-perl libplrpc-perl libt1-5 libxpm4 mysql-client-5.1 mysql-client-core-5.1 mysql-common mysql-server mysql-server-5.1
mysql-server-core-5.1 php5 php5-common php5-gd php5-mysql postfix ssl-cert ttf-dejavu-core wwwconfig-common
0 upgraded, 39 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/36.3MB of archives.
After this operation, 83.9MB of additional disk space will be used.
Do you want to continue [Y/n]?
As you can see, APT will download Drupal 6 and all packages it depends on, this includes MySQL and Apache. During the installation a few dialogs will to configure these packages. Now, just press 'y' and 'enter' to continue.
The first dialog will ask you to enter the root password for MySQL. Take into account that this is a different user from the Linux root. The MySQL root user has complete administrative access to your MySQL server. Choose a strong password, you will not need to type it very often, probably just when you need to add databases and users to MySQL.
The next screen will simply ask you to retype the MySQL root password.
The next configuration dialog you may see is to configure postfix. Postfix is a mail server, and proper configuration may be required in order to Drupal being able to send mails away. Although, this may be useful it exceeds the scope of this tutorial. For now, just select 'No configuration'. You can later configure it at any time with the following command:
$ sudo dpkg-reconfigure postfix
The next dialog will inform you that after APT is finishing installing Drupal 6, it will be required a few more steps. This is not a problem as we will guide you through those steps too. So just select 'Ok'.
The next dialog will ask you whether you would like Ubuntu to help you configuring Drupal 6 access to the database. Answer 'yes', as this feature is the reason you may prefer Drupal 6 over 7.
Now, the system asks you which DB management system you plan to use. Select 'mysql' as this is the one we are using for this tutorial.
The next screen asks you for the administrative password of the database. This actually means the MySQL root password we previously set. The Drupal installation needs to know it to create the Drupal database.
Now, the system asks you for the password that Drupal should use to access the database. Leave it blank, as the system will generate a random password and store it in Drupal. You do not need to know this password as it is not used to access Drupal itself, but for communication between Drupal and MySQL.
The system now will finish the installation. It will create a database called drupal6 and a user called drupal6 with access to that database. This user will have a randomly generated password that will be stored in Drupal source code. To finish, we must restart Apache and access Drupal to do some simple configuration.
Execute:
$ sudo service apache2 restart
We can access our Drupal installation to set the last options before it is ready. Point your browser to the following URL, changing the IP address for your PandaBoard IP address.<
http://10.1.67.53/drupal6/install.php
Click 'Install Drupal in English'. It is possible to install Drupal in many languages, but this process exceeds the scope of this tutorial.
Drupal will do some auto configuration.
Finally, you will have to fill a form with general information of the site. The most important part is the 'administrator account', this account will be the one you will need to use to access Drupal for administration. After filling the form, press 'Save and continue'.
Congratulations, Drupal is now fully installed in your system. If you see a warning telling you that Drupal is unable to send e-mails, this is because we did not configure postfix, but the system is ok. Enjoy Drupal 6 on your PandaBoard.
Follow these instructions to the end of this tutorial to install Drupal 7. If you would like to install Drupal 6 instead, go to the previous section (Step 2a).
Now you need to install the LAMP packages, this effectively includes Apache, PHP and MySQL. You can do it the easy way using tasksel.
$ sudo apt-get install tasksel
$ sudo tasksel install lamp-server
This will start the installation of all the basic LAMP packages.
A dialog titled "Configuring mysql-server-5.1 will show up". Enter a new password for the MySQL root user.
Once all packages have been installed, tasksel has finished, direct your browser to the PandaBoard IP address, for example: "http://10.1.67.53".
You will see the first web page served by your PandaBoard. It should say "It works!". If this does not work, you probably have the wrong IP address or the installation has failed.
A basic LAMP environment is installed. Additionally, you need to add the PHP GD extension in order to enjoy Drupal completely. This is achieved using the following command:
$ sudo apt-get install php5-gd
Before installing Drupal, in MySQL you need to create a database and an user to access it. In this example we will use "drupal" to name both.
sudo mysqladmin -u root -p create drupal
This will prompt for the previously set MySQL root user password, and create a database called drupal. You can create a database user using the MySQL prompt. In the following code we use 'secret' as the password - change this to a password you prefer.
$ mysql -u root -p
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES, CREATE TEMPORARY TABLES ON `drupal`.*
TO 'drupal'@'localhost' IDENTIFIED BY 'secret';
mysql> quit
This will create the "drupal" user with privilege on the "drupal" database and password "secret" or the one you set.
At this point, download Drupal files and store them on /srv/www. Use the following commands. In case the URL to download Drupal 7 has changed, the first command may report errors, find the correct URL and replace it if that is the case.
$ wget http://ftp.drupal.or...upal-7.0.tar.gz
$ sudo mkdir -p /srv/www/
$ sudo tar xzf drupal-7.0.tar.gz -C /srv/www
Drupal files are now in /srv/www/drupal-7.0.
You must tell Apache where to find the Drupal files. First copy the default site configuration file to another file, and edit it to set the right configuration.
$ sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/drupal
$ sudo nano /etc/apache2/sites-available/drupal
In the new file, set DocumentRoot to /srv/www/drupal-7.0. Also, change the Directory directive from /var/www/to /srv/www/drupal-7.0. The configuration for cgi-bin and apache documentation may be deleted as they are not required.
The resulting file may look something similar to this:
ServerAdmin webmaster@localhost
DocumentRoot /srv/www/drupal-7.0
Options FollowSymLinks
AllowOverride None
Options Indexes FollowSymLinks MultiViews
Order allow,deny
allow from all
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Next step is to enable our site configuration and disable the default one.
$ sudo a2ensite drupal
$ sudo a2dissite default
You can now complete the installation of Drupal. First you need to create a file to store the installations settings - this should be done from a template.
$ sudo cp /srv/www/drupal-7.0/sites/default/default.settings.php /srv/www/drupal-7.0/sites/default/settings.php
You should now tune some permissions. We need to allow the web server to write the settings and create a directory for uploads. Also, we need to give read access to all Drupal files.
$ sudo chown -R root.www-data /srv/www/drupal-7.0/
$ sudo chmod -R u+rwX /srv/www/drupal-7.0/
$ sudo chmod -R g+rX /srv/www/drupal-7.0/
$ sudo chmod g+rwx /srv/www/drupal-7.0/sites/default/
$ sudo chmod g+rw /srv/www/drupal-7.0/sites/default/settings.php
You should launch the browser with the same URL that we used previously in step 2. You will see in the Drupal installer.
Select the type of profile you would like and click on "Save and continue". When asked about the language press "Save and continue". We get to the important part on this step: insert the connection data for our database. In our example this would be drupal/drupal/secret, although you may have chosen a better password in step 3. Click on "Save and continue".
Drupal will install the tables in the database.
At this point the rest of the installation process is up to you. You must choose a site name, admin username and password, etc... After that, you will be able to access your new site!!
Finally, you should set some file permissions, so unauthorised users can not change the Drupal code.
$ sudo chmod -R g-w /srv/www/drupal-7.0/
$ sudo chmod -R o-rwx /srv/www/drupal-7.0/
$ sudo chmod -R g+w /srv/www/drupal-7.0/sites/default/files
You can now start enjoying your Drupal installation on the PandaBoard.