Lamp Installation and Precautions

Source: Internet
Author: User
Tags openldap

Lamp--linux+apache (httpd) +mysql+php, which is a common Web server architecture, accepts the process of compiling the installation and the errors that occur.

Precautions:

1. Extended Epel Source: reference: http://www.cnblogs.com/llius/p/5105051.html

2. PHP is installed behind MySQL and httpd, because it relies on both paths when compiling

3. Firewall off: iptables-f---Service iptables Save (CENTOS7 does not support save); vim/etc/selinux/config:selinux=enforcing--SELI Nux=disabled-Reboot

Test environment:

centos_6.6 64-bit && centos_7.0 64-bit pro-Test effective!!!

Three software versions (although the version is older, it is better for practiced hand):

httpd-2.2.24.tar.bz2

MYSQL-5.1.73-LINUX-X86_64-GLIBC23.TAR.GZ//non-woven, MySQL is too big, compile time, you can choose to skip the package

php-5.4.44.tar.bz2

To extend the library resources, some packages need to extend the Epel source:

Yum install-y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freet Ype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl Curl-deve L e2fsprogs e2fsprogs-devel krb5-devel OpenSSL openssl-devel openldap openldap-devel openldap-clients openldap-servers Libmcrypt libmcrypt-devel Libaio libaio-devel openssl*

First, the installation of MySQL:

1. New environment without MySQL user, add a MySQL user

# useradd-s/sbin/nologin-m MySQL    //-m: Do not generate home directory-s/sbin/nologin

2. Create a new MySQL data directory and assign ownership to MySQL

# mkdir-p/data/mysql# chown-r mysql.mysql!$

3. Download mysql-5.1.73-linux-x86_64-glibc23.tar.gz, unzip, move rename, change owner to MySQL

# cd/usr/local/src# wget http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73-linux-x86_64-glibc23.tar.gz# Tar- ZXVF mysql-5.1.73-linux-x86_64-glibc23.tar.gz# MV Mysql-5.1.73-linux-x86_64-glibc23.tar.gz. /mysql# chown-r Mysql.mysql!$

4. Initialize (display two OK, indicating success of initialization):

# cd/usr/local/mysql#./scripts/mysql_install_db--user=mysql--datadir=/data/mysql--basedir=/usr/local/mysql

5. configuration file copy and edit:

# cd/usr/local/mysql/support-files# CP mysql.server/etc/init.d/mysqld//   startup script # Vim!$    //Edit the following parameters: basedir=/usr/ local/mysqldatadir=/data/mysql# CP my-small.cnf/etc/my.cnf  //config file #/etc/init.d/mysqld start# PS aux |grep mysqld< c3/>//has mysqld process, indicating successful installation

Ii. installation of Apache (HTTPD)

1. Download and unzip the httpd-2.2.24.tar.bz2:

# cd/usr/local/src/# wget http://www.lishiming.net/data/attachment/forum/httpd-2.2.24.tar.bz2# TAR-JXVF httpd-2.2.24.tar.bz2# CD!$

2. Configure the compilation parameters:

./configure--prefix=/usr/local/apache2--with-included-apr--enable-so \     //extension useful for PHP--enable-deflate=shared-- enable-expires=shared--enable-rewrite=shared--with-pcre

3. Compiling and installing

# Make && make install

Third, the installation of PHP

1. Download, unzip

# cd/usr/local/src# wget http://cn2.php.net/distributions/php-5.4.44.tar.gz# tar zxvf php-5.4.44.tar.gz

2. Configure the compilation parameters:

./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/local/ Php/etc--with-mysql=/usr/local/mysql--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--disable-ipv6

3. Compiling and Installing:

# Make && make install

Iv. adding PHP parsing in Apache

1. Copy the PHP configuration file:

# Cp/usr/local/src/php-5.4.44/php.ini-production/usr/local/php/etc/php.ini

2. Modifying the Apache configuration file

# vim/usr/local/apache2/conf/httpd.conf found: <directory/>options followsymlinksallowoverride NoneOrder deny, Allowdeny from all   //deny-allow</directory> found: AddType application/x-gzip. gz. tgz  ///Added below: AddType application/x-httpd-php. php Find: <ifmodule dir_module>    directoryindex index.html     //Add later: index.htm Index.php</ifmodule> found: #ServerName www.example.com:80   //Remove comments, instead: ServerName localhost:80

3. Turn on httpd service

#/usr/local/apache2/bin/apachectl-t   //Show Syntax OK, no problem with configuration file #/usr/local/apache2/bin/apachectl start   // Start Service # PS aux |grep httpd  //See if there is a httpd process

4. Test PHP parsing

# cd/usr/local/apache2/htdocs  //apache file default directory # VIM index.php  //write the following: <?phpecho "hello!"? > Save exit
Browser input: 192.168.220.22\index.php //Host IP and PHP file name

If you open a Web page that displays hello! , does not eject the download PHP interface, also does not display <?php echo "hello!", explains the PHP parse succeeds.

Lamp Installation and Precautions

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.