Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Instalar Apache2 con PHP5 y MySQL en CentOS 6.

3 (LAMP)

Instalar MySQL 5
yum install mysql mysql-server Crear enlaces de inicio del sistema para MySQL para que inicie automticamente cada vez que se inicia el sistema: chkconfig --levels 235 mysqld on /etc/init.d/mysqld start Configurar password de root para MySQL mysql_secure_installation Enter current password for root (enter for none): ENTER NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] ENTER New password: passwordderoot Re-enter new password: passwordderoot Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] ENTER ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] ENTER ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] ENTER - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] ENTER ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! [root@server1 ~]#

Instalar Apache2
yum install httpd Configurar Apache para que inicie al arrancar Centos chkconfig --levels 235 httpd on Iniciar Apache /etc/init.d/httpd start

En el navegador ir a http://192.168.0.100, se debera ver la pgina de Apache2

Documentacin de Apache se encuentra en /var/www/html, el archivo con /etc/httpd/conf/httpd.conf. Configuraciones adicionales se encuentran en /etc/httpd/conf.d/

configuraciones

es

Instalar PHP5
Instalar mdulos de PHP5 y Apache PHP5 yum install php Reiniciar Apache /etc/init.d/httpd restart

Chequear PHP5 / ver detalles de instalacin de PHP5 Crear archivo PHP (info.php) en el directorio /var/www/html y llamarlo desde el navegador. El archivo mostrar un montn de detalles tiles sobre nuestra instalacin de PHP, como la versin de PHP instalada. vi /var/www/html/info.php

Ir al navegador http://192.168.0.100/info.php

Como se puede observar, PHP5 est trabajando a travs del controlador de Apache 2.0, tal como se muestra en la lnea de API de servidor. Si se desplaza hacia abajo, se podr ver todos los mdulos que ya estn habilitadas en PHP5. MySQL no est en la lista, lo que significa que no tienen el soporte de MySQL en PHP5 todava.

Obtener soporte de MySQL en PHP5 Para obtener soporte de MySQL en PHP, instalar paquete php-mysql. Es una buena idea instalar otros mdulos PHP5. Se puede buscar mdulos PHP5 disponibles de la siguiente manera yum search php Seleccionar lo que se requiera e instalar yum install php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc

Instalar APC yum install php-pecl-apc Reiniciar Apache2 /etc/init.d/httpd restart Now reload http://192.168.0.100/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module

Instalar phpMyAdmin
En primer lugar se debe habilitar el repositorio rpmforge en CentOS, esto porque phpMyAdmin no est disponible en los repositorios oficiales de CentOS 6.3. Importar RPMforge GPG rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt En sistemas x86_64 yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm En sistemas i386 yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm Instalar phpMyAdmin yum install phpmyadmin Cambiar configuracin de Apache para que phpMyAdmin permita conexiones no slo desde localhost (comentando la lnea <Directory "/usr/share/phpmyadmin">) vi /etc/httpd/conf.d/phpmyadmin.conf

A continuacin cambiar autenticacin de phpMyAdmin desde cookie a http vi /usr/share/phpmyadmin/config.inc.php

Restart Apache /etc/init.d/httpd restart Acceder a phpMyAdmin desde http://192.168.0.100/phpmyadmin/

Habilitar Puerto 80 Firewall


Ejecutar comando system-config-firewall-tui

Seleccionar Personalizar

Con la Barra Espaciadora seleccionar WWW (HTTP)

Seleccionar Cerrar

Seleccionar Aceptar

Seleccionar Si

You might also like