CentOS 6.5 under source installation lamp (linux+apache+mysql+php) environment

Source: Internet
Author: User
Tags install openssl openssl

CentOS 6.5 under source installation lamp (linux+apache+mysql+php) environment
I. System environment:
Linux system version: CentOS release 6.5
Apache Version: httpd-2.2.24
PHP version: php-5.6.11

Two Preparation before installation:
1. Check to see if GCC is installed, gcc-c++ compiler, and install if not:
To see if the command is installed:
#gcc –v
If not installed in the server networking scenario, you can use the following command to install:
#yum Install GCC
#yum Install gcc-c++
2. View and uninstall the default low-version environment (the RPM package installation environment that comes with the system installation)
Check to see if Apache is installed as an example:
#rpm –qa | grep httpd
A description of the situation that appears is installed:

3. Uninstall the low-version environment:
#rpm –e httpd*
#rpm –e php* (sometimes you may need to uninstall MySQL first and then uninstall PHP)
#rpm –e mysql*
Three Related library files and plugins preparation:
1. Before installing PHP, you need to install the most recent repository files:
LIBXML2,LIBMCRYPT,GD2 (GD2 Library is designed to allow PHP5 to support image formats such as gif,png and JPG, so you will need to install the GD2 and Zlib,libpng,freetype libraries before installing JPEGSRC)

Four Install lamp:
1. Install the library file:
A. Install LIBXML2 version: libxml2-2.6.30.tar.gz
#./configure–prefix=/usr/local/libxml
#make && make Install
B. Install Libmcrypt version: libmcrypt-2.5.8.tar.gz
#./configure–prefix=/usr/local/libmcrypt
#make && make Install
C. Install zlib version: zlib-1.2.3.tar.gz
#./configure
#make &&make Install
D. Install libpng version: libpng-1.2.52.tar.gz
#./configure–prefix=/usr/local/libpng
#make && make Install


E. Installing JPEG6 Version: jpegsrc.v8b.tar.gz (this software requires manual creation of directories when installing)
#mkdir/usr/local/jpeg6
# Mkdir/usr/local/jpeg6/bin
# Mkdir/usr/local/jpeg6/lib
# Mkdir/usr/local/jpeg6/include
# Mkdir/usr/local/jpeg6/man/man1

#./configure–prefix=/usr/local/jpeg6/--enable-shared–enable-static
#make && make Install

F. Installation FreeType version: freetype-2.3.5.tar.gz
#./configure–prefix=/usr/local/freetype
#make
#make Install

G. Installation autoconf version: autoconf-2.61.tar.gz
#./configure
#make && make Install

H. Installing the GD library version: gd-2.0.33.tar.gz
#/configure \
--prefix=/usr/local/gd2/\
--enable-m4_pattern_allow \
--with-zlib=/usr/local/zlib/\
--with-jpeg=/usr/local/jpeg6/\
--with-png=/usr/local/libpng/\
--with-freetype=/usr/local/freetype/
#make (Note: There is a general error when installing to this step:)
Error message:
MAKE[2]: * * * [Gd_png.lo] Error 1
MAKE[2]: Leaving directory '/usr/local/src/gd-2.0.35 '
MAKE[1]: * * * [all-recursive] Error 1
MAKE[1]: Leaving directory '/usr/local/src/gd-2.0.35 '
Make: * * * [ALL] Error 2
Cause analysis and Solution:
(1) This error occurs mainly because the GD_PNG.C in the GD library file is png_h not found in this file.
(2) We directly #vim gd_png.c to change the include "Png.h" in the file to include "/usr/local/libpng/include/png.h" to resolve the problem,/usr/local/libpng/ The installation path for the previous libpng.
(3) Last #make && make install after the change is completed


Five Install Apache,
(1) Install the required plugins before installing Apache:
#yum install-y OpenSSL Mod_ssl
#yum Install Openssl-devel–y

(2) Installing the APR Portable Runtime:
#[httpd-2.2.24]# CD srclib/apr
#[httpd-2.2.24/srclib/apr]#./configure--prefix=/usr/ LOCAL/APR
#[httpd-2.2.24/srclib/apr]# make
#[httpd-2.2.24/srclib/apr]# make install
#[httpd-2.2.24/ srclib/apr]# CD. /apr-util/
#mkdir/usr/local/apr-util
#[httpd-2.2.24/srclib/apr-util]#./configure--prefix=/usr/local/ Apr-util--with-apr=/usr/local/apr
#[httpd-2.2.24/srclib/apr-util]# make
#[httpd-2.2.24/srclib/apr-util]# Make Install

(3) Install Apache:
#cd httpd-2.2.24
#./configure--prefix=/usr/local/apache--with-apr=/usr/ LOCAL/APR--enable-dav--enable-dav-fs--enable-modules=most--enable-mods-shared=all--enable-deflate--enable-ssl- -with-apr-util=/usr/local/apr-util--enable-so--enable-rewrite--with-mpm=prefork

Part of the module function description:
A.--enable-mods-shared=all dynamic loading of all modules
B.--enable-dav--ENABLE-DAV-FS part of the system has file upload function, so open DAV support.
C.--enable-deflate provides compression, saving bandwidth on the one hand and improving user access efficiency on the other.
D.--enable-expires provides browser caching functionality for Web site images, Js,css, and other content.
E.--with-mpm=prefork, select Prefork mode, Prefork provides more stable performance than worker mode.
(4) Loading module
A. mod_ssl.so Module load operation
#cd Http-2.2.24/modules/ssl
#/usr/local/apache/bin/apxs-a–i–c MOD_SSL.C-LCRYPTO-LSSL–LDL

B. mod_speling.so module load operation (turn off case sensitive)
# CD Http-2.2.24/modules/mappers
#/usr/local/apache/bin/apxs-c-i-a mod_speling.c

(4) Edit the Apache configuration file:
4.1 prefork mode settings, edit under installation directory
/usr/local/apache/conf/extra/httpd-mpm.conf:
#vim Httpd-mpm.config
The original default configuration:
<ifmodule mpm_prefork_module>
Startservers 5//server process starts the number of sub-procedures
Minspareservers 5//Idle server minimum number of processes
Maxspareservers 10//idle server max processes
Maxrequestworkers 250//maximum allowed server processes
Maxconnectionsperchild 0//server process maximum number of connections
</IfModule>
is changed to the following:
<ifmodule mpm_prefork_module>
Serverlimit 20000//set to 20,000 let maxclient support more processes
Startservers
minspareservers
Maxspareservers
MaxClients
Maxrequestsperchild 10000//set to non 0 to prevent memory leaks, number of idle recycle processes
</ifmodule>

4.2/usr/local/apache/conf under httpd.conf configuration file modification:

#vim httpd.conf
ServerRoot "/usr/local/apache"//apache the installation path is configured on line 30
Listen 80//Configure the listening port to 80 the configuration is near 41 lines
LoadModule Speling_module modules/mod_speling.so
CheckSpelling on//off case sensitivity near 56 lines
LoadModule php5_module modules/libphp5.so//load PHP interpreter 58 line
AddType plication/x-httpd-php. php. phtml//apache and PHP 59 line integration
User Apache//users who started Apache
Group Apache//user groups to which the user to start Apache uses
ServerName localhost:80//default server and port 106 near line

123 <directory/>//Apache access to the root directory
124 Options None
AllowOverride None
126 Order Deny,allow
127 Allow from all
</Directory>



<directory "/www" >//apache default root directory and access permission settings
153 Options None
165 Order Allow,deny
166 Allow from all
167
168 </Directory>

174 <ifmodule dir_module>//default home Configuration 174---176 rows
175 DirectoryIndex index.html index.php
176 </IfModule>

182 <filesmatch "^\.ht" >//.ht file access settings, default configuration can be accessed by default
183 Order Allow,deny
184 Deny from all
185 Satisfy All
186 </FilesMatch>

195 errorlog "Logs/error_log"//error log directory configuration path

386 Include conf/extra/httpd-mpm.conf//Enable MPM module
404 Include conf/extra/httpd-vhosts.conf//Enable virtual host configuration
416 Include conf/extra/httpd-ssl.conf//Enable certificate support

4.3 SSL Configuration/usr/local/apache/conf/extra/httpd-ssl.conf
#vim httpd-ssl.conf

PNS Listen 443//443 ports used to enable HTTPS

DocumentRoot "/www"//need to transfer file path using HTTPS protocol
ServerName localhost:443//All domain names jump 443
ServerAdmin [email protected]
Bayi errorlog "/usr/local/apache/logs/error_log"
Transferlog "/usr/local/apache/logs/access_log"

(Note: The number in front of each line is the number of rows in the configuration file)

To be Continued--------------

CentOS 6.5 under source installation lamp (linux+apache+mysql+php) environment

Related Article

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.