Rhel5.8-lamp Environment Construction

Source: Internet
Author: User
Tags mcrypt snmp

First, lamp installation before the preparation

1, zlib (1.2.8): http://zlib.net/zlib-1.2.8.tar.gz

The zlib library is used for the compression and output functions of gzip used in PHP.

2, LIBXML2 (2.2.9): ftp://xmlsoft.org/libxml2/

The DOM used in PHP, Libxml, SimpleXML, SOAP, WDDX, XSL, XSLT, XML, XMLReader, XMLRPC, XmlWriter extension to the library to be used.

3, Libcrypt (2.5.8): http://mcrypt.sourceforge.net

MCrypt is an extension of PHP that completes the encapsulation of commonly used cryptographic algorithms. In fact, the extension is the MCrypt Standard Class library encapsulation, MCrypt completed a considerable number of common cryptographic algorithms, such as DES, TripleDES, Blowfish (Def Ault), 3-way, safer-sk64, safer-sk128, Twofish , TEA, RC2 and GOST encryption algorithms, and provides a model of CBC, OFB, CFB, and ECB four block encryption.

4, Libpng (1.5.18): http://sourceforge.net/projects/libpng/

is a set of free, open source code library, support for PNG graphics file creation, read and write operations. Using the Zlib library as the compression engine, zlib is also the compression engine used by the famous gzip (GNU Zip).

5, Jpeg8 (v8d): http://www.ijg.org/files/

is a set of free, open source code library, support the creation of Jpg/jpeg graphics files, read and write operations.

6, FreeType (2.5.2): http://www.freetype.org/download.html

The FreeType library is a completely free (open source), high quality and portable font engine that provides a unified interface to access multiple font format files, including TrueType, OpenType, Type1, CID, CFF, Windows fon/fnt, X11 PCF and so on.

7, autoconf (2.69): Http://ftp.gnu.org/gnu/autoconf/?C=M;O=D

Autoconf is a tool for generating shell scripts that can automatically configure software source code packages to accommodate a variety of UNIX class systems. The GD2 used it.

8, GD2 (2.1.0): http://libgd.bitbucket.org/

GD Library, is the PHP processing graphics extension Library, the GD library provides a series of APIs for processing pictures, using the GD library can process pictures, or create pictures.

8.2, libxpm (It's better to install it, or you will be given the wrong error when installing PHP)

Let your program have the ability to read the XPM format image

9. Apr (1.5.1): http://apr.apache.org/download.cgi

10, Apr-util (1.5.3): http://apr.apache.org/download.cgi

11, Pcre (8.35): http://www.pcre.org/

PCRE (perl Compatible Regular Expressions) is a Perl library that includes a Perl-compatible regular expression library.

12. Apache httpd (2.4.9): http://httpd.apache.org/download.cgi

13. mysql (5.6.17): http://dev.mysql.com/downloads/mysql/
14. PHP (5.5.13): http://www.php.net/
Note: If the installation environment is rhel6.3, then the above dependency package and MySQL, Apache, PHP can be directly used in the image of the RPM file installed.
#yum install Mysql-server httpd php-y---Configurable yum source, installed with yum command

Install dependent packages
#yum install gcc net-snmp-devel curl-devel perl-dbi php-gd php-mysql php-bcmath php-mbstring php-xml mysql-devel-y

Two, source package installation Dependency Package

1, installation Zlib

    1. Decompression: Tar xvf zlib-1.2.8.tar.gz
    2. Generate Makefile:./configure--prefix=/usr/local/zlib/
    3. Compiling: Make
    4. Install: Make install

PHP5 The source code is configured, it is used to specify the location of the Zlib library files by adding the "--with-zlib-dir=/usr/local/zlib" option in the Configure command's options

2, installation LIBXML2

    1. Decompression: Tar xvf libxml2-2.9.0.tar.gz
    2. Generate Makefile:./configure--PREFIX=/USR/LOCAL/LIBXML2--with-zlib=/usr/local/zlib/
    3. Compiling: Make
    4. Install: Make install

PHP5 The source code is configured, it is used to specify the location of the LIBXML2 library files by adding the "--with-libxml-dir=/usr/local/libxml2" option in the Configure command's options

3, Installation Libmcrypt

    1. Decompression: Tar xvf libmcrypt-2.5.8.tar.gz
    2. Generate Makefile:./configure--PREFIX=/USR/LOCAL/LIBXML2--with-zlib=/usr/local/libmcrypt/
    3. Compiling: Make
    4. Install: Make install

PHP5 The source code is configured, it is used to specify the location of the Libmcrypt library files by adding the "--with-mcrypt-dir=/usr/local/libmcrypt" option in the Configure command's options

After the installation completes the Libmcrypt library, the different Linux system versions may also install the Libltdl library. The installation method and the previous steps are the same, you can go to the extracted directory/usr/local/src/libmcrypt-2.5.8, find the Libltdl Library source code is located in the directory Libltdl, enter this directory according to the following commands to configure, compile, install it.

4, installation libpng

    1. Decompression: Tar xvjf libpng-1.5.18.tar.xz
    2. Generate Makefile:./configure--prefix=/usr/local/libpng/
    3. Compiling: Make
    4. Install: Make install

PHP5 The source code is configured, it is used to specify the location of the Libpng library files by adding the "--with-libpng-dir=/usr/local/libpng" option in the Configure command's options

Note: There is a version compatibility issue between Libpng and zlib, and if the version is not appropriate, the error will be reported as

  1. /bin/sh./libtool--tag=cc--mode=link gcc-g-o2-o pngfix contrib/tools/pngfix.o libpng16.la-lm-lz-lm/usr/lib6 4/libz.so
  2. Libtool:link:gcc-g-o2-o. Libs/pngfix contrib/tools/pngfix.o/usr/lib64/libz.so./.libs/libpng16.so-lz-lm-wl,-rpat H-wl,/usr/local/lib
  3. contrib/tools/pngfix.o:in function ' Zlib_reset ':
  4. /home/fred/root/lamp/libpng-1.6.10/contrib/tools/pngfix.c:2179: <span style= "color: #ff0000;" >undefined reference to ' inflatereset2</span> '
  5. Collect2:ld returned 1 exit status
  6. MAKE[1]: * * * [PngFix] Error 1
  7. MAKE[1]: Leaving directory '/home/fred/root/lamp/libpng-1.6.10 '
  8. Make: * * * [ALL] Error 2

It is known that the problem exists between zlib-1.2.8 and libpng-1.6.10, zlib-1.2.8 and libpng-1.5.18 can be installed normally, and there is some description of this issue in the article.

Http://stackoverflow.com/questions/19738464/pngfix-c2151-undefined-reference-to-inflateres

5, Installation Jpeg8

    1. Decompression: Tar xvf jpegsrc.v8d.tar.gz
    2. Generate Makefile:./configure--prefix=/usr/local/jpeg8/
    3. Compiling: Make
    4. Install: Make install

When installing the GD2 library configuration, you can specify the location of the Jpeg8 library files by adding the "--with-jpeg=/usr/local/jpeg8" option to the options in the Configure command. You also specify the location of the library file when you install PHP.

6, Installation FreeType

    1. Decompression: Tar xvf freetype-2.5.2.tar.gz

2. Set Environment variables:

Export libpng_cflags= "-i/usr/local/libpng/include"

Export libpng_ldflags= "-l/usr/local/libpng/lib"

3. Generate Makefile:./configure--prefix=/usr/local/freetype/

Compiling: Make

Install: Make install

If the installation succeeds, there will be bin,include,lib and share four directories in the/usr/local/freetype directory. And when installing the GD2 library, specify the FreeType library file location by adding the "--with-freetype=/usr/local/freetype/" option in the Configure command option.

Third, source installation MySQL, Apache, PHP, Zabbix

1, MySQL use the latest version of the RPM package installation.

Create user, authorization, and import Zabbix scripts after the MySQL database is installed

Create Zabbix users and Groups

# Groupadd Zabbix

# useradd–g Zabbix Zabbix

Service MySQL Start--start MySQL

Create Zabbix database and authorization
Mysql> CREATE database Zabbix character set UTF8 collate utf8_bin;
Mysql> Grant all privileges the zabbix.* to ' Zabbix ';

or:mysql> grant all privileges the zabbix.* to [e-mail protected] identified by ' Zabbix ';

Import Zabbix-related SQL scripts:
[Email protected]/]# cd/usr/share/doc/zabbix-server-mysql-2.4.4/create/
[[email protected]/]# ls
Data.sql Images.sql Schema.sql

# Mysql-uroot-p Zabbix < Schema.sql
# Mysql-uroot-p Zabbix < Images.sql
# Mysql-uroot-p Zabbix < Data.sql

2. Installing Apache

Apache Deployment 1. Unzip the tar package # tar ZXVF httpd-2.2.19.tar2. Compile apache#./configure--prefix=/data/apache2--enable-so--enable-mods-shared=most--with-mpm=worker3. Install # make && make install4. Build Apche user and Apache Group # groupadd apache# useradd–g Apache apache5. Start apache#/usr/local/apache2/bin/apachectl start6. Add on Boot # echo "/usr/local/apache2/bin/apachectl start"  >>/etc/rc.local

3. Install PHP

3.1 Yum Installation Dependency

# yum Install–y libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetpyp-devel Flex GD Curl-deve L

3.2 Unpacking The TAR Package

Tar zxvf Php-5.3.6.tar

3.3 Compiling PHP

#./configure--prefix=/data/php5--with-apxs2=/usr/local/apache2/bin/apxs--with-gd--with-freetype-dir-- With-jpeg-dir--with-png-dir--with-mysql=/usr/local/mysql--with-zlib --with-config-file-path=/etc -- Bindir=/usr/bin--sbindir=/usr/sbin--with-curl--with-exec-dir=/usr/bin--enable-xml--with-xmlrpc=shared-- Enable-magic-quotes--enable-sockets--enable-mbstring=all--with-pdo-mysql=/usr/local/mysql--with-gettext

3.4 Installation

# Make && make install

3.5 Integrating PHP into Apache

Add PHP configuration to Apache config file httpd.conf

AddType application/x-httpd-php. php

DirectoryIndex after index.html modify or add index.php

3.6 Adding Bcmath extension modules

# CD php-5.3.6.tar/ext/bcmath/

# phpize

#./configure--with-bcmath--with-php-config=/usr/bin/php-config

# Make && make install

3.7 Configure the Bcmath module in php.ini based on the directory specified after the installation is complete

Configuration of the php.ini file:

Add path to extension file: extension_dir=extension_dir= "/opt/data/php5/lib/php/extensions/no-debug-zts-20131226/" fill in the actual path

Join Extension=bcmath.so--add Bcmath module. Other modules can also be added as needed.

3.8 Restarting Apache

#/usr/local/apache2/bin/apachectl Restart

Tip: After compiling the installation, there is no php.ini configuration file

You need to manually copy the php.ini-production from the PHP source installation file directory to the/etc/directory and rename it to PHP.ini

4, Zabbix-server Subordinates

4.1 Set up Zabbix user Zabbix Group-Create Zabbix users and groups when deploying MySQL user, no need to create

# Groupadd Zabbix

# useradd–g Zabbix Zabbix

4.2 Yum Installation Dependency Package

# yum Install–y Yum Net-snmp-devel

4.3 Unpacking the Tar package

# tar ZXVF zabbix-2.0.6.tar.gz

4.4 Compiling Zabbix

#./configure--prefix=/data/zabbix--enable-server--enable-agent--with-mysql--with-net-snmp--with-libcurl

4.5 Modifying the Zabbix configuration file

Modify the Zabbix configuration file/usr/local/zabbix/etc/zabbix_server.conf

Modify Dbname=zabbix

Dbuser= Zabbix

dbpassword= actual password

4.6 Copy Zabbix PHP page to Apache page directory and rename to Zabbix

# cp-r/data/ww/zabbix/zabbix-2.0.6/frontends/php /data/apache2/htdocs/zabbix

If Apache is installed in rpm, it should be copied to/var/www/... Directory under

4.7 Copy Zabbix startup script to/etc/init.d

# cp/data/ww/zabbix/zabbix-2.0.6/misc/init.d/fedora/core/zabbix_*/etc/init.d/

4.8 Adding a Zabbix service port

Zabbix-agent 10050/tcp # Zabbix Agent

Zabbix-agent 10050/UDP # Zabbix Agent

Zabbix-trapper 10051/tcp # Zabbix Trapper

Zabbix-trapper 10051/UDP # Zabbix Trappe

4.9 Modifying PHP.ini

Date.timezone = Asia/shanghai

Post_max_size = 16M

Max_execution_time = 300

Msx_input_time = 300

4.10 Restarting Apache

4.11 Web Configuration Server

Other:

Lamp Environment Building If it is in the rhel6.0 or above version, it is very easy, because the system image of the RPM package itself is necessary apache-httpd,php,mysql and other dependent packages, configure the local Yum source, the direct Yum command installation. Zabbix download RPM package from official website is also easy to install.

If it is rhel6.0 below, such as the installation of the environment for rhel5.8, the system comes with PHP RPM package version is too low, resulting in the installation of Zabbix check environment does not pass, and then download the latest version of the PHP source code, compile and install, all kinds of toss, a variety of egg explosion problems.

In summary, during the installation process attention to install the sequence of dependencies, version, and finally install the PHP extension, every step of the installation process to pay attention to the problem, ignoring the small error and warnning may cause the final Zabbix in the initial inspection of the installation environment failure.

Rhel5.8-lamp Environment Construction

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.