UDOO web server

Everyone has heard the word “Server” almost once in his life. A server basically is a machine which hosts something, could be a service, a web page, a database and so on. Servers are so ubiquitous because they allow lot of other devices, clients, to connect to them and rely on their serving capabilities to perform an endless range of operations.

UDOO can be both a Server and a client, thanks to its linux-based operating system. Today we are going to learn how to use UDOO as a Web Server. But why would we need to turn UDOO into such thing?
For many reasons, such as:

  • We can use UDOO as a local web server, using it to host custom built web pages
  • We can access UDOO from everywhere, all over the world
  • We can control UDOO operations from a wide range of devices (both through internet or local network)

This will allow our projects to be as connected as we want them to be, for example remote controlling them via a web user interface. Or to check our project status thousands of kilometers away. We can also develop complex interactive systems, that will be connected to every device we want, through internet or local network. Ever heard about internet of things?

Sounds amazing, isn’t it?

So, lets start!

What we are going to need is a particular software environment, called LAMP. Lamp is the acronym of Linux, Apache, MySQL and PHP. Distinct utilities that combined constitute the basis of every Web Server (there are however some variants, but this is generally accepted to be the standard).

We basically have two pathways to get thigs done:

First, the pre-cooked way

We can use tasksel, an utility which can download and install groups of softwares for a particular use.

sudo apt-get install tasksel

APTINSTALL
Once launched we can use it to install the LAMP Server metapackage (aka group of softwares)

sudo tasksel

TASKEL
just select LAMP Server with spacebar and hit enter

Take a coffe while tasksel does the dirty work for you

Second, how real man do it

Cool people know what they are about to do. So we’ll take an in depth view of every software in the LAMP package, and their specific purpose. So you’ll have an idea of what does what, and why we need all of them:

  • Apache
    Apache is our web-server, the actual software which handles incoming connections and serves requested web pages.
    To install it: 

    sudo apt-get install apache2

    To make sure the access rights are correct type:

    sudo groupadd www-data
    sudo usermod -g www-data www-data
    sudo chown -R www-data:www-data /var/www
  • PHP5
    PHP5 is the php interpreter, this serves up php code to the Apache server
    To install it: 

    sudo apt-get install php5 php5-cli
  • MySql-Server
    Mysql server is the database holder. We’ll use it to insert the data we need in a database, useful for creating web pages with the data we need.
    They should have been installed along with Apache, in the previous steps. However, to be sure you can install them with: 

    sudo apt-get install mysql-server mysql-client
  • PHP5-mysql and phpmyadmin
    These are needed to integrate sql database with php interpreter. This will allow web pages to handle and interact our databases. Phpmyadmin is a handy tool to create and manage databases. You’ll be asked to set a root password, just to be sure, create a strong password (you should always take extra caution when root access is involved). Then, when you’ll be asked to choose from Apache or Httpd, choose Apache, since this is the web server we are using.
    We are going to install them along with Nano, a useful text editor, with: 

    sudo apt-get install php5-mysql phpmyadmin php5-curl nano

    After the installation has completed, add phpmyadmin to the apache configuration. So, edit Apache configuration with:

    sudo nano /etc/apache2/apache2.conf

    And paste the phpmyadmin apache configuration string to the bottom of the file

    Include /etc/phpmyadmin/apache.conf

    Then restart apache, to allow our modifications to take place:

    sudo service apache2 restart
  • Done!

Time to see if everything is set up properly. To do so, open a web browser on Udoo and type

http://localhost

you should see the following:
itworks

That means that Apache is running correctly.

Now, let’s see if also phpmyadmin is properly set:

http://localhost/phpmyadmin

PHPMYADMIN

If all above works, that means that we can access locally our brand new LAMP server.

The root of your webserver, the path where your webpages are located, is

/var/www

You can replace the default index.html page with your custom ones. If you wish you can also install WordPress, Joomla or the CMS you prefer here. Just copy the needed files into that folder.
After copying your custom pages on /var/www, remember to restart the apache service with:

sudo service apache2 restart

But, we’re only half way through it. Of course, what we need is to access it from our network, or from internet.

To check if our Udoo is visible from our network, just use the same commands as above, but typing UDOO’s IP instead of localhost. So:

http://192.168.1.12/
http://192.168.1.12/phpmyadmin

If everything is all right, you did it!

Submit a comment

Our crowdfunding campaign is live!

Support us backing UDOO Neo now!