Centos6.5 lamp and its error resolution

First, preparations
1, install GCC compile tool, gcc-c++
Address dependency yum install is recommended, if not networked installation CD can be used as a sourceyum
1) editing the yum configuration file:
#mount /dev/cdrom /mnt/cdrom
#vi /etc/yum.repos.d/CentOS-Media.repo
name=CentOS-$releasever- Media
Baseurl=file:///mnt/cdrom * modification for the CD mount point
Enabled=1 * changed to 1 to enable
2) shear/etc/yum.repos.d/CentOS-Base.repo
#mv /etc/yum.repos.d/CentOS-Base.repo /backup
3) followed by installing gcc, gcc-c++
# yum -y install gcc
# yum -y install gcc-c++
2, closed system RPM installation package of Apache, MySQL services
Turn off the startup service httpd and mysqld
#service httpd stop
#service mysqld stop
Identifying RPM package installed httpd and mysqld does not start post
chkconfig –level 2345 httpd(mysqld) off
3, turn off SELinux allows firewall port 80 access
Using Setup
Turn off the firewall and SElinux
1) turn off SELinux
#vi /etc/selinux/config
SELINUX=disabled * if SELinux is not disabled when you install, change the enforcing disabled
Effect until it is modified after the required restart Linux!
2) turn off the firewall Netfilter/iptables
Do firewall has not yet explained, simply close all of the firewall settings:
# * If you do not disable the firewall, by default port 80 access forbidden
iptables -Z
iptables -X
4, turn off unnecessary startup services
# ntsysv
Services listed below may be keeping from start services that are not listed can be closed:
Crond # ATD, crond planning tasks
Microcode_ctl # system IRQ port calls system services
Network # network settings
Sendmail # message
Sshd # remote administration
Syslog # the system log
5, copy the source package, unpack extract
Recommended store install source packages unified in a LAMP environment directory, such as/lamp
You can write a batch script that once all the. tar.gz installation packages unpack to extract
# vi tar.sh
cd /lamp
/bin/ls*.tar.gz > ls.list
/bin/ls*.tgz >> ls.list
ForTAR in ‘cat ls.list’//note two points above the tab,
/bin/tar -zxf $TAR
6, view, verify that the disk space is not full
* If the/partition is full, you can move the package to another partition or delete unwanted files
How to determine the error:
1) installation stops
2) stop after the page appears in the interface error or warning
How to determine the installation was successful:
Enter the installation directory, confirm the installation program is the successful
Second, compile, install
* Configure each source package to compile and install is complete, confirm that the installation directory is generated the installation files
make clean
# Install libxml2
Libxml2 is the XML c parser was originally developed for the Gnome project‘s tools, based on MIT License is a free, open source software. In addition to support for c language version other than also supports c++, PHP, Pascal, Ruby, Tcl and other language bindings in Windows, Linux, Solaris, MacOsX and other platforms to run on. Function is very strong, I believe meet the user‘s needs without any problems.
Libxml is a library for parsing XML documents. It is written in c language, and can call for multiple languages, such as c, C++,XSH. C#, Python,Kylix/Delphi,Ruby, and PHP. Perl XML::LibXML modules can also be used. It was originally developed for the GNOME project, but can now be used in a variety of ways. LibXML code portability is very good, because it is based on the ANSI c standard library, and the MIT license.
#Yum libxml2-devel if error, install this package and then try to install
Installpython-devel must have
cd /lamp/libxml2-2.9.1
./configure –prefix=/usr/local/libxml2/
make install
# Installing libmcrypt
Libmcrypt encryption algorithms library. Supports DES, 3DES, RIJNDAEL,Twofish, IDEA, GOST, CAST-256, ARCFOUR, SERPENT, SAFER+ algorithms.
cd /lamp/libmcrypt-2.5.8
./configure –prefix=/usr/local/libmcrypt/
make install
* Must call the gcc-c++ compiler is not installed error
# Install libltdl, libmcrypt source directory, the new software
cd /lamp/libmcrypt-2.5.8/libltdl
./configure –enable-ltdl-install
make install
# Install the mhash
Mhash is based on principle of discrete mathematics is not reverse the PHP extension, encryption, it does not open by default. Mhash can be used to create parity value, message digests, message authentication codes, and save without key information (such as passwords).
cd /lamp/mhash-
make install
# Install mcrypt
Encryption support for mcrypt PHP inside important extensions. Mcrypt library supports more than 20 kinds of encryption algorithms and 8 kinds of encryption mode
cd /lamp/mcrypt-2.6.8
LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/lib \
Backslash \ represents a single command has no finish line
# More than one command. LD_LIBRARY_PATH is used to specify Libmcrypt and location for the mhash library.
–With-libmcrypt-prefix is used to specify the location libmcrypt software
make install
#Mcrypt did not complete installation, this is the PHP module requires PHP after the installation is complete, and then continue with the installation
# Install zlib
Zlib data compression library is provided, developed by Jean-loup Gailly and Mark Adler, first edition of version 0.9 released on May 1, 1995. Zlib use the DEFLATE algorithm, originally written for libpng library, and later commonly used by many software. This library is free software, use zlib authorization
cd /lamp/zlib-1.2.3
make install >> /root/zlib.log
* May result in failed install libpng zlib install directory is not specified, convenient for unloading, proposals make install execution result output to the Setup log files facilitates its future uninstallation
# Install libpng
Included libpng library libpng packages. these libraries for decoding PNG images by other programs
cd /lamp/libpng-1.2.31
./configure –prefix=/usr/local/libpng
make install
# Jpeg6
Used to decode. jpg or. JPEG pictures
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
# Directory must be established manually
cd /lamp/jpeg-6b
./configure –prefix=/usr/local/jpeg6/–enable-shared –enable-static
make install
*–Enable-shared and–enable-static parameters respectively to build shared libraries and static libraries using libtool
# Install the FreeType
FreeType library is a free (open source), high quality, and portable font engine, it provides a unified interface to access a variety of font formats, including TrueType,OpenType, Type1, CID, CFF, Windows FON/FNT, X11 PCF. Supports monochrome bitmaps, anti-aliased bitmap rendering. FreeType library is highly modular library, although it is using ANSI c development, but the idea of object-oriented and, therefore, FreeType users the flexibility to cut it.
cd /lamp/freetype-2.3.5
make install
# Install GD library
GD library is a graphical extension PHP, GD library provides a set of API to handle pictures, use the GD library to work with pictures, or pictures. In the GD library on a Web site often used to generate thumbnails, or is used to add a watermark, or used to generate the character code, generate reports or data on the website.
cd /lamp/gd-2.0.35
* PNG error, modify the method:
vi gd_png.c
# Include PNG.h replace # 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 install
* If the previous did not specify when configuring zlib install directory, GD configuration not added–with-zlib=/usr/local/zlib/parameter
# Install Apache
configure: error:
make install
make clean
rm CMakeCache.txt
# If errors, clear the cache, use the above command
cd /usr/local/mysql/
chown -R mysql .
chgrp-R mysql .
# Modify the MySQL directory permissions
# Create database authorization tables, initialize the database
chown-R root .
chown -R mysql data
# Modify the MySQL directory permissions
cpsupport-files/my-medium.cnf /etc/my.cnf
# MySQL configuration file
Start the MySQL service:
1. using the original source code to use and start MySQL
/usr/local/mysql/bin/mysqld_safe–user=mysql &
And symbolic background
2. restart to take effect in the future:
/usr/local/mysql/bin/mysqld_safe–user=mysql &
3. set a MySQL password
/usr/local/mysql/bin/mysqladmin-uroot password lonly
Empty the history command
* For the root MySQL user and password 123
* Note passwords cannot be written in the 123
/usr/local/mysql/bin/mysql -u root -p
MySQL>\s # see if the character set to UTF8
* Enter the MySQL set to change password
mysql> exit
* Log in MySQL client console settings specify the root password
# Install PHP
Prior to compilation to ensure that systems have installed libtool and libtool-ltdl software packages, the installation:
yum -y install “libtool*”
yum -y install “libtool-ltdl*”
vi /usr/local/gd2/include/gd_io.h
typedef struct gdIOCtx
# Add this sentence
#PHP 5.4 bug, detect GD library has the problem, you need to manually modify
cd/lamp/ php-5.4.25
./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-png-dir=/usr/local/libpng/ –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 –without-pear
If front when configuring zlib install directory is not specified, PHP configuration, don’t add the–with-zlib-dir=/usr/local/zlib/parameter
–With-config-file-path=/usr/local/PHP/etc/specifies the configuration file directory
–With-apxs2=/usr/local/apache2/bin/apxs specifies the location dynamic Apache module
–With-MySQL=/usr/local/MySQL/specifies the location MySQL
–With-libxml-dir=/usr/local/libxml2/specifies the location libxml
–With-JPEG-dir=/usr/local/jpeg6/specifies the JPEG location
–With-PNG-dir=/usr/local/libpng/specifies the location libpng
–With-FreeType-dir=/usr/local/FreeType/specifies the location FreeType
GD location specified–with-GD=/usr/local/GD2/
–With-mcrypt=/usr/local/libmcrypt/specifies the location libmcrypt
–With-mysqli=/usr/local/mysql/bin/mysql_config specifies the location mysqli
–Enable-SOAP supports SOAP services
–Enable-mbstring=all support multibyte string
–Enable-sockets support for Sockets
–Without-pear not install PEAR (PEAR installation needs to connect to the Internet. PEAR is the PHP extension and application repository)
make install
Generated PHP.ini
cp/lamp/php-5.4.25/php.ini-production /usr/local/php/etc/php.ini
Test connectivity of Apache and PHP, Apache to parse php files
vi /usr/local/apache2/etc/httpd.conf
AddType application/x-httpd-php.php .phtml .phps
(Note the capitalization)
*.Phtml. phps to PHP source file for syntax highlighting
Restart the Apache service:/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start
*Apache could not start prompt cannot restore segment protafter reloc:Permission denied error, SELinux problem, you can turn off SELinux or execute the command texrel_shlib_t/usr/local/apache2/modules/libphp5.so
Enter through the browser address: http://Apache server address/test.php
Rpm package installation page of the default directory/var/www/html/
* Sometimes the browser for the first time a test fails, close your browser you can restart and try again, non-compilation error
# Compile and install Memcache
Memcache is a high-performance, distributed memory object caching system, by maintaining a unified memory large hash tables, which can be used to store data in various formats, including images, videos, files, and database search results. In simple terms is called the data into memory, and then read from the memory, so it can improve the reading speed.
yum -y installzlib-devel
cd memcache-3.0.8
make && make install
# Compile and install mcrypt
cd /lamp/php-5.4.25/ext/mcrypt/
./configure –with-php-config=/usr/local/php/bin/php-config –with-mcrypt=/usr/local/libmcrypt/
make install
#PHP when the installation is complete, these commands install the mcrypt module
extension_dir =”/usr/local/php/lib/php/extensions/no-debug-zts-20100525/”
# Open a note, and modify
# Added
# Restart Apache, can be found in the phpinfo that two modules
# Install memcache source code
First install a dependent package libevent
yum -y install “libevent*”
# On the second CD of CentOS 6.3, replace
cd /lamp/memcached-1.4.17
make && make install
useradd memcache
# Add memcache users, the user having to log in, do not set a password
/usr/local/memcache/bin/memcached-umemcache &
netstat an | grep :11211
telnet 11211
Write starts:
/usr/local/memcache/bin/memcached-umemcache &
# Install phpMyAdmin
cp -r phpMyAdmin-4.1.4-all-languages/usr/local/apache2/htdocs/phpmyadmin
cp config.sample.inc.phpconfig.inc.php
vi config.inc.php
$cfg[‘Servers’][$i][‘auth_type’]= ‘cookie’;
$cfg[‘Servers’][$i][‘auth_type’]= ‘http’;
* Set AUTH_TYPE HTTP, is set to the HTTP authentication mode
Enter through the browser address: http://Apache server address/phpMyAdmin/index.php
Username is root, password set specified when the root password for MySQL (lampbrother)
Most errors in the installation process for input errors, you can check the history command to view the history.