LAMP es un modelo de arquitectura pila de servidor Web nombrado como acrónimo de cuatro componentes open-source: Linux, Apache, MySQL, PHP. La definición "arquitectura pila" surge a partir de cómo se organiza el software en capas, cada una dando soporte a las capas superiores. LAMP se organiza con Linux como sistema operativo (¡a la hoguera! se escribe GNU/Linux y el término debería ser GLAMP), Apache como servidor HTTP/HTTPS, MySQL/MariaDB como servidor de bases de datos, y PHP/Perl/Python como lenguaje de programación/CGI scripting. LAMP es el modelo más popular para crear y dar soporte a aplicaciones Web en Internet desde hace tiempo.

Este breve artículo muestra cómo instalar y configurar rápidamente un stack LAMP sobre sistemas operativos Debian/Devuan y derivados basado en MySQL y PHP.

Este tutorial asume que ya se cuenta con el sistema operativo Debian o Devuan instalado y en perfecto funcionamiento.

Apache

El primer paso consiste en instalar Apache. Tema que ya fue cubierto en el artículo anterior: Cómo instalar Apache en Debian/Devuan.

MySQL

Ya estamos a mitad de camino, sólo nos falta la 'M' y la 'P' para completar el acrónimo. Para instalar el motor de bases de datos relacionales (RDBMS) MySQL, ejecutar:

# apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

Durante la instalación del servidor MySQL se solicita que el usuario especifique una contraseña para el usuario "root", el superusuario del motor de bases de datos. Es importante establecer una contraseña fuerte y por supuesto no olvidarla (KeePass es una buena aplicación para no olvidar contraseñas). De todas formas, si nos olvidamos la contraseña de root de MySQL, existe una forma de recuperarla.

Una vez instalado MySQL, se recomienda correr el script mysql_secure_installation para mejorar la seguridad del servidor.

De forma alternativa, es posible compilar el servidor MySQL desde el código fuente.

PHP

El último paso consiste en instalar PHP:

# apt-get install php5 libapache2-mod-php5 php5-mcrypt

Dependiendo de la aplicación PHP a desarrollar/instalar, tal vez sea necesario instalar módulos de PHP adicionales. Para listar todos los módulos de PHP disponibles, es posible ejecutar:

# apt-cache search "^php5-"

Por ejemplo, en Devuan Jessie 1.0 se encuentran disponibles los siguientes módulos para PHP versión 5:

root@devuan:~# apt-cache search "^php5-"
php5-exactimage - fast image manipulation library (PHP bindings)
php5-gdcm - Grassroots DICOM PHP5 bindings
php5-vtkgdcm - Grassroots DICOM VTK PHP bindings
php5-geos - GEOS bindings for PHP
php5-lasso - Library for Liberty Alliance and SAML protocols - PHP 5 bindings
php5-libvirt-php - libvirt bindings for PHP
php5-adodb - Extension optimising the ADOdb database abstraction library
php5-apcu - APC User Cache for PHP 5
php5-gearman - PHP wrapper to libgearman
php5-geoip - GeoIP module for php5
php5-gnupg - wrapper around the gpgme library
php5-igbinary - igbinary extension
php5-imagick - Provides a wrapper to the ImageMagick library
php5-json - JSON module for php5
php5-memcache - memcache extension module for PHP5
php5-memcached - memcached extension module for PHP5, uses libmemcached
php5-mongo - MongoDB database driver
php5-msgpack - PHP extension for interfacing with MessagePack
php5-mysqlnd-ms - MySQL replication and load balancing module for PHP
php5-oauth - OAuth 1.0 consumer and provider extension
php5-pecl-http - pecl_http module for PHP 5 Extended HTTP Support
php5-pecl-http-dev - pecl_http module for PHP 5 Extended HTTP Support development headers
php5-pinba - Pinba module for PHP 5
php5-propro - propro module for PHP 5
php5-propro-dev - propro module for PHP 5 development headers
php5-radius - PECL radius module for PHP 5
php5-raphf - raphf module for PHP 5
php5-raphf-dev - raphf module for PHP 5 development headers
php5-redis - PHP extension for interfacing with Redis
php5-rrd - PHP bindings to rrd tool system
php5-sasl - Cyrus SASL Extension
php5-solr - solr module for PHP 5
php5-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP 5
php5-svn - PHP Bindings for the Subversion Revision control system
php5-tokyo-tyrant - PHP interface to Tokyo Cabinet's network interface, Tokyo Tyrant
php5-yac - YAC (Yet Another Cache) for PHP 5
php5-zmq - ZeroMQ messaging
php5-librdf - PHP5 language bindings for the Redland RDF library
php5-remctl - PECL module for Kerberos-authenticated command execution
php5-uprofiler - hierarchical profiler for PHP (extension)
php5-xcache - Fast, stable PHP opcode cacher
php5-xdebug - Xdebug Module for PHP 5
php5-xhprof - Hierarchical Profiler for PHP5
php5-mapscript - php5-cgi module for MapServer
php5-ssh2 - Bindings for the libssh2 library
php5-cgi - server-side, HTML-embedded scripting language (CGI binary)
php5-cli - command-line interpreter for the php5 scripting language
php5-common - Common files for packages built from the php5 source
php5-curl - CURL module for php5
php5-dbg - Debug symbols for PHP5
php5-dev - Files for PHP5 module development
php5-enchant - Enchant module for php5
php5-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php5-gd - GD module for php5
php5-gmp - GMP module for php5
php5-imap - IMAP module for php5
php5-interbase - interbase/firebird module for php5
php5-intl - internationalisation module for php5
php5-ldap - LDAP module for php5
php5-mcrypt - MCrypt module for php5
php5-mysql - MySQL module for php5
php5-mysqlnd - MySQL module for php5 (Native Driver)
php5-odbc - ODBC module for php5
php5-pgsql - PostgreSQL module for php5
php5-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php5-pspell - pspell module for php5
php5-readline - Readline module for php5
php5-recode - recode module for php5
php5-snmp - SNMP module for php5
php5-sqlite - SQLite module for php5
php5-sybase - Sybase / MS SQL Server module for php5
php5-tidy - tidy module for php5
php5-xmlrpc - XML-RPC module for php5
php5-xsl - XSL module for php5
php5-twig - Enhance performance of the Twig template engine

Luego simplemente instalar todos los módulos de PHP necesarios ejecutando apt-get install MODULO.

Con esto último hemos finalizado la instalación de nuestro stack LAMP. Sólo resta comprobar el correcto funcionamiento del servidor LAMP.

Alternativas (muchas) a Linux, Apache, MySQL y PHP

Si se necesita dar soporte a aplicaciones Web desarrolladas en lenguaje Python, anteriormente expliqué cómo montar un servidor LAMP en Debian con Python.

Al mismo tiempo, si se desea mantener Apache pero cambiar MySQL/MariaDB por PostgreSQL, dirigirse al siguiente enlace: Linux+Apache+Python+PostgreSQL.

Actualmente Nginx ha ganado mucha popularidad, debido a su eficiencia y robustez, y ha reemplazado a Apache en muchos servidores. En artículos anteriores expliqué cómo instalar stacks similares a LAMP pero utilizando Nginx (se conocen popularmente como LEMP): Instalación y configuración de Nginx con PHP-FPM. Para contar con soporte para HTTPS, dirigirse al artículo: Cómo compilar Nginx con soporte para SSL.

Para el caso de aplicaciones Python desarrolladas con el framework Flask, es posible montar un esquema Nginx con uWSGI.

¿No te gusta GNU/Linux? Podés montar un servidor Web utilizando OpenBSD con httpd y soporte para PHP. O mi favorito, Nginx con PHP-FPM en FreeBSD.

Está claro que existen innumerables formas de montar un servidor Web.

 

Fuente: linuxito

¿Quién está en línea?

Hay 19078 invitados y ningún miembro en línea