Skip to content

Instantly share code, notes, and snippets.

@Skeiceee
Last active July 26, 2019 20:05
Show Gist options
  • Save Skeiceee/41cd21d6717dab9f6fd3820eb304d1fa to your computer and use it in GitHub Desktop.
Save Skeiceee/41cd21d6717dab9f6fd3820eb304d1fa to your computer and use it in GitHub Desktop.
Como instalar LAMP en un Centos 7

Intalación LAMP (Linux, Apache, MySQL, PHP)

Este documento esta hecho para poder instalar LAMP en una maquina Centos7.

Apache

Actualizar el sistema:

root@localhost:~$ yum update

Descargar e instalar Apache:

root@localhost:~$ yum install httpd

Revisar se instalo Apache:

root@localhost:~$ httpd -v

Revisar el estado del servicio de apache e iniciarlo:

root@localhost:~$ service httpd status

root@localhost:~$ service httpd start

Agregar excepciones al firewall para poder acceder a la página (puertos http y https):

root@localhost:~$ firewall-cmd --permanent --zone=public --add-service=http

root@localhost:~$ firewall-cmd --permanent --zone=public --add-service=https

Reiniciar servicio de firewall para aplicar cambios:

root@localhost:~$ service firewalld restart

MySQL

Actualizar el sistema:

root@localhost:~$ yum update

Instalar paquete RPM de mysql:

root@localhost:~$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

root@localhost:~$ rpm -ivh mysql-community-release-el7-5.noarch.rpm

root@localhost:~$ yum update

Instalar mysql-server:

root@localhost:~$ yum install mysql-server

Agregar excepción a firewall para el puerto utilizado por MySQL:

root@localhost:~$ firewall-cmd --permanent --zone=public --add-port=3306/tcp

Desactivar SELinux (Conexión remota):

root@localhost:~$ setsebool -P httpd_can_network_connect_db=1

PHP

Agregar paquete RPM de PHP 7.3

root@localhost:~$ yum install epel-release yum-utils

root@localhost:~$ yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

root@localhost:~$ yum-config-manager --enable remi-php73

Instalar librerias estándar de PHP

root@localhost:~$ yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd

Revisar si se instalo correctamente PHP:

root@localhost:~$ php –v

Otros (Git y Composer)

Instalar Git:

root@localhost:~$ yum install git

Instalar Composer

root@localhost:~$ yum install php-cli php-zip wget unzip

root@localhost:~$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

root@localhost:~$ HASH="$(wget -q -O - https://composer.github.io/installer.sig)"

root@localhost:~$ php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

root@localhost:~$ php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Verificar si se instalo Composer:

root@localhost:~$ composer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment