This is the second article in a series in which I want to introduce some LowCost computer solutions for our computer infrastructure.
In the first article I showed how to create the basis for future solutions that we can implement.
In this second article, and based on that basis, we will implement a Web server, popularly known as LAMP (Linux, Apache, Mysql and PHP).
- (I use a raspberry PI B, so it serves almost any model)
- (with base system)
- (serves almost any micro-USB mobile charger)
- (optional but highly recommended)
- (You can use a, you will see in another article)
Before doing anything new, an important step is to update the raspberry system to make sure it is with the newer stable version and avoid possible problems.
The steps to update are very simple.
We connect the raspberry and run first
$ sudo apt-get update
Then we run
$ sudo apt-get upgrade
With this we have updated the system and we can move to do the installation of the Web server.
To install the Apache Web server, simply run the following command.
$ sudo apt-get install apache2
When you have finished the installation we can verify that Apache is already running with the command
$ Service Apache2 Status
We can also check that there is a default Web page on the path:/var/www/html/index.html
In addition, if we put the IP address of the raspberry, we can access by the Web browser to the page by default.
With all this we could say that we already have the operating Web server, but we still need to install some more components to add more features and be able to host more complex web sites.
To be able to have more complex web pages, dynamic, or to be able to host Web sites like WordPress, Drupal, Joomla,… we need, among other things, to install PHP
To install PHP we will execute the following.
$ sudo apt-get install php5 libapache2-mod-php5
After installing PHP, we can create a page called "info. PHP", for example.
$ sudo nano/var/www/html/info.php
With the following content:
With this, if we access with the browser to http://direccionraspberry/info.php will show us a page with information about PHP installed.
In order to have complex web sites we also need a database server.
In this case we will install MySQL.
To install the necessary components, we will execute the following.
$ sudo apt-get install mysql-server MySQL-client php5-MySQL
In this way we install the MySQL server, the MySQL client and PHP components for MySQL integration.
During the installation process we will ask for the password for the MySQL Admin user
As an extra part, and to make it easier to administer the MySQL server, we will install PHPMyAdmin, which is a Web administrator for MySQL.
To perform the installation we will execute the following:
$ sudo apt-get install phpMyAdmin
During the installation, we select "Apache2" as a Web server.
To finish the installation, ask to install the administrative DB
We tell him yes.
Then you ask for the MySQL Administrator password to install the DB.
And also asks us to set a password for PHPMyAdmin. We can use the same as for MySQL.
and password Confirmation
When it ends we can enter http://direccionraspberry/phpmyadmin
Now we can manage our MySQL database server from the Web interface.
After all this process we have installed the Web server, PHP, MySQL database server and MySQL Web administration.
Important: You have to be clear that performance is not going to be the same as if it were installed on a server or hosted on a hosting service, but to host sites that do not require much performance, testing, developing websites and/or Web applications, It can be perfectly useful and very low cost.
I hope you find it useful.