CentOS 6.5 manually compiled Apache 2.2.6 + PHP 5.3.28 + Mysql 5.6.16

Source: Internet
Author: User

Long time did not configure the server, took a lot of detours, some parameters change, the search to the online documents are not updated, so the record self-examination.

Version of the selection:

An important principle of online system is absolutely not with the latest version, because no time and market test, the installation amount is small, after the failure to get help from others, if there is no independent kernel-level development capabilities don't be a mouse.

To use the current general installation and stable mature old version, the three versions are from the Forum, QQ Group and other multi-survey, a number of companies online are in use, is now more mature but not too old "old version."

First, the preparatory work:

1, disable SELinux (SELinux may cause compilation installation failure, first disabled)

getenforce                                  #查看状态0                                #临时禁用,不需重启#  sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g‘ /etc/selinux/config  #永久禁用,需重启生效

2. Yum Exchange Source

180.76.76.76                                         #百度开源DNSyum -y install wgetcd /etc/yum.repos.dmv CentOS-Base.repo CentOS-Base.repo.bak                        #备份wget http://mirrors.163.com/.help/CentOS6-Base-163.repo         #换用163源yum  install epel-release                                       #扩展更新包yum makecache                                                   #生成缓存#  yum -y upgrade             #更新所有软件包,不更改系统核心及软件包配置(非必须,酌情)

4. Install the necessary modules

# 依赖关系yum install -y wget gcc 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, Installation cmake2.8

# 默认下载到/root目录下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  # 若报错,则根据报错补全对应依赖包后,rm ./cmake-2.8.10.2/CMakeCache.txt,重新进行本步骤。

6, uninstall the Yum or rpm installed software, before uninstalling note Backup configuration documents and data !

-e-e-e phpyum -y remove httpdyum -y remove phpyum -y remove mysql-server mysqlyum -y remove php-mysql

7, the establishment of related directories, accounts

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

Second, install Apache 2.2.26

# Default Download to/root, same asCD/root wget http://archive.apache.org/dist/httpd/httpd-2.2. -. Tar.gztar ZXVF httpd-2.2. -. tar.gzCDhttpd-2.2. -# compilation./configure--prefix=/usr/local/apache--with-included-apr--enable-so--enable-deflate=shared--enable-expires= Shared--enable-headers=shared--enable-rewrite=shared--enable-static-support# makeMake && make install#--------------------------------------------------------------------------------------# Configuration After installation is complete:CP./BUILD/RPM/HTTPD.INIT/ETC/INIT.D/HTTPD#使用init脚本管理httpdchmod755/etc/init.d/httpd#增加其执行权限Chkconfig--add httpd#添加httpd到服务项Chkconfig httpd on#设置开机启动Chown-r Apache:apache/usr/local/apache/htdocs#更改目录权限# Set Soft links to fit init scriptln-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

Third, install MySQL 5.6.16

# Default download to/root directoryCD/root wget http://dev.mysql.com/get/downloads/mysql-5.6/mysql-5.6. -. TAR.GZTAR-ZXVF mysql-5.6. -. tar.gzCDmysql-5.6. -# compilationCmake-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-dmysql_tcp_port=3306-denabled_local_infile=1-dwith_partition_storage_engine=1-dextra_charsets=all-ddefault_charset=utf8-ddefault_collation=utf8_general_ci# makeMake && make install#--------------------------------------------------------------------------------------# Configuration & InitializationCP./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# Join the system serviceCP./support-files/mysql.server/etc/rc.d/init.d/mysqldchmod the/etc/init.d/mysqldchkconfig--add mysqldchkconfig mysqld on

Iv. Installation of PHP 5.3.28

# 默认下载到/root目录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# 编译 /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

About Mysqlnd See also: PHP 5.3.0 above recommended Mysqlnd driver, and: Mysqlnd master-slave replication and load balancer Plugin

# make make && make install

*apache and PHP Integration:

# 修改apache配置文件,关键字搜索定位并进行修改vi /usr/local/apache/conf/httpd.conf    ServerAdmin ******@****.com                #管理员邮箱,服务器任何问题都将发信,如错误报告    "/usr/local/apache/htdocs"    #修改webroot      Options FollowSymLinks MultiViews          #安全起见去掉"Indexes"    # 添加对PHP的支持    DirectoryIndex default.php index.php default.html default.htm    AddHandler application/x-httpd-php .php# 修改PHP配置文件vi /etc/php.ini    register-golbals = On# 启动apache/usr/local/apache/bin/apachectl start  

Five, functional testing

‘<?php echo phpinfo();?>‘ /usr/local/apache/htdocs/index.php  #生成测试页并访问#若报错,根据错误号及提示去搜索相关解决方案

Six, parameter tuning

MYSQL Parameter recommendations:
PERCONA CONFIGURATION WIZARD for MYSQL (registration required)
On MySQL database optimization from operation and maintenance perspective

Memory optimization:
Tcmalloc (Google-perftools)-Open source China
Hugepage

And:
System Performance Tuning
Wait a minute......

Seven, stress test (slightly)

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

CentOS 6.5 manually compiled Apache 2.2.6 + PHP 5.3.28 + Mysql 5.6.16

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.