Centos6.3 compile and install LAMP

Source: Internet
Author: User
Tags imagemagick mcrypt zts openldap

System Environment: Centos 6.3X64 mini

Source code storage path:/usr/local/src

Source code installation path:/usr/local

Database path:/data/mysql/data

Website path:/usr/local/apache/htdocs

--------------- Preparations ----------------

Disable firewall and selinux

# Service iptables stop

# Chkconfig iptables off

# Vi/etc/selinux/config # Change SELINUX = enforcing to disabled

Save and exit. Restart your computer

--------------- Installation start ------------------

Yum-y install gcc-c ++ autoconf unzip libjpeg-devel libpng-devel freetype-devel libxml2 libxml2-devel zlib-devel glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses -devel curl-devel plugin e2fsprogs-devel krb5 krb5-devel libidn-devel openssl-devel openldap-clients openldap-servers pcre-devel make wget vim cmake gd-devel libevent-devel zip unzip

--------------- Install apache -----------------

# Cd/usr/local/src
# Tar zvxf apr-1.4.6.tar.gz
# Tar zvxf apr-util-1.5.1.tar.gz
# Tar zvxf httpd-2.4.3.tar.gz

Cd apr-1.4.6
./Configure-prefix =/usr/local/apr
Make & make install
Cd ../
Cd apr-util-1.5.1
./Configure-prefix =/usr/local/apr-util-with-apr =/usr/local/apr
Make & make install
Cd ../

Cd httpd-2.4.3
. /Configure-prefix =/usr/local/apache-enable-dav-enable-so-enable-maintainer-mode-with-apr =/usr/local/apr-with-apr -util =/usr/local/apr-util
Make & make install
Cd ../

--------------- Install mysql -----------------

Groupadd mysql
Useradd-g mysql-s/sbin/nologin
Mkdir-p/data/mysql
Chown-R mysql: mysql/data/mysql
Mkdir-p/usr/local/mysql
Tar zxvf mysql-5.5.28.tar.gz
Cd mysql-5.5.28
Cmake.-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_DATADIR =/data/mysql/data-DSYSCONFDIR =/etc
Make
Make install
Cd/usr/local/mysql
Cp./support-files/my-medium.cnf/etc/my. cnf
./Scripts/mysql_install_db-datadir =/data/mysql/data-user = mysql
Cp./support-files/mysql. server/etc/rc. d/init. d/mysqld
Chmod 755/etc/init. d/mysqld
Chkconfig mysqld on
Echo 'basedir =/usr/local/mysql/'>/etc/rc. d/init. d/mysqld
Echo 'datadir =/data/mysql/data/'>/etc/rc. d/init. d/mysqld
Service mysqld start
Echo 'export PATH = $ PATH:/usr/local/mysql/bin'>/etc/profile
Ln-s/usr/local/mysql/lib/mysql/usr/local/lib64/mysql
Ln-s/usr/local/mysql/include/mysql/usr/local/include/mysql

--------------- Install PHP -----------------

Cd/usr/local/src
Tar zxvf libmcrypt-2.5.8.tar.gz
Cd libmcrypt-2.5.8
./Configure
Make & make install
/Sbin/ldconfig
Cd libltdl
./Configure-enable-ltdl-install
Make & make install
Cd ../../
Tar zxvf mhash-0.9.9.9.tar.gz
Cd mhash-0.9.9.9/
./Configure
Make & make install
Ln-s/usr/local/lib/libmcrypt. la/usr/lib/libmcrypt. la
Ln-s/usr/local/lib/libmcrypt. so/usr/lib/libmcrypt. so
Ln-s/usr/local/lib/libmcrypt. so.4/usr/lib/libmcrypt. so.4
Ln-s/usr/local/lib/libmcrypt. so.4.4.8/usr/lib/libmcrypt. so.4.4.8
Ln-s/usr/local/lib/libmhash. a/usr/lib/libmhash.
Ln-s/usr/local/lib/libmhash. la/usr/lib/libmhash. la
Ln-s/usr/local/lib/libmhash. so/usr/lib/libmhash. so
Ln-s/usr/local/lib/libmhash. so.2/usr/lib/libmhash. so.2
Ln-s/usr/local/lib/libmhash. so.2.0.1/usr/lib/libmhash. so.2.0.1
Ln-s/usr/local/bin/libmcrypt-config/usr/bin/libmcrypt-config
Cd ../
Tar zxvf mcrypt-2.6.8.tar.gz
Cd mcrypt-2.6.8/
/Sbin/ldconfig
./Configure
Make & make install
Cd ../
Tar zxvf pcre-8.31.tar.gz
Cd pcre-8.31
./Configure-prefix =/usr/local/pcre
Make
Make install
Cd ../
Tar zxvf libiconv-1.13.1.tar.gz
Cd libiconv-1.13.1/
./Configure-prefix =/usr/local
Make & make install
Cd ../
Tar zxvf ImageMagick.tar.gz
Cd ImageMagick-6.5.1-2/
./Configure
Make & make install
Cd ../

Tar zxvf php-5.3.18.tar.gz
Cd php-5.3.18/
. /Configure-prefix =/usr/local/php-with-apxs2 =/usr/local/apache/bin/apxs-with-mysql =/usr/local/mysql/-with-ttf -with-xmlrpc-with-openssl-with-zlib-with-freetype-dir-with-gd-with-jpeg-dir-with-png-dir-with-iconv =/ usr/local/libiconv-enable-short-tags-enable-sockets-enable-zend-multibyte-enable-soap-enable-mbstring-enable-static-enable-gd-native- ttf-with-curl-with-mcrypt
Make & make install
Cp php. ini-production/usr/local/php/etc/php. ini
Cd ../

Tar zxvf PDO_MYSQL-1.0.2.tgz
Cd PDO_MYSQL-1.0.2/
/Usr/local/php/bin/phpize
./Configure-with-php-config =/usr/local/php/bin/php-config-with-pdo-mysql =/usr/local/mysql
Make & make install
Cd ../
Tar zxvf imagick-2.3.0.tgz
Cd imagick-2.3.0/
/Usr/local/php/bin/phpize
./Configure-with-php-config =/usr/local/php/bin/php-config
Make & make install
Cd ../
Tar zxvf memcache-3.0.6.tgz
Cd memcache-3.0.6/
/Usr/local/php/bin/phpize
./Configure-with-php-config =/usr/local/php/bin/php-config
Make & make install
Cd ../
Tar jxvf eaccelerator-0.9.6.1.tar.bz2
Cd eaccelerator-0.9.6.1
/Usr/local/php/bin/phpize
./Configure-enable-eaccelerator = shared-with-php-config =/usr/local/php/bin/php-config
Make
Make install
Mkdir/tmp/eaccelerator
Chmod 777/tmp/eaccelerator

Cd ../

Tar zxvf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz

Mkdir-p/usr/local/zend/

Cp ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer. so/usr/local/zend/

Chown www. www/usr/local/apache/htdocs/-R
Chmod 700/usr/local/apache/htdocs/-R

--------------- Modify the php. ini file -----------------

Manually modify: Search for extension_dir = "./" in/usr/local/php/etc/php. ini.

Change to extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613 /"

Add the following lines after this line, and then save:

Extension = "memcache. so"

Extension = "pdo_mysql.so"

Extension = "imagick. so"

Find output_buffering = Off

Change to output_buffering = On

Search again; cgi. fix_pathinfo = 0

Change to cgi. fix_pathinfo = 0 to prevent Nginx file type error Parsing Vulnerability.

3.13 configure eAccelerator to accelerate PHP:

Mkdir-p/usr/local/eaccelerator_cache

Vi/usr/local/php/etc/php. ini

Press shift + g to jump to the end of the configuration file, and add the following configuration information:

[Eaccelerator]

Zend_extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator. so"

Eaccelerator. shm_size = "64 ″

Eaccelerator. cache_dir = "/usr/local/eaccelerator_cache"

Eaccelerator. enable = "1 ″

Eaccelerator. optimizer = "1 ″

Eaccelerator. check_mtime = "1 ″

Eaccelerator. debug = "0 ″

Eaccelerator. filter = ""

Eaccelerator. shm_max = "0 ″

Eaccelerator. shm_ttl = "3600 ″

Eaccelerator. shm_prune_period = "3600 ″

Eaccelerator. shm_only = "0 ″

Eaccelerator. compress = "1 ″

Eaccelerator. compress_level = "9 ″

[Zend Optimizer]
Zend_optimizer.optimization_level = 15
Zend_extension = "/usr/local/zend/ZendOptimizer. so"
/Usr/local/apache/bin/apachectl restart

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.