Manually compile Apache2.2.6 + PHP5.3.28 + Mysql5.6.16 in CentOS6.5

Source: Internet
Author: User

Manually compile Apache2.2.6 + PHP5.3.28 + Mysql5.6.16 in CentOS6.5

I haven't configured the server for a long time, so I have taken a lot of detours. Some parameters have changed and the searched online documents have not been updated. Therefore, the records are self-checked.

Version selection:

An important principle for online systems is that they cannot use the latest version. Because it has not been tested by time and market, the installation volume is small and it is difficult to get help from others after a fault occurs, if you do not have the kernel-level development capability, don't be a mouse.

To use the currently widely installed and stable and mature old versions, the three versions are sourced from surveys by forums, QQ groups, and other parties. They are used by many companies online, it is an old version that is relatively mature but not too old ".

I. preparations:

1. Disable SeLinux (selinux may cause compilation and installation to fail. Disable SeLinux first)

Getenforce # display status setenforce 0 # temporarily disabled, no need to restart # sed-I's/SELINUX = enforcing/SELINUX = disabled/G'/etc/selinux/config # permanently disabled, reboot required

2. Yum for source

Vim/etc/resolv. confnameserver 180.76.76.76 # Baidu open-source DNSyum-y install wgetcd/etc/yum. repos. dmv CentOS-Base.repo CentOS-Base.repo.bak # backup wget http://mirrors.163.com/.help/CentOS6-Base-163.repo # swap 163 source yum install epel-release # Extend update package yum makecache # generate cache # yum-y upgrade # update all packages, do not change the system core and software package configurations (optional and optional)

4. install necessary modules

# Dependency yum install-y wget gcc-c ++ make automake autoconf kernel-devel ncurses-devel libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel pcre-devel libtool -libs freetype-devel gd zlib-devel file bison patch mlocate flex diffutils readline-devel glibc-devel glib2-devel bzip2-devel gettext-devel libcap-devel libmcrypt-devel

5. Install cmake2.8

# The default download to the/root directory cd/root wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gztar-zxvf cmake-2.8.10.2.tar.gzcd cmake-2.8.10.2. /bootstrap # if an error is reported, after completing the corresponding dependency package according to the error, rm. /cmake-2.8.10.2/CMakeCache.txt, repeat this step. Gmake & gmake install

6. Uninstall the software installed by yum or rpm,Pay attention to the backup configuration documents and data before uninstalling!

rpm -e httpdrpm -e mysqlrpm -e phpyum -y remove httpdyum -y remove phpyum -y remove mysql-server mysqlyum -y remove php-mysql

7. Create related directories and accounts

# Apachemkdir /usr/local/apachegroupadd apacheuseradd -g apache mysql# PHPmkdir /usr/local/php# Mysqlmkdir /usr/local/mysqlmkdir /data/mysqldatagroupadd mysqluseradd -g mysql mysql

Ii. install Apache 2.2.26

# Default download to/root, the same below cd/root wget http://archive.apache.org/dist/httpd/httpd-2.2.26.tar.gztar zxvf httpd-2.2.26.tar.gzcd httpd-2.2.26 # compile. /configure -- prefix =/usr/local/apache -- with-stored ded-apr -- enable-so -- enable-deflate = shared -- enable-expires = shared -- enable-headers = shared -- enable-rewrite = shared -- enable-static-support # makemake & make install # plugin # configuration after installation: cp. /build/rpm/httpd. init/etc/init. d/httpd # Use the init script to manage httpdchmod 755/etc/init. d/httpd # add the execution permission chkconfig -- add httpd # add httpd to the chkconfig httpd on service item # Set chown-R apache to start upon startup: apache/usr/local/apache/htdocs # Change directory permissions # Set soft links to adapt to the init script ln-fs/usr/local/apache/etc/httpdln-fs/usr/ local/apache/bin/httpd/usr/sbin/httpdln-fs/usr/local/apache/bin/apachectl/usr/sbin/apachectlln-fs/usr/local/apache/ logs/var/log/httpd

Iii. Install Mysql 5.6.16

# Default download to/root directory cd/root wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.16.tar.gztar-zxvf mysql-5.6.16.tar.gzcd mysql-5.6.16 # compile cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_DATADIR =/data/mysqldata-DSYSCONFDIR =/etc -DWITH_MYISAM_STORAGE_ENGINE = 1-DWITH_INNOBASE_STORAGE_ENGINE = 1-DWITH_MEMORY_STORAGE_ENGINE = 1-DWITH_READLINE = 1-DMYSQL_UNIX_ADDR =/tmp/mysql. sock-nodes = 3306-DENABLED_LOCAL_INFILE = 1-nodes = 1-DEXTRA_CHARSETS = all-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci # makemake & make install # configure & initialize cp. /support-files/my-default.cnf/etc/my. cnfchown-R mysql: mysql/data/mysqldata/usr/local/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/data/mysqldata/usr/local/ mysql/bin/mysqld_safe -- user = mysql &/usr/local/mysql/bin/mysqladmin-uroot password mypassword # add it to the System Service cp. /support-files/mysql. server/etc/rc. d/init. d/mysqldchmod 700/etc/init. d/mysqldchkconfig -- add mysqldchkconfig mysqld on

4. install PHP 5.3.28

# Default download to/root directory cd/root wget http://cn2.php.net/distributions/php-5.3.28.tar.bz2tar-jxvf mysql-5.6.16.tar.gzcd php-5.3.28 # compile/configure -- prefix =/usr/local/php-with-apxs2 =/usr/local/apache/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 = mysqlnd

AboutMysqlndFor more information, see: Mysqlnd driver is recommended for PHP 5.3.0 and later versions, and Mysqlnd master-slave replication and load balancing plug-ins.

# make make && make install

* Integration of Apache and PHP:

# Modify the apache configuration file, search and locate the keyword, and modify vi/usr/local/apache/conf/httpd. conf ServerAdmin ******@****. com # administrator's mailbox. The server will send a message if any problem occurs, for example, in the error report DocumentRoot "/usr/local/apache/htdocs" # modify webroot Options FollowSymLinks MultiViews # Remove "Indexes" # Add DirectoryIndex default for PHP support. php index. php default.html default.htm AddHandler application/x-httpd-php. php # modify the PHP configuration file vi/etc/php. ini register-golbals = On # start apache/usr/local/apache/bin/apachectl start

V. Function Testing

Sed-I' '/Usr/local/apache/htdocs/index. php # generate a test page and access it # if an error is reported, search for related solutions based on the error code and prompt

Vi. Parameter Optimization

MySql parameter recommendations:
Percona configuration wizard for mysql (registration required)
MySQL database optimization from the O & M perspective

Memory Optimization:
TCMalloc (google-perftools)-Open Source China
Hugepage

And:
System Performance Tuning
Wait ......

VII. Stress Testing (omitted)

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.