Manually compile and install Apache, PHP, and MySQL in centos

Source: Internet
Author: User
ArticleDirectory
    • First, change the update source to a domestic update source.
    • Clear residual files, update the standard library, and then upgrade

64-bit centos 5.5 manual installation of lamp requires curl, JSON, pdo_mysql, AND Gd. The record is as follows.

Centos 5.4, 5.5, and 5.6 kernels are 2.6.18. you can install PHP 5.3.

Uninstall old versions of Apache, PHP, and MYSQL:
 
Sudo Yum erase httpdsudo Yum erase PHP-clisudo Yum erase MySQL
Download, compile, and install Apache 2.2.19:

Http://httpd.apache.org/download.cgi

 
Cd ~ Wget http://mirror.bjtu.edu.cn/apache/httpd/httpd-2.2.19.tar.bz2tar-jxvf httpd-2.2.19.tar.bz2cd httpd-2.2.19sudo Yum install GCC./configure -- prefix =/opt/httpd -- enable-so -- enable-rewritemakesudo make installsudo/opt/httpd/bin/httpd-K start

After installing Apache, access http: // localhost in a browser. The instructions are properly displayed.

Download and install MySQL 5.5.13:

Http://dev.mysql.com/downloads/mysql/#downloads

Download these two (64-bit): mysql-client mysql-Server

 
Sudo Yum install libaiosudo rpm-I MySQL-client-5.5.13-1.rhel5.x86_64.rpmsudo rpm-I MySQL-server-5.5.13-1.rhel5.x86_64.rpmsudo/etc/init. d/MySQL start/usr/bin/mysqladmin-u Root Password '1' sudo CP/usr/share/MySQL/my-medium.cnf/etc/My. cnfsudo/etc/init. d/MySQL restartmysql-uroot-p1
Download, compile, and install PHP 5.3.6:

Http://php.net/downloads.php

Sudo Yum install libxml2 libxml2-devel curl-devel libjpeg-devel libpng-devel libmcrypt-devel libtool-ltdl-develtar-jxvf php-5.3.6.tar.bz2cd php-5.3.6. /configure -- prefix =/opt/PHP-with-apxs2 =/opt/httpd/bin/apxs -- With-curl -- With-mcrypt -- enable-mbstring -- With-iconv -- With-Gd -With-JPEG-Dir =/usr/local/lib -- enable-PDO -- With-PDO-mysql = mysqlnd -- With-mysqli = mysqlnd -- With-mysql = mysqlndmakesudo make installsudo CP PHP. ini-development/opt/PHP/lib/PHP. inisudo ln-S/opt/PHP/bin/PHP/usr/bin/phpsudo VI/opt/PHP/lib/PHP. INI deletes the semicolon before include_path and changes it to include_path = "/opt/PHP/lib/PHP" sudo VI/opt/httpd/CONF/httpd. add addhandler application/X-httpd-PHP to the bottom of conf. phpsudo/opt/httpd/bin/httpd-K restartsudo VI/opt/httpd/htdocs/phpinfo. PHP

The content of phpinfo. php is as follows:

 
<? Phpphpinfo ();?>

After installing PHP, restart Apache and use a browser to access http: // localhost/phpinfo. php. If it is displayed normally, PHP is installed. Search for mysqlnd, pdo_mysql, and mysqli. If yes, PHP can access MySQL.

Common PHP configurations

Http://www.cnblogs.com/sink_cup/archive/2011/10/28/php_ini.html

Add Apache to the system service and start it on startup
 
Sudo CP/opt/httpd/bin/apachectl/etc/init. d/httpdsudo VI/etc/init. d/httpd Add the following lines at the beginning of the file :#! /Bin/sh # chkconfig: 2345 85 15 # Description: Apache is a World Wide Web server. sudo chmod + x/etc/init. d/httpdsudo/sbin/chkconfig -- add httpdsudo/sbin/chkconfig -- list httpdsudo ln-S/sbin/chkconfig/usr/bin/chkconfigsudo ln-S/sbin/service/usr/ bin/service
Add MySQL to the system service and start it on startup
 
Sudo/sbin/chkconfig -- list MySQL

MySQL installed through RPM has been started on its own.

Install PHP extension SSH2

Install libssh2 first

Http://sourceforge.net/projects/libssh2/

./Configure

Make

Sudo make install

Install SSH2 again

Http://pecl.php.net/package/ssh2

/Opt/PHP/bin/phpize &./configure -- with-ssh2 & make

Sudo make install

Add one line in/opt/PHP/lib/PHP. ini:

Extension = ssh2.so

Upgrade centos 5.4 to 5.6: First Change the update source to a domestic update source
 
CD/etc/yum. Repos. dsudo MV CentOS-Base.repo CentOS-Base.repo.savesudo wget http://centos.ustc.edu.cn/CentOS-Base.repo
Clear residual files, update the standard library, and then upgrade
 
Sudo Yum clean allsudo Yum update glibc \ * sudo Yum update Yum \ * RPM \ * Python \ * sudo Yum clean allsudo Yum updatesudo reboot
Linux sets the server time zone UTC 0

Http://www.cnblogs.com/sink_cup/archive/2011/10/28/linux_utc_timezone.html

References:

Http://blog.chinaunix.net/u3/115899/showart_2258825.html

Http://www.zhuoda.org/xiezhi/103050.html

Http://dev.mysql.com/doc/refman/5.1/zh/installing.html#installation-layouts

http://ervanmardianto.com/php-ssh2-extensions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.