RHEL 6.5 64bit under source compilation installation lamp (Apache 2.4.12, MySQL 5.5.42, PHP 5.3.10)

Source: Internet
Author: User
Tags install php mcrypt openssl zts iptables

First, close the firewall and SELinux:

#iptables-F

#/etc/init.d/iptables stop

#sed-i ' s/selinux=enforcing/selinux=disabled/g '/etc/sysconfig/selinux

Second, download the package:

1. Download Apache:

Http://apache.dataguru.cn//httpd/httpd-2.4.12.tar.gz

2. Download MySQL:

Http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.5/mysql-5.5.42.tar.gz

3. Download PHP:

Http://museum.php.net/php5/php-5.3.10.tar.gz

4. Download CMake (MySQL compilation tool)

Http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz

5. Download Libmcrypt (phplibmcrypt module)

Ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz

6. Download Apr (Apache library file)

Http://mirror.bit.edu.cn/apache/apr/apr-1.5.1.tar.gz

7. Download Apr-util (Apache library file)

Http://mirror.bit.edu.cn/apache/apr/apr-util-1.5.4.tar.gz

Install compilation tools and library files (install using radhat yum command)

Yum install make apr* autoconf automake gcc gcc-c++ zlib-devel OpenSSL openssl-devel pcre-devel gd kernel keyutils patch Perl kernel-headers compat* MPFR cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel li Bsepol-devel libselinux-devel krb5-devel zlib-devel libxpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* LIBXML2 libxml2-devel Patch

Installation article:

1, installation Libmcrypt

#cd/USR/LOCAL/SRC

#tar ZXVF libmcrypt-2.5.7.tar.gz #解压

CD libmcrypt-2.5.7 #进入目录

./configure #配置

Make #编译

Make install #安装

2, installation CMake

Cd/usr/local/src

Tar zxvf cmake-2.8.7.tar.gz

CD cmake-2.8.7

./configure

Make #编译

Make install #安装

3. Install Apr

Cd/usr/local/src

Tar zxvf apr-1.4.6.tar.gz

CD apr-1.4.6

./configure--PREFIX=/USR/LOCAL/APR

Make

Make install

4, Installation Apr-util

Cd/usr/local/src

Tar zxvf apr-util-1.4.1.tar.gz

CD apr-util-1.4.1

./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/bin/apr-1-config

Make

Make install

5. Install MySQL

Groupadd MySQL #添加mysql组

useradd-g MySQL mysql-s/bin/false #创建用户mysql并加入到mysql组, does not allow MySQL users to log in directly to the system

Mkdir-p/data/mysql #创建MySQL数据库存放目录

Chown-r Mysql:mysql/data/mysql #设置MySQL数据库目录权限

Mkdir-p/usr/local/mysql #创建MySQL安装目录

Cd/usr/local/src

Tar zxvf mysql-5.5.21.tar.gz #解压

CD mysql-5.5.21

CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql-dsysconfdir=/etc #配置

Make #编译

Make install #安装

Cd/usr/local/mysql

CP./SUPPORT-FILES/MY-HUGE.CNF/ETC/MY.CNF #拷贝配置文件 (Note: the/etc directory has a my.cnf under the default, can be directly overwritten)

VI/ETC/MY.CNF #编辑配置文件, add the following line in the [mysqld] section

DataDir =/data/mysql #添加MySQL数据库路径

: wq! #保存退出

./scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/data/mysql--user=mysql #生成mysql系统数据库

CP./SUPPORT-FILES/MYSQL.SERVER/ETC/RC.D/INIT.D/MYSQLD #把Mysql加入系统启动

chmod 755/etc/init.d/mysqld #增加执行权限

Chkconfig mysqld on #加入开机启动

Vi/etc/rc.d/init.d/mysqld #编辑

Basedir =/usr/local/mysql #MySQL程序安装路径

DataDir =/data/mysql #MySQl数据库存放目录

Service mysqld Start #启动

Vi/etc/profile #把mysql服务加入系统环境变量: Add the following line at the end

Export path= $PATH:/usr/local/mysql/bin

The following two lines link the MYSLQ library file to the default location of the system, so you can compile software like PHP without specifying the MySQL library file address.

Ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql

Ln-s/usr/local/mysql/include/mysql/usr/include/mysql

Shutdown-r now #需要重启系统, wait for the system to restart after the operation continues under the terminal command line

Mysql_secure_installation #设置Mysql密码

Press Y to enter the password 2 times as prompted

or modify the password directly/usr/local/mysql/bin/mysqladmin-u root-p password "123456" #修改密码

Service mysqld Restart #重启

To this, MySQL installation is complete!

6, Installation Apache2

Cd/usr/local/src

TAR-ZVXF httpd-2.4.1.tar.gz

CD httpd-2.4.1

Mkdir-p/usr/local/apache #创建安装目录

./configure--prefix=/usr/local/apache--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util--with-ssl-- Enable-ssl--enable-module=so--enable-rewrite--enable-cgid--enable-cgi #配置

Make #编译

Make install #安装

/usr/local/apache/bin/apachectl-k Start #启动

Vi/usr/local/apache/conf/httpd.conf #编辑配置文件

Found: #ServerName www.example.com:80

Modified to: ServerName 172.24.0.2:80

Found: DirectoryIndex index.html

Modified to: DirectoryIndex index.html index.php

Found: Options Indexes followsymlinks

Modified to: Options followsymlinks #不显示目录结构

Find AllowOverride None

Modified to: AllowOverride all #开启apache支持伪静态, modified in three places

LoadModule rewrite_module modules/mod_rewrite.so #取消前面的注释, open Apache support pseudo-static

Vi/etc/profile #添加apache服务系统环境变量

Add the following line at the end

Export path= $PATH:/usr/local/apache/bin

CP/USR/LOCAL/APACHE/BIN/APACHECTL/ETC/RC.D/INIT.D/HTTPD #把apache加入到系统启动

Chown daemon.daemon-r/usr/local/apache/htdocs #更改目录所有者

chmod 700/usr/local/apache/htdocs-r #更改apache网站目录权限

Chkconfig httpd on #设置开机启动

/ETC/INIT.D/HTTPD start

Service httpd Restart

7. Install PHP

Cd/usr/local/src

TAR-ZVXF php-5.3.10.tar.gz

CD php-5.3.10

Mkdir-p/USR/LOCAL/PHP5 #建立php安装目录

./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-apxs2=/usr/local/apache/bin /apxs--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-mysql-sock=/tmp/ Mysql.sock--with-gd--with-openssl--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib- -with-libxml-dir--enable-xml--enable-sockets--with-mcrypt--with-bz2--enable-maintainer-zts #配置

Make #编译

Make install #安装

Mkdir/usr/local/php/etc

CP Php.ini-production/usr/local/php/etc/php.ini #复制php配置文件到安装目录

Rm-rf/etc/php.ini #删除系统自带的配置文件

Ln-s/usr/local/php/etc/php.ini/etc/php.ini #创建配置文件软链接

Vi/usr/local/php/etc/php.ini #编辑

Found in:; Open_basedir =

Modified to: Open_basedir =.:/ tmp/#防止php木马跨站, Important!!

Found: Disable_functions =

Modified to: Disable_functions = Passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini _alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server, Escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space, POSIX_CTERMID,POSIX_GET_LAST_ERROR,POSIX_GETCWD, Posix_getegid,posix_geteuid,posix_getgid, Posix_getgrgid,posix_ Getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, Posix_getppid,posix_getpwnam, Posix_getpwuid, Posix_getrlimit, Posix_getsid,posix_getuid,posix_isatty, Posix_kill,posix_mkfifo,posix_setegid, Posix_seteuid,posix_setgid, Posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname, Posix_uname

#列出PHP可以禁用的函数, if some programs need to use this function, you can delete, cancel disable.

Found:;d Ate.timezone =

Modified to: Date.timezone = PRC

Found: expose_php = On

Modified to: expose_php = OFF #禁止显示php版本的信息

Found: Display_errors = On

Modified to: display_errors = OFF #关闭错误提示

8. Configure Apache to support PHP

Vi/usr/local/apache/conf/httpd.conf #编辑apache配置文件

In the LoadModule php5_module modules/libphp5.so line, add the following,

AddType application/x-httpd-php php (Note: PHP. php This dot is preceded by a space)

Service httpd Restart #重启apache

Service mysqld Restart #重启mysql

Test article

vim/usr/local/apache/htdocsvi/index.php #输入下面内容

<?php

Phpinfo ();

?>

: wq! #保存

In the client browser enter the server IP address, you can see the relevant configuration information!

9, install XCache, for PHP acceleration

#cd/USR/LOCAL/SRC

#tar ZXVF xcache-3.2.0.tar.gz

#/usr/local/php/bin/phpize

#./configure--enable-xcache--with-php-config=/usr/local/php/bin/php-config

#make && make Install

At the end of the installation, a line similar to the following appears:

Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-zts-20131226/

Edit PHP.ini, integrate PHP and XCache

The sample configuration provided by XCache is first imported into the php.ini

# MKDIR/ETC/PHP.D

# CP XCACHE.INI/ETC/PHP.D (Note: Xcache.ini file is in the XCache source directory. )

Next edit/etc/php.d/xcache.ini, locate the line that begins with extension, and modify it to the following line

Extension =/usr/local/php/lib/php/extensions/no-debug-zts-20131226/xcache.so (Note: If the php.ini file has more than one zend_ Extension the command line, make sure that this new row is ranked first. )

At this point, the entire installation process is over, the following is a brief introduction to the use of pressure test tool AB.


Ab Use method

Test Apache server performance with the AB command:

-C Concurrency: The number of requests initiated at once, the default is 1;

-I: Use the head method when testing, the default is get;

-K: Enable HTTP long connection request mode;

-N Requests: The number of impersonation requests initiated, the default is 1, the number of requests is greater than or equal to the number of concurrent connections;

-Q: Silent mode, when the number of requests is greater than 150 does not output the percentage of request completion;

Output Result:

Time taken for tests: the duration from the first request connection to the end of the response message that received the last request;

Complete requests: number of successful requests;

Simple test:

Ab-c 100-n http://localhost/index.php

This approach allows you to make a simple assessment of the performance of your Web server.

This article is from the "Lot" blog, please be sure to keep this source http://6294180.blog.51cto.com/6284180/1627920

RHEL 6.5 64bit under source compilation installation lamp (Apache 2.4.12, MySQL 5.5.42, PHP 5.3.10)

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.