Configure LAMP ( Apache, MySQL, PHP ) on RedHat Enterprise Linux 6

Red Hat Enterprise Linux (RHEL) is a Linux-based operating system developed by Red Hat and targeted toward the commercial market. Red Hat Enterprise Linux is released in server versions for x86, x86-64, Itanium, PowerPC and IBM System z, and desktop versions for x86 and x86-64. All of Red Hat's official support and training and the Red Hat Certification Program center around the Red Hat Enterprise Linux platform. Red Hat Enterprise Linux is often abbreviated to RHEL, although this is not an official designation.

The first version of Red Hat Enterprise Linux to bear the name originally came onto the market as "Red Hat Linux Advanced Server". In 2003 Red Hat rebranded Red Hat Linux Advanced Server to "Red Hat Enterprise Linux AS", and added two more variants, Red Hat Enterprise Linux ES and Red Hat Enterprise Linux WS.

While Red Hat uses strict trademark rules to restrict free re-distribution of their officially supported versions of Red Hat Enterprise Linux, Red Hat freely provides the source code for the distribution's software even for software where this is not mandatory. As a result, several distributors have created re-branded and/or community-supported re-builds of Red Hat Enterprise Linux that can legally be made available, without official support from Red Hat. CentOS and Oracle Linux aim to provide 100% binary compatibility with Red Hat Enterprise Linux.

Redhat Official Website www.redhat.com

Part 1 System and software preparation

System Version RedHat Enterprise Linux 6.0 ( Santiago )

Kernel version 2.6.32-71.el6.x86_64

Part 2 Erection YUM repository

Since Redhat's yum online updates for a fee, if it is not registered can not be used, that can not install the software online

2.1 Delete the original redhat yum source

# rpm -aq | grep yum|xargs rpm -e --nodeps

2.2 Download new yum install package ( Using CentOS YUM source )

# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

2.3 Install YUM package

# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
# rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

Note: The last two installation package put together to be installed, otherwise it will prompt interdependence, the installation fails.

2.4 Change yum source ( We use www.163.com's CentOS mirror source )

# cd /etc/yum.repos.d/
# wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo
# vim CentOS6-Base-163.repo

Edit the file, the file inside the $ releasever replace all the version number (6), save! Or directly to copy the following codes to CentOS6-Base-163.repo file can be (has been modified)

#########################################################################
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6


#########################################################################

2.5 Clean the yum cache

# yum clean all
# yum makecache

Part 3 Installation LAMP

3.1 Installation Apache, MySQL, PHP

yum -y install httpd php mysql mysql-server php-mysql

3.2 Install MySQL extension

yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql

3.3 Install PHP extension

yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc

3.4 Install Apache extension

yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql

3.5 Configuration services

# /sbin/chkconfig httpd on             ( Set apache server httpd service start at boot )
# /sbin/chkconfig --add mysqld         ( Add mysql service in the list of services )
# /sbin/chkconfig mysqld on            ( Set MySQL service start at boot )

# /sbin/service httpd start            ( Starting apache server httpd service )
# /sbin/service mysqld start           ( Starting MySQL service )

3.6 Set mysql database root account password ( quotation marks filled password )

mysqladmin -u root password 'newpassword'

Part 4

4.1 In \var\www\html directory to create a file index.php, written the following code in the index.php file, save.

<?php phpinfo(); ?>

4.2 In the browser to access http://localhost/. If you get the following information, proved LNMP ( Apache, MySQL, PHP ) has been built successfully.

Configure LAMP ( Apache, MySQL, PHP ) on RedHat Enterprise Linux 6

0.00 avg. rating (0% score) - 0 votes