CentOS6.6 Source Installation Lamp Environment

Source: Internet
Author: User
Tags mcrypt mysql commands


Operating system environment: CentOS6.6 x86_x64 FINAL


Source Installation Lamp Environment
First upload the source package to the/usr/local/src/lamp directory, the version is httpd-2.2.16.tar.gz mysql-5.1.40-linux-x86_64-icc-glibc23.tar.gz Php-5.3.28.tar.gz
Then use TAR-XZVF to extract the source package
TAR-XZVF httpd-2.2.16.tar.gz
TAR-XZVF mysql-5.1.40-linux-x86_64-icc-glibc23.tar.gz
TAR-XZVF php-5.3.28.tar.gz

Start installing MySQL

Download:
wget http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz to move the extracted data to/usr/local/ Mysql
[Email protected] src]# MV Mysql-5.1.40-linux-x86_64-icc-glibc23/usr/local/mysql
Build MySQL User
[[email protected] src]# useradd-s/sbin/nologin MySQL
Initializing the database
[Email protected] src]# Cd/usr/local/mysql
[Email protected] mysql]# mkdir-p/data/mysql; Chown-r Mysql:mysql/data/mysql
[Email protected] mysql]#/scripts/mysql_install_db--user=mysql--datadir=/data/mysql
--user defines the owner of the database, the--datadir defines where the database is installed, and it is recommended to place the partition on a large space, which needs to be created on its own. This step is critical if you see two "OK" instructions to perform correctly, otherwise please review the error message carefully
The error message is./bin/mysqld:error while loading shared libraries:libstdc++.so.5:cannot open Shared object file:no such file or D Irectory
Use yum-y install Epel-release
Installing a dependency package using Yum-y install *libstdc++*
Copy configuration file
[email protected] mysql]# CP support-files/my-large.cnf/etc/my.cnf
Copy the startup script file and modify its properties
[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld
[Email protected] mysql]# chmod 755/etc/init.d/mysqld
modifying startup scripts
[Email protected] mysql]# Vim/etc/init.d/mysqld
There are "Datadir=/data/mysql" where modifications are required (the directory defined when the database was previously initialized)
Add the startup script to the system service entry and set the boot start to start MySQL
[Email protected] mysql]# chkconfig--add mysqld
[Email protected] mysql]# chkconfig mysqld on
[[Email protected] mysql]# service mysqld start
If not, please check the error log under/data/mysql/, which is usually the hostname. Err. The command to check if MySQL starts is:
[[Email protected] mysql]# PS aux |grep mysqld
Bring MySQL commands into $path
[Email protected] ~]# path= $PATH:/usr/local/mysql/bin/#当前有效, restarting the shell will expire
[Email protected] ~]# echo "Export path= $PATH:/usr/local/mysql/bin/" >>/etc/profile

Installing Apache

Apache Official website: http://www.apache.org/dyn/closer.cgi
[Email protected] mysql]# cd/usr/local/src/
[Email protected] src]# wget http://syslab.comsenz.com/downloads/linux/httpd-2.2.16.tar.gz
Extract:
[Email protected] src]# tar zxvf httpd-2.2.16.tar.gz
To configure the compilation parameters:
[Email protected] src]# CD httpd-2.2.16
[Email protected] httpd-2.2.16]#/configure \
--PREFIX=/USR/LOCAL/APACHE2 \
--WITH-INCLUDED-APR \
--ENABLE-SO \
--enable-deflate=shared \
--enable-expires=shared \
--enable-rewrite=shared \
--with-pcre
--PREFIX specifies where to install,--enable-so means to enable DSO [1]--enable-deflate=shared means the shared way of compiling deflate, followed by the same parameters. If you have such an error in this step:
Error:mod_deflate have been requested but can is built due to prerequisite failures
The solution is:
Yum Install-y zlib-devel
To avoid errors in make, it is best to install some library files in advance:
Yum install-y pcre pcre-devel Apr apr-devel
Compile:
[[email protected] httpd-2.2.16]# make
Installation:
[[email protected] httpd-2.2.16]# make install
Can you use echo $ for all two steps above? To check for proper execution, or you need to fix the problem based on the error.
Place Apache commands into $path
[Email protected] ~]# path= $PATH:/usr/local/apache2/bin/#当前有效, restarting the shell will expire
[Email protected] ~]# echo "Export path= $PATH:/usr/local/apache2/bin" >>/etc/profile
[[Email protected] ~] #source/etc/profile make configuration path effective immediately

Install PHP

PHP Official: http://www.php.net/downloads.php

[Email protected] httpd-2.2.16]# CD/USR/LOCAL/SRC
Extract:
[Email protected] src]# tar zxf php-5.3.27.tar.gz
To configure the compilation parameters:
[Email protected] src]# CD php-5.3.27
[Email protected] php-5.3.27]#/configure--prefix=/usr/local/php--WITH-APXS2=/USR/LOCAL/APACHE2/BIN/APXS-- With-config-file-path=/usr/local/php/etc--with-gd--with-gettext--with-libxml-dir=/usr/local--with-mysql= Mysqlnd--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--with-libxml-dir--with-gd--with-jpeg-dir--with-png-dir-- With-freetype-dir--with-iconv-dir--with-zlib-dir--with-bz2--with-openssl--with-mcrypt--enable-soap-- Enable-gd-native-ttf--enable-mbstring--enable-sockets--enable-exif--enable-bcmath--enable-mbstring-- Enable-sockets--disable-ipv6
In this step, you encounter the following error:
Configure:error:xml2-config not found. Please check your LIBXML2 installation.
The solution is:
Yum Install-y libxml2-devel
Error:
Configure:error:Cannot find OpenSSL ' s <evp.h>
The solution is:
Yum Install-y OpenSSL Openssl-devel
Error:
Checking for BZIP2 in default path ... not found
Configure:error:Please Reinstall the BZIP2 distribution
Workaround:
Yum install-y bzip2 Bzip2-devel
Error:
Configure:error:png.h not found.
Workaround:
Yum install-y libpng Libpng-devel
Error:
Configure:error:jpeglib.h not found.
Workaround:
Yum-y Install *jpeglib*
Error:
Configure:error:freetype.h not found.
Workaround:
Yum install-y FreeType Freetype-devel
Error:
Configure:error:mcrypt.h not found. Please reinstall Libmcrypt.
Workaround:
Yum Install-y libmcrypt-devel
Because the centos6.x default yum source does not libmcrypt-devel this package, only with third-party yum Source, previously installed Epel source, so can be directly yum installation.
Compile:
[[email protected] php-5.3.27]# make
Installation:
[[email protected] php-5.3.27]# make install
If error:
/usr/bin/ld:cannot Find-lltdl
Workaround:
Yum-y Install Libtool-ltdl-devel
After the installation is complete, use the following command to detect
Echo$?
/USR/LOCAL/APACHE2/BIN/APACHECTL-M Check if the PHP module is loaded
Copy the configuration file:
[email protected] php-5.3.27]# CP Php.ini-production/usr/local/php/etc/php.ini

Apache with PHP

The Apache master configuration file is:/usr/local/apache2/conf/httpd.conf
Vim/usr/local/apache2/conf/httpd.conf
Found it:
AddType application/x-gzip. gz. tgz
Under this line, add the following:
AddType application/x-httpd-php. php
Found it:
<ifmodule dir_module>
DirectoryIndex index.html
</IfModule>
Change the line to read:
<ifmodule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>
Found it:
#ServerName www.example.com:80
Modified to:
ServerName localhost:80
Test if lamp is successful


Verify that the configuration file is correct before starting Apache:
Apachectl-t
If there is an error, please continue to modify httpd.conf, if it is correct is displayed as "Syntax OK", the command to start Apache:
Apachectl start
To see if it starts:
[Email protected] ~]# NETSTAT-LNP |grep httpd
TCP 0 0::: +:::* LISTEN 7667/httpd
If this line is displayed, it is started. You can also use the Curl command to simply test:
[[email protected] ~]# curl localhost
This is only true if it is displayed.
Test if PHP is parsed correctly:
vim/usr/local/apache2/htdocs/1.php
Write:
<?php echo phpinfo ();? >
After saving, continue testing:
Open the http://IP/1.php page in a browser
See if you can see the following information:
PHP configuration details
You may not be able to access the Web service when you first use it for your browser, because of the firewall. Please run the following command:
[Email protected] ~]# iptables-f
This allows the system to clear the default firewall rules and release port 80.
The lamp environment is built.


This article is from the "Home of Linux" blog, please be sure to keep this source http://8773915.blog.51cto.com/8763915/1641756

CentOS6.6 Source Installation Lamp Environment

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.