Configure Apache, Mysql, and Php in RedHatEnterpriseLinux5

Source: Internet
Author: User
In RedHatEnterpriseLinux5, configure Apache, Mysql, and Php-Linux Enterprise Application-Linux server application information. For more information, see the following. Author: jack

Step 1: Prepare the system and software
System Version redhat enterprise linux 5 and kernel version 2.6.18
System installation components: GNOME, graphical Internet, editor, development tool, basic system, system tool, management tool, X Window environment
(Because the machine is limited and it needs to be tested from the local machine, GNOME and Internet environments are installed)
Step 2: Prepare the Software Package
Httpd software: httpd-2.2.8.tar.bz2
The mysql package is downloaded from the mysql official website. I chose the ehel5 rpm package.
MySQL-server-community-5.0.51a-0.rhel5.i386.rpm
MySQL-client-community-5.0.51a-0.rhel5.i386.rpm
MySQL-devel-community-5.0.51a-0.rhel5.i386.rpm
MySQL-shared-community-5.0.51a-0.rhel5.i386.rpm
Php5 software package: php-5.2.5.tar.bz2
Other library files:
Curl-7.15.0.tar.gz
Freetype-2.3.5.tar.gz
Gd-2.0.35.tar.gz
Jpegsrc.v6b.tar.gz
Libpng-1.2.26.tar.gz
Libxml2-2.6.31.tar.gz
PDFlib-7.0.3-Linux-php.tar.gz
T1lib-5.0.0.tar.gz
Xpm-3.4k.tar.gz
Zlib-1.2.3.tar.gz
Gettext-0.16.tar.gz
Other management software packages:
PhpMyAdmin-2.11.6-rc1-all-languages.tar.gz
Webmin-1.410.tar.gz
Step 3: Install httpd and mysql in the installation sequence. It doesn't matter in this environment, but the php5 software package must be installed at the end. Install httpd first.
The brief steps are as follows: # copy all the software packages to one location after the prompt. Here I create the lamp directory under the/usr/local/src directory, copy all the software packages to lamp.
# Cd/usr/local/src/lamp
# Tar zxvf httpd-2.2.8.tar.bz2
# Cd http-2.2.8
#./Configure -- prefix =/usr/local/apache2 -- enable-rule = SHARED_CORE -- enable-module = so
# Make
# Make install
After installing apache, enter the command
#/Usr/local/apache2/bin/apachectl-k start
Open the Firefox browser (my favorite) from a local machine or another machine, enter the address http: // your server IP address, remember to open port 80 of the server, or an error may be prompted, if It is correct, an "It works! "Prompt page. apache2 is basically installed.
Next, install Mysql. First, install the installation package of mysql-server, and then find the perl-DBI package on the installation disc, if you install the DVD directly, go to the Server folder on the cd. If you install it on cd, go to cd-2 to go to the same directory.
# Mount/dev/cdrw/media
# Rps-ivh/media/Server/perl-DBI-1.52-1.fc6.i386.rpm
After installation, install other mysql packages.
# Rpm-Uvh MySQL-server-community-5.0.51a-0.rhel5.i386.rpm
# Rpm-Uvh MySQL-client-community-5.0.51a-0.rhel5.i386.rpm
# Rpm-Uvh MySQL-devel-community-5.0.51a-0.rhel5.i386.rpm
# Rpm-Uvh MySQL-shared-community-5.0.51a-0.rhel5.i386.rpm
After the installation is complete, modify the mysql root User Password. The default value is null. The command is as follows:
#/Usr/bin/mysqladmin-u root password 'password string'
After logging on to mysql from the command line, enter
# Mysql-u root-p
You will be prompted to enter the password. The basic installation of Mysql is complete.
Next, install other library files. The installation sequence of these software packages should be freely available (zlib is installed before libpng). However, I think Zlib can be installed first for reference only.
I didn't install zlib first in this order, so I chose to install zlib at will, first Curl,
# Tar zxvf curl-7.15.0.tar.gz
# Cdcurl-7.15.0
#./Configure -- prefix =/usr/local/curl
(I think the -- with-zlib switch can be added, but it is useless this time)
# Make
# Make install
For jpeg installation, jpeg cannot be used to create the directory required for installation.
# Mkdir-pv/usr/local/jpeg/{, bin, lib, include, man/man1, man1}
#./Configure -- prefix =/usr/local/jpeg -- enable-shared -- enable-static
# Make
# Make install
Libxml2 Installation
# Tar zxvf libxml2-2.6.31.tar.gz
# Cd libxml2
#./Configure -- prefix =/usr/local/libxml2
(You can try to turn on the zlib switch, -- with-zlib)
# Make (time may be a little longer)
# Make install
# Cp xml2-config/usr/bin
LibPDF Installation
# Tar zxvf PDFlib-7.0.3-Linux-php.tar.gz
# Cd pdflib
# Cp bind/php5/php520mt/libpdf-php.so/usr/local/lib/
(Php503, php510, and php520 directories are in the same level in the above php520mt directory. I don't know if it is the version difference)
Install T1lib
# Tar zxvf t1lib-5.0.0.tar.gz
# Cd t1lib
#./Configure -- prefix =/usr/local/t1lib
# Make without-doc
# Make install
Freetype Installation
# Tar zxvf freetype-2.3.5.tar.gz
# Cd freetype
#./Configure -- prefix =/usr/local/freetype
# Make
# Make install
Zlib Installation
# Tar zxvf zlib-1.2.3.tar.gz
#./Configure -- shared
# Make
# Make install
Libpng Installation
# Tar zxvf libpng-1.2.26.tar.gz
# Cd libpng
# Cp scripts/makefile. linux./makefile
#./Configure -- prefix =/usr/local/libpng
# Make
# Make install
The error message of AM_ICON may appear when installing GDlib. In this case, you need to install the gettext package.
# Tar zxvf gettext-0.16.tar.gz
# Cd gettext
#./Configure -- prefix =/usr/local/gettext
# Make
# Make install (a little longer)
Next, install gdlib.
# Tar zxvf gd-2.0.35.tar.gz
# Cd gd
#./Configure -- with-png =/usr/local/lib \
-- With-zlib =/usr/local/lib \
-- With-freetype =/usr/local/freetype/lib \
-- With-jpeg =/usr/local/jpeg/lib
# Make
# Make install
Install PHP5
# Tar zxvf php-5.2.5.tar.bz2
# Cd php
#./Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache/bin/apxs \
-- Enable-track-vars -- with-sockets -- enable-sockets -- with-sysvshm -- with-sysvsem \
-- With-pdflib-dir =/usr/local/lib -- with-jpeg-dir =/usr/local/jpeg \
-- With-png-dir =/usr/local/lib -- with-zlib-dir =/usr/local/lib \
-- With-freetype-dir =/usr/local/freetype -- with-curl =/usr/local/curl \
-- With-libxml-dir =/usr/locallibxml2/lib -- with-t1lib =/usr/localt1lib \
-- With-gettext =/usr/localgettext/lib -- with-gd -- with-mysql
(It is best to add mbstring and mcypt. I don't know if it is necessary)
After configure is successful, you will be prompted for the PHP welcome page: Thank you for using PHP.
# Make
# Make test
(About 3000 tests)
# Make install
Php. INI File Modification
# Cp php. ini. dist/usr/local/lib/
Find the content for modifying extension_dir = './'
Extension_dir =/usr/local/lib
Extension = libpai_php.so
Save and exit

Finally, modify the apache configuration file httpd. conf.
# Vi/usr/local/apache2/conf/httpd. conf
Find AddType in DefaultType text/plain

Enter the following content:
AddType application/x-httpd-php. htm
AddType application/x-httpd-php. html
AddType application/x-httpd-php. phtml
AddType application/x-httpd-php. php
AddType application/x-httpd-php. php3
AddType application/x-httpd-php. php4
AddType application/x-httpd-php-source. phps
(Do you have to enter so many items)
Find DirectoryIndex index.html and enter index. php
Save the file and exit.
Test php and create the info. php file to the website directory. Here I am/usr/local/apapche2/htdocs
The content is as follows:
Echo phpinfo ();
?>
Restart the apache service and test it from the local machine or another machine.
Enter http; // ip address/info. php
If you can see the output of php configuration information, you can install php.

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.