Created
October 19, 2012 01:10
-
-
Save asanchez75/3915691 to your computer and use it in GitHub Desktop.
El presente manual describe la instalacion de Apache + MySQL + PHP desde código fuente.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
El presente manual describe la instalacion de Apache + MySQL + PHP desde código fuente. | |
===================================================================================== | |
Los paquetes se instalarán en la carpeta | |
/usr/local | |
y deberían quedar así | |
/usr/local/apache2 | |
/usr/local/mysql | |
/usr/local/php | |
Esto debería ocurrir automáticamente si NO se indica el parámetro --prefix cuando se inicia el proceso de compilación | |
===================================================================================== | |
Instalacion de Apache 2.4.3 | |
1. Descargar httpd-2.4.3 de su página web | |
wget http://mirrors.linsrv.net/apache//httpd/httpd-2.4.3.tar.gz | |
2. Paquetes necesarios para su instalación | |
Para esta versión se necesita APR (Apache Portable Runtime), APR-Util y PCRE (Perl-Compatible Regular Expressions Library) | |
2.1 Lo que se tiene para instalar APR y APR-Util que hacer es bajar estos archivos | |
wget http://apache.mesi.com.ar/apr/apr-1.4.6.tar.gz | |
wget http://apache.mesi.com.ar/apr/apr-util-1.4.1.tar.gz | |
y colocarlos dentro de la carpeta "httpd-2.4.3/srclib" (que resulta cuando de descomprimir el archivo httpd-2.4.3.tar.gz) | |
2.2 Para instalar PCRE | |
Si tienes Centos podrías usar | |
yum -y install pcre-devel | |
Pero sino lo tienes entonces debes bajar el código fuente | |
wget http://sourceforge.net/projects/pcre/files/pcre/8.21/pcre-8.21.tar.gz | |
y luego compilarlo usando el comando | |
./configure --with-included-apr --with-pcre && make && make install | |
3. Instalación del httpd-2.4.3 | |
Usar el comando | |
./configure --with-included-apr --with-pcre && make && make install | |
Referencias | |
http://httpd.apache.org/docs/2.4/install.html (ver comentarios debajo) | |
http://hulan.info/item/compile-apache-with-ssl-php-5-and-mysql-on-linux | |
http://www.lamphowto.com/ | |
===================================================================================== | |
Instalacion de MySQL | |
1. Descargar mysql from http://www.mysql.com/downloads/mysql/5.1.html | |
2. Instalación | |
sudo ./configure --prefix=/usr/local/mysql --with-unix-socket-path=/tmp/mysql.sock --with-charset=utf8 && make && make install | |
3. Cambio de permisos | |
Nota. Si el usuario y el grupo mysql no ha sido creado antes, entonces se tienen que crear usando el comando | |
groupadd mysql | |
useradd -g mysql mysql | |
Nota. Si teníamos instalado antes el mysql por yum ó apt-get debemos removerlos y luego borrar el archivo my.cnf | |
sudo rm /etc/mysql/my.cnf | |
Bueno, seguimos. | |
Vamos a la carpeta /usr/local/mysql y ejecutamos el comando | |
chown -Rf mysql:mysql * | |
4. Configuración | |
sudo cp support-files/my-medium.cnf /etc/my.cnf | |
sudo bin/mysql_install_db --user=mysql | |
[si falla usar] | |
sudo scripts/mysql_install_db --user=root | |
y luego cambiar permisos a /usr/local/mysql/var | |
a mysql:mysql | |
5. Configuración del archivo /etc/init.d/mysql | |
sudo cp support-files/mysql.server /etc/init.d/mysql | |
sudo chmod 755 /etc/init.d/mysql | |
6. Tips | |
si falla la creacion de usuario usar | |
a) Parar el servicio | |
root# service mysqld stop | |
b) Ejecutar el mysql en modo seguro y sin password | |
Start MySQL in safe mode: | |
root# mysqld_safe --skip-grant-tables & | |
c) Loguearse | |
Log into MySQL as root: | |
root# mysql -u root | |
d) Agregar usuario root manualmente | |
INSERT INTO user VALUES ('localhost','root',password('123456'),'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y', 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); | |
Referencias | |
http://hulan.info/item/compile-apache-with-ssl-php-5-and-mysql-on-linux | |
http://www.lamphowto.com/ | |
===================================================================================== | |
Instalacion de PHP | |
1. Descargar php-5.4.8 | |
http://www.php.net/get/php-5.4.8.tar.bz2/from/a/mirror | |
2. Instalación de paquetes previos | |
For compiling PHP, we will need quite a few external libraries, like libcurl, libiconv, libjpeg, libpng, and few others, which we have to download and compile first: | |
PHP 5.0.3 itself - php-5.0.3.tar.bz2 | |
CURL library - curl-7.12.1.tar.gz | |
libiconv library - libiconv-1.9.2.tar.gz | |
JPEG library: jpegsrc.v6b.tar.gz | |
PNG library: libpng-1.2.8.tar.gz | |
cpdflib library: clibpdf202r1.tar.gz | |
Freetype 2 library: freetype-2.1.9.tar.bz2 | |
Compile libiconv from source: | |
cd /usr/local/src | |
tar -zxvf libiconv-1.9.2.tar.gz | |
cd libiconv-1.9.2 | |
./configure --prefix=/usr/local | |
make | |
make install | |
Compile libjpeg from source: | |
cd /usr/local/src | |
tar -zxvf jpegsrc.v6b.tar.gz | |
cd jpeg-6b | |
./configure --prefix=/usr/local | |
make | |
make install | |
make install-lib | |
Compile libpng from source: | |
cd /usr/local/src | |
tar -zxvf libpng-1.2.8.tar.gz | |
cd libpng-1.2.8 | |
cp scripts/makefile.linux makefile | |
make | |
make install | |
Compile cpdflib from source: | |
cd /usr/local/src | |
tar -zxvf clibpdf202r1.tar.gz | |
cd ClibPDF/source | |
cp Makefile.Linux makefile | |
make | |
make install | |
Compile curl from source: | |
cd /usr/local/src | |
tar -zxvf curl-7.12.1.tar.gz | |
cd curl-7.12.1 | |
./configure --prefix=/usr/local | |
make | |
make install | |
Compile freetype 2 from source: | |
cd /usr/local/src | |
tar -jxvf freetype-2.1.9.tar.bz2 | |
cd freetype-2.1.9 | |
./configure --prefix=/usr/local | |
make | |
make install | |
3. Instalación | |
Dentro de la carpeta /usr/local/src/php-5.4.6 ejecutar | |
sudo ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-zlib --with-zlib-dir --with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --with-iconv=/usr/local --with-curl=/usr/local --with-gettext --with-config-file-path=/usr/local/apache2/conf --enable-ftp --enable-mbstring --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql --with-pdo-pgsql --enable-soap | |
sudo make | |
sudo make install | |
4. Tips | |
Si aparece un error relacionado con "missing jpeglib.h" tenemos que instalar el paquete libjpeg62-dev (en debian) | |
Para compilar con la opción -with-pdo-pgsql debemos instalar el paquete postgresql-server-dev-9.1 (debian) | |
No olvidar que siempre se puede saber que opciones usar en la compilacion con php si ejecutamos el comando | |
./configure --help | |
y nos mostrará todas las opciones disponibles para compilar. | |
además podemos revisar la carpeta /usr/local/src/php-5.4.6/ext | |
para ver que librerías YA viene listas para compilar con la opción --with-XXXXX | |
donde XXXX es la carpeta dentro de /usr/local/src/php-5.4.6/ext | |
-Si sale el error "mysql_config... not found", usar el siguiente comando | |
sudo ln -s /usr/local/mysql/bin/mysql_config /usr/bin/mysql_config | |
- Para desinstalar siempre guarde la salida final de la instalacion porque alli se guardan las rutas do nde se han copiado archivos | |
Referencias | |
http://hulan.info/item/compile-apache-with-ssl-php-5-and-mysql-on-linux | |
http://www.sourcefiles.org/Programming/Libraries/Graphics/ | |
http://cpanelforums.net/php-recompilation-errors/ | |
http://www.php.net/git.php | |
https://bugs.php.net/bug.php?id=46975 | |
5. Mensaje final despues de instalacion de PHP (sirve para saber como salio configurado el PHP) | |
Installing PHP SAPI module: apache2handler | |
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool' libphp5.la /usr/local/apache2/modules | |
/usr/local/apache2/build/libtool --mode=install install libphp5.la /usr/local/apache2/modules/ | |
libtool: install: install .libs/libphp5.so /usr/local/apache2/modules/libphp5.so | |
libtool: install: install .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la | |
libtool: install: warning: remember to run `libtool --finish /usr/local/src/php-5.4.6/libs' | |
chmod 755 /usr/local/apache2/modules/libphp5.so | |
[activating module `php5' in /usr/local/apache2/conf/httpd.conf] | |
Installing PHP CLI binary: /usr/local/bin/ | |
Installing PHP CLI man page: /usr/local/php/man/man1/ | |
Installing PHP CGI binary: /usr/local/bin/ | |
Installing build environment: /usr/local/lib/php/build/ | |
Installing header files: /usr/local/include/php/ | |
Installing helper programs: /usr/local/bin/ | |
program: phpize | |
program: php-config | |
Installing man pages: /usr/local/php/man/man1/ | |
page: phpize.1 | |
page: php-config.1 | |
Installing PEAR environment: /usr/local/lib/php/ | |
[PEAR] Archive_Tar - already installed: 1.3.7 | |
[PEAR] Console_Getopt - already installed: 1.3.0 | |
[PEAR] Structures_Graph- already installed: 1.0.4 | |
[PEAR] XML_Util - already installed: 1.2.1 | |
[PEAR] PEAR - already installed: 1.9.4 | |
Wrote PEAR system config file at: /usr/local/etc/pear.conf | |
You may want to add: /usr/local/lib/php to your php.ini include_path | |
/usr/local/src/php-5.4.6/build/shtool install -c ext/phar/phar.phar /usr/local/bin | |
ln -s -f /usr/local/bin/phar.phar /usr/local/bin/phar | |
Installing PDO headers: /usr/local/include/php/ext/pdo/ | |
===================================================================================== | |
Configuración final | |
Después de la instalación, la carpeta | |
/usr/local/apache2/conf | |
contendrá todos los archivos de configuración importantes como httpd.conf y php.ini | |
En el archivo httpd.conf se configurará lo siguiente | |
a) Añadir al final del archivo | |
DirectoryIndex index.html index.htm index.php | |
AddType application/x-httpd-php .php | |
AddType application/x-httpd-php .php3 | |
AddType application/x-httpd-php-source .phps | |
b) Editar la parte de | |
<Directory "/home/www"> | |
Options Indexes Includes FollowSymLinks MultiViews | |
AllowOverride All | |
Order allow,deny | |
Allow from all | |
</Directory> | |
como se desee trabajar | |
c) Por otro lado, el archivo php.ini se deberá copiar de | |
/usr/local/src/php-5.4.6/php.ini-development | |
a la carpeta | |
/usr/local/apache2/conf | |
cambiandole de nombre a | |
/usr/local/apache2/conf/php.ini | |
En el archivo php.ini | |
se editará la línea 1132 | |
mysql.default_socket = /tmp/mysql.sock | |
ya que el MySQL fue compilado con esa dirección de sock | |
y si se desea se pueden configurar alli todas los parametros adicionales | |
short_open_tag = Off | |
register_globals = Off | |
allow_url_fopen = Off | |
==================================================================================== | |
salida de instalación PHP 5.3.18 | |
==================================================================================== | |
asanchez75@debian:/usr/local/src/php-5.3.18$ sudo make install | |
Installing PHP SAPI module: apache2handler | |
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool' libphp5.la /usr/local/apache2/modules | |
/usr/local/apache2/build/libtool --mode=install install libphp5.la /usr/local/apache2/modules/ | |
libtool: install: install .libs/libphp5.so /usr/local/apache2/modules/libphp5.so | |
libtool: install: install .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la | |
libtool: install: warning: remember to run `libtool --finish /usr/local/src/php-5.3.18/libs' | |
chmod 755 /usr/local/apache2/modules/libphp5.so | |
[activating module `php5' in /usr/local/apache2/conf/httpd.conf] | |
Installing PHP CLI binary: /usr/local/bin/ | |
Installing PHP CLI man page: /usr/local/man/man1/ | |
Installing build environment: /usr/local/lib/php/build/ | |
Installing header files: /usr/local/include/php/ | |
Installing helper programs: /usr/local/bin/ | |
program: phpize | |
program: php-config | |
Installing man pages: /usr/local/man/man1/ | |
page: phpize.1 | |
page: php-config.1 | |
Installing PEAR environment: /usr/local/lib/php/ | |
[PEAR] Archive_Tar - installed: 1.3.7 | |
[PEAR] Console_Getopt - installed: 1.3.0 | |
[PEAR] Structures_Graph- installed: 1.0.4 | |
[PEAR] XML_Util - installed: 1.2.1 | |
[PEAR] PEAR - installed: 1.9.4 | |
Wrote PEAR system config file at: /usr/local/etc/pear.conf | |
You may want to add: /usr/local/lib/php to your php.ini include_path | |
/usr/local/src/php-5.3.18/build/shtool install -c ext/phar/phar.phar /usr/local/bin | |
ln -s -f /usr/local/bin/phar.phar /usr/local/bin/phar | |
Installing PDO headers: /usr/local/include/php/ext/pdo/ | |
================ | |
libpng12-dev | |
libxml2-dev | |
postgresql-server-dev-9.1 | |
para instalar | |
sudo apt-get install mysql-client mysql-server | |
sudo apt-get install libxml2-dev | |
sudo apt-get install libpng-dev | |
sudo apt-get install libpcre3 libpcre3-dev | |
sudo apt-get install make gcc | |
sudo apt-get install libmysqlclient15-dev | |
sudo apt-get install libpq-dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment