Lamp environment Construction in RHEL 6.4 system
First, the Environment preparation
1. Install the compilation tool GCC, gcc-c++
Using the installation CD as a Yum source, install GCC, gcc-c++, with the following command:
Yum-y Install GCC
Yum-y Install gcc-c++
2. Turn off the Apache, MySQL service for RPM package installation
1). Close the service
Service httpd Stop
Service Mysqld Stop
2). Turn off self-booting
Chkconfig httpd off
Chkconfig mysqld off
3. Turn off SELinux and firewalls
1). Turn off SELinux
Setenforce 0
#临时生效
Vi/etc/selinux/config
Selinux=disabled
#重启后永久生效
2). Turn off the firewall
Iptables-f
4. Turn off unnecessary self-start services
5. Copy the source package in the/usr/src/lamp/directory
Second, compile and install
1. Installing LIBXML2
To install Libxml2-devel and Python-devel, the following commands are required:
Yum-y Install Libxml2-devel
Yum-y Install Python-devel
After the installation completes the source package installs the LIBXML2, the command is as follows:
Cd/usr/src/lamp
Tar zxf libxml2-2.9.1.tar.gz
CD libxml2-2.9.1
./configure--prefix=/usr/local/libxml2/
Make
Make install
2. Installation of Libmcrypt and Libltdl
Cd/usr/src/lamp
Tar zxf libmcrypt-2.5.8.tar.gz
CD libmcrypt-2.5.8
./configure--prefix=/usr/local/libmcrypt/
Make
Make install
CD Libltdl
./configure--enable-ltdl-install
Make
Make install
3. Installing Mhash
Cd/usr/src/lamp
Tar zxf mhash-0.9.9.9.tar.gz
CD mhash-0.9.9.9
./configure
Make
Make install
4. Installing MCrypt
Cd/usr/src/lamp
Tar zxf mcrypt-2.6.8.tar.gz
CD mcrypt-2.6.8
Ld_library_path=/usr/local/libmcrypt/lib:/usr/local/lib./configure--with-libmcrypt-prefix=/usr/local/libmcrypt
Make
Make install
5. Installing zlib
Cd/usr/src/lamp
Tar zxf zlib-1.2.3.tar.gz
CD zlib-1.2.3
./configure
VI Makefile
Find Cflags=-o3-duse_mmap, add –fpic back to Cflags=-o3–duse_mmap–fpic
Make
Make install
6. Installing libpng
Cd/usr/src/lamp
Tar zxf libpng-1.2.31.gz
CD libpng-1.2.31
./configure--prefix=/usr/local/libpng
Make
Make install
7. Installing Jpeg6
Mkdir/usr/local/jpeg6
Mkdir/usr/local/jpeg6/bin
Mkdir/usr/local/jpeg6/lib
Mkdir/usr/local/jpeg6/include
Mkdir-p/usr/local/jpeg6/man/man1
Yum-y Install libtool*
Cd/usr/src/lamp
Unzip Jpeg-6b.zip
CD jpeg-6b
Chmod-r 777 *
Cp/usr/share/libtool/config/config.sub.
Cp/usr/share/libtool/config/config.guess.
./configure--prefix=/usr/local/jpeg6/--enable-shared--enable-static
Make
Make install
8. Installing FreeType
Cd/usr/src/lamp
Tar zxf Freetype-2.3.5.tar
CD freetype-2.3.5
./configure--prefix=/usr/local/freetype/
Make
Make install
9. Install GD Library
Mkdir/usr/local/gd2
Cd/usr/src/lamp
Tar zxf Gd-2.0.35.tar
CD gd-2.0.35
VI gd_png.c
Replace #include "png.h" with #include "/usr/local/libpng/include/png.h"
./configure--prefix=/usr/local/gd2/--with-jpeg=/usr/local/jpeg6/--with-freetype=/usr/local/freetype/--with-png =/usr/local/libpng/
Make
Make install
10. Installing Apache
Cd/usr/src/lamp
Tar zxf apr-1.4.6.tar.gz
Tar zxf apr-util-1.4.1.tar.gz
Tar zxf httpd-2.4.7.tar.gz
Cp-r apr-1.4.6 HTTPD-2.4.7/SRCLIB/APR
Cp-r apr-util-1.4.1 Httpd-2.4.7/srclib/apr-util
Tar zxf pcre-8.34.tar.gz
CD pcre-8.34
./configure
Make
Make install
Yum Install Openssl-devel
cd/usr/src/lamp/httpd-2.4.7
./configure--prefix=/usr/local/apache2/--sysconfdir=/usr/local/apache2/etc/--with-included-apr--enable-so-- enable-deflate=shared--enable-expires=shared--enable-rewrite=shared
Make
Make install
To launch the Apache test:
/usr/local/apache2/bin/apachectl start
11. Installing ncurses
Yum-y Install Ncurses-devel
Cd/usr/src/lamp
Tar zxf ncurses-5.9.tar.gz
CD ncurses-5.9
./configure--with-shared--without-debug--without-ada--enable-overwrite
Make
Make install
12. Installing CMake and Bison
Yum-y Install CMake
Yum-y Install Bison
13. Install MySQL
Groupadd MySQL
useradd-g MySQL MySQL
Cd/usr/src/lamp
Tar zxf mysql-5.5.23.tar.gz
CD mysql-5.5.23
Cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_unix_addr=/tmp/mysql.sock-dextra_charsets=all-ddefault_ Charset=utf8-ddefault_collation=utf8_general_ci-dwith_myisam_storage_engine=1-dwith_innobase_storage_engine=1- dwith_memory_storage_engine=1-dwith_readline=1-denabled_local_infile=1-dmysql_user=mysql-dmysql_tcp_port=3306
Option:-dcmake_install_prefix=/usr/local/mysql Installation Location
-dmysql_unix_addr=/tmp/mysql.sock Specify socket (socket) file location
-dextra_charsets=all Extended character support
-ddefault_charset=utf8 Default Character Set
-ddefault_collation=utf8_general_ci Default character Proofing
-dwith_myisam_storage_engine=1 Installing the MYISAM storage engine
-dwith_innobase_storage_engine=1 Installing the InnoDB storage engine
-dwith_memory_storage_engine=1 Installing the Memory storage engine
-dwith_readline=1 Support READLINE Library
-denabled_local_infile=1 enable loading of local data
-dmysql_user=mysql specifying MySQL running user
-dmysql_tcp_port=3306 specifying the MySQL port
Make
Make install
cd/usr/local/mysql/
Chown-r Root.
Chown-r MySQL Data
CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
/usr/local/mysql/scripts/mysql_install_db--user=mysql
/usr/local/mysql/bin/mysqld_safe--user=mysql &
The restart will also take effect:
Vi/etc/rc.local
/usr/local/mysql/bin/mysqld_safe--user=mysql &
Set MySQL password
/usr/local/mysql/bin/mysqladmin-u Root Password 123456
14. Install PHP
Vi/usr/local/gd2/include/gd_io.h
typedef struct GDIOCTX
{
......
void (*data);
#加入此句
}
Cd/usr/src/lamp
Tar zxf php-5.4.25.tar.gz
CD php-5.4.25
VI ext/gd/libgd/gd_compat.c
Change # include <png.h> to # include </usr/local/libpng/include/png.h>
Insert # include <stdio.h> next line in #ifdef have_gd_jpg
./configure--prefix=/usr/local/php/--with-config-file-path=/usr/local/php/etc/--with-apxs2=/usr/local/apache2/ Bin/apxs--with-mysql=/usr/local/mysql/--with-libxml-dir=/usr/local/libxml2/--with-jpeg-dir=/usr/local/jpeg6/-- with-freetype-dir=/usr/local/freetype/--with-gd=/usr/local/gd2/--with-mcrypt=/usr/local/libmcrypt/-- With-mysqli=/usr/local/mysql/bin/mysql_config--enable-soap--enable-mbstring=all--enable-sockets-- With-pdo-mysql=/usr/local/mysql--without-pear
Option:--with-config-file-path=/usr/local/php/etc/Specify the profile directory
--with-apxs2=/usr/local/apache2/bin/apxs specifying Apache dynamic module location
--with-mysql=/usr/local/mysql/specifying MySQL Location
--with-libxml-dir=/usr/local/libxml2/Specifying Libxml location
--with-jpeg-dir=/usr/local/jpeg6/specifying the JPEG location
--with-png-dir=/usr/local/libpng/Specifying libpng location
--with-freetype-dir=/usr/local/freetype/Specifying FreeType location
--with-gd=/usr/local/gd2/Specifying GD location
--with-mcrypt=/usr/local/libmcrypt/Specifying Libmcrypt location
--with-mysqli=/usr/local/mysql/bin/mysql_config Specifying MYSQLI location
--ENABLE-SOAP Support for SOAP services
--enable-mbstring=all supports multibyte, string
--enable-sockets Support sockets
--with-pdo-mysql=/usr/local/mysql support for the PDO module with MySQL enabled
--without-pear does not install pear (installation pear requires an Internet connection.) Pear is PHP extension and application Library)
Make
Make install
Mkdir/usr/local/php/etc
CP Php.ini-production/usr/local/php/etc/php.ini
Vi/usr/local/apache2/etc/httpd.conf
AddType application/x-httpd-php. php. phtml. Phps
.......
DirectoryIndex index.php index.html
Test: vi/usr/local/apache2/htdocs/test.php
<?php
Phpinfo ();
?>
vi/usr/local/apache2/htdocs/mysql.php
<?php
$link =mysql_connect (' localhost ', ' root ', ' 123 ');
if ($link) echo ' IIIIIIIIIIII ';
Mysql_close ();
?>
15. Installing phpMyAdmin
Cd/usr/src/lamp
Tar zxf phpmyadmin-4.1.4-all-languages.tar.gz
Cp-r Phpmyadmin-4.1.4-all-languages/usr/local/apache2/htdocs/phpmyadmin
Cd/usr/local/apache2/htdocs/phpmyadmin
CP config.sample.inc.php config.inc.php
VI config.inc.php
$cfg[' Servers ' [$i] [' auth_type '] = ' cookie ', instead $cfg[' Servers ' [$i] [' auth_type '] = ' http ';
16. Building a Forum
Cd/usr/src/lamp
Unzip Discuz_7.2_full_sc_utf8.zip
MV upload//usr/local/apache2/htdocs/luntan
/usr/local/mysql/bin/mysql-u root-p
mysql> CREATE DATABASE Luntan;
Mysql> Grant all on luntan.* to [e-mail protected] ' localhost ' identified by ' 123456 ';
cd/usr/local/apache2/htdocs/luntan/
Chown-r Daemon config.inc.php attachments/forumdata/uc_client/data/cache/templates/
Vim/usr/local/php/etc/php.ini
Short_open_tag = Off change to Short_open_tag = On
/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start
This article from "Zeng Zhen" blog, declined reprint!
Lamp Environment Construction