LAMP Installation RHEL/Centos Minimal

Howto install a Lamp Stack on RHEL and CentOS

What is LAMP (LAMP Stack) ?


LAMP is an acronym that refers to various free and open source software that is often referred to as a stack. In general terms the acronym LAMP refers to:

Linux: The Linux Operating System

Apache: HTTP Web Server

MySQL, MariaDB or MongoDB: Database

PHP, Python or Perl: Scripting languages used for creating dynamic web page content.

LAMP loosely defines which components comprise the stack, however, it is down to individual preferences/requirements as to exactly which components you choose.

All of the components needed should be available within your chosen Operating Systems repositories.




Linux Operating System


Linux is the Operating system. This can be any number of popular distributions. The most common within a LAMP stack are CentOS, Red Hat (RHEL), Debian and Ubuntu.


Apache Web Server


The majority of web sites on the World Wide Web are served from an Apache Web Server. Apache is developed by the open community (Apache Software Foundation) as open source software.


MySQL Database


MySQL is a SQL Database Management System (DBMS) currently owned by Oracle. However, the source code was released under the GNU General Public License.


MariaDB


MariaDB is basically a fork of MySQL


PHP


PHP is a scripting language designed for the development of web pages. PHP commands can be inserted into standard HTML documents rather than calling an external file to process data. PHP is free software released under the PHP license.


Python


Python is a very popular general purpose programming language used by many for its flexibility.


Perl


Perl is an interpreted scripting language language known for its abilities in the parsing and manipulation of data and files.


Installing the LAMP Stack


The steps involved for installing a LAMP stack will obviously vary depending upon the chosen components. In the example that follows I have chosen to go with the following components:

Linux OS: CentOS 6.5 (Minimal Server Installation)

Apache Web Server

MySQL Database

PHP


Linux Installation (CentOS 6.5 Minimal)


Firstly you will need to download an "iso" image of the chosen operating system. In this example, I have chosen CentOS 6.5 Minimal Server build (64 bit)

The following link can be used to download the "iso" image:


Download CentOS 6.5 Minimal


Filename: CentOS-6.5-x86_64-minimal.iso

Once you have downloaded your CentOS 6.5 Minimal "iso" image, you will need to burn this to a blank DVD. For software that can do this, search for "dvd iso burning software" in the search box located at the top of this page. Your current system may already have CD/DVD burning software installed such as "Brasero, K3B, Nero, CDBurnerXP or Roxio". Once you have burned your "iso" image of CentOS 6.5 to your DVD, you will need to leave the DVD in the DVD drive and reboot your system. As your computer boots, you will need to press the appropriate key to access your system's BIOS configuration settings. On many systems this key will be "F8", "F11" or "F12". Most systems will display the a message indicating which key needs to be pressed. Once you have access to your BIOS settings, you will need to modify the boot sequence order of your system to boot from CD/DVD first. Once you have made this change, you can reboot your system and follow the instructions below.


Installing Linux (CentOS 6.5 Minimal)


To install the Linux component of our LAMP stack, simply follow the instructions below:


Welcome to CentOS 6.5 Installer Menu


To start your installation of Centos 6.5, simply highlight the "Install or upgrade an existing system" and press enter. Your installation will now start.


CentOS 6.5 Installer menu

Test Media


It is always recommended that you test your media before carrying out an installation. If you are happy that your media is OK, then select "skip" to continue.


Test Downloaded Media

Choose Installation Language


At this screen you will need to choose the language to be used during the installation. In this example I have chosen: "English".


CentOS 6.5 Choose Installation Language

Reinitialize Disk Warning


If you have used your disk before for another installation, you may see a screen similar to the one below. In this example we would need to choose the option "Re-Initialize-all".


Re-Initialize Disk - CentOS 6.5

Select your Systems Time Zone


Choose the time zone that is relevant to you. In this example I have chosen "Europe/London". One selected, click "OK" to continue with the installation.


Select Time Zone CentOS

Pick a root Password


At this screen you will need to choose a password for the root account. As this will be the most powerful account on the system, choose a combination of upper/lower-case letters numbers and symbols.

Pick root Password - CentOS 6.5

Partitioning Type


At this screen you will need to choose the disk that you are going to install the operating system to. In this example I have "sda", a 10GB disk.


Partition Disk

Write Storage Configuration to Disk


To continue with the installation and write our partition options to disk choose "Write changes to disk". If you need to go back and change an option, simply select the "Go Back" option.

Write Storage Configuration to Disk

Package Installation


Your installation should now commence. Progress is indicated as per the progress indicator.


Installing Packages

Complete


Congratulation, the installation of CentOS 6.5 Minimal edition is now complete. Select Reboot to start using your new system. You may need to remove the media from your DVD drive before re-booting.


CentOS 6.5 Installation now complete

First Login Screen


To login to your new system, you will need to supply the password you chose earlier.


Centos 6.5 Login Screen

Set Hostname


To set the hostname for your new server, you need to edit the following file:

/etc/sysconfig/network

Change the line HOSTNAME= to name of your server (lamp01 in this example).



[root@lamp01 html]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=lamp01

Set network to start automatically


To automatically have your network settings start at system boot, you will need to amend the following line to read onboot=yes. The configuration file for this can be found in: (note we are using dhcp for this test)

/etc/sysconfig/network/network-scripts/ifcfg-eth0

"ifcfg-eth0" is the name of the interface that my system is going to use. This may be different on your system.



[root@lamp01 html]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=08:00:27:A0:F1:4C
TYPE=Ethernet
UUID=2be4d31f-abe3-4d46-bc35-844b0020a723
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

Reboot


We can now do a quick reboot of our system to check that our network settings are working and that our hostname has been picked up correctly. To reboot simply issue the following command as the root user shutdown -r now

Once your system is backup, login and issue the command "ip a s" to display your assigned IP address. You should also see that your chosen hostname is also displayed.


testing for an ip address

Testing Access to Online Repositories


To test that we have access to the necessary online repositories we can use the "yum repolist" command:

yum repolist command


Apache Web Server Installation


To install the Apache Web Server we need to issue the following command from the command line:

yum install httpd



[root@lamp01 ~]# yum install httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.vooservers.com
 * extras: mirror.econdc.com
 * updates: mirror.ox.ac.uk
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.2.15-30.el6.centos will be installed
--> Processing Dependency: httpd-tools = 2.2.15-30.el6.centos for package: httpd-2.2.15-30.el6.centos.x86_64
--> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-30.el6.centos.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.2.15-30.el6.centos.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.2.15-30.el6.centos.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.2.15-30.el6.centos.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.3.9-5.el6_2 will be installed
---> Package apr-util.x86_64 0:1.3.9-3.el6_0.1 will be installed
---> Package apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be installed
---> Package httpd-tools.x86_64 0:2.2.15-30.el6.centos will be installed
---> Package mailcap.noarch 0:2.1.31-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch        Version                      Repository    Size
================================================================================
Installing:
 httpd              x86_64      2.2.15-30.el6.centos         updates      821 k
Installing for dependencies:
 apr                x86_64      1.3.9-5.el6_2                base         123 k
 apr-util           x86_64      1.3.9-3.el6_0.1              base          87 k
 apr-util-ldap      x86_64      1.3.9-3.el6_0.1              base          15 k
 httpd-tools        x86_64      2.2.15-30.el6.centos         updates       73 k
 mailcap            noarch      2.1.31-2.el6                 base          27 k

Transaction Summary
================================================================================
Install       6 Package(s)

Total download size: 1.1 M
Installed size: 3.6 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): apr-1.3.9-5.el6_2.x86_64.rpm                      | 123 kB     00:00     
(2/6): apr-util-1.3.9-3.el6_0.1.x86_64.rpm               |  87 kB     00:00     
(3/6): apr-util-ldap-1.3.9-3.el6_0.1.x86_64.rpm          |  15 kB     00:00     
(4/6): httpd-2.2.15-30.el6.centos.x86_64.rpm             | 821 kB     00:00     
(5/6): httpd-tools-2.2.15-30.el6.centos.x86_64.rpm       |  73 kB     00:00     
(6/6): mailcap-2.1.31-2.el6.noarch.rpm                   |  27 kB     00:00     
--------------------------------------------------------------------------------
Total                                           1.3 MB/s | 1.1 MB     00:00     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
 Package: centos-release-6-5.el6.centos.11.1.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : apr-1.3.9-5.el6_2.x86_64                                     1/6 
  Installing : apr-util-1.3.9-3.el6_0.1.x86_64                              2/6 
  Installing : apr-util-ldap-1.3.9-3.el6_0.1.x86_64                         3/6 
  Installing : httpd-tools-2.2.15-30.el6.centos.x86_64                      4/6 
  Installing : mailcap-2.1.31-2.el6.noarch                                  5/6 
  Installing : httpd-2.2.15-30.el6.centos.x86_64                            6/6 
  Verifying  : httpd-2.2.15-30.el6.centos.x86_64                            1/6 
  Verifying  : apr-util-ldap-1.3.9-3.el6_0.1.x86_64                         2/6 
  Verifying  : apr-1.3.9-5.el6_2.x86_64                                     3/6 
  Verifying  : mailcap-2.1.31-2.el6.noarch                                  4/6 
  Verifying  : httpd-tools-2.2.15-30.el6.centos.x86_64                      5/6 
  Verifying  : apr-util-1.3.9-3.el6_0.1.x86_64                              6/6 

Installed:
  httpd.x86_64 0:2.2.15-30.el6.centos                                           

Dependency Installed:
  apr.x86_64 0:1.3.9-5.el6_2                                                    
  apr-util.x86_64 0:1.3.9-3.el6_0.1                                             
  apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1                                        
  httpd-tools.x86_64 0:2.2.15-30.el6.centos                                     
  mailcap.noarch 0:2.1.31-2.el6                                                 

Complete!

Starting - Stopping the Apache Web Server


To Start the Apache Web Server you can issue the command:

service httpd start



[root@lamp01 ~]# service httpd start
Starting httpd:                                            [  OK  ]

To Stop the Apace Web Server you can issue the command:

service httpd stop


Configure Apache Web Server to start automatically at system boot


To configure Apache to start at system boot, we need to specify which runlevels we require it to be started at.

In the example below we can see that the command "chkconfig --list httpd" indicates that Apache will not start. To rectify this we can use the following command:

chkconfig --level 2345 httpd on

This command will now set Apache to start automatically at runlevel 2,3,4 and 5.



[root@lamp01 ~]# chkconfig --list httpd
httpd          	0:off	1:off	2:off	3:off	4:off	5:off	6:off

[root@lamp01 ~]# chkconfig --level 2345 httpd on

[root@lamp01 ~]# chkconfig --list httpd
httpd          	0:off	1:off	2:on	3:on	4:on	5:on	6:off

Apache Web Server Configuration File


The Apache Web Server configuration file can be found at the following location:

/etc/httpd/conf/httpd.conf


Installing MySQL


The command that is used for installing the MySQL components is as follows:

yum install mysql mysql-server



[root@lamp01 ~]# yum install mysql mysql-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.vooservers.com
 * extras: mirror.econdc.com
 * updates: mirror.ox.ac.uk
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql.x86_64 0:5.1.73-3.el6_5 will be installed
--> Processing Dependency: mysql-libs = 5.1.73-3.el6_5 for package: mysql-5.1.73-3.el6_5.x86_64
--> Processing Dependency: perl(Sys::Hostname) for package: mysql-5.1.73-3.el6_5.x86_64
--> Processing Dependency: perl(IPC::Open3) for package: mysql-5.1.73-3.el6_5.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: mysql-5.1.73-3.el6_5.x86_64
--> Processing Dependency: perl(File::Temp) for package: mysql-5.1.73-3.el6_5.x86_64
--> Processing Dependency: perl(Fcntl) for package: mysql-5.1.73-3.el6_5.x86_64
--> Processing Dependency: perl(Exporter) for package: mysql-5.1.73-3.el6_5.x86_64
--> Processing Dependency: /usr/bin/perl for package: mysql-5.1.73-3.el6_5.x86_64
---> Package mysql-server.x86_64 0:5.1.73-3.el6_5 will be installed
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.73-3.el6_5.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-3.el6_5.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.73-3.el6_5.x86_64
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be updated
---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be an update
---> Package perl.x86_64 4:5.10.1-136.el6 will be installed
--> Processing Dependency: perl-libs = 4:5.10.1-136.el6 for package: 4:perl-5.10.1-136.el6.x86_64
--> Processing Dependency: perl-libs for package: 4:perl-5.10.1-136.el6.x86_64
--> Processing Dependency: perl(version) for package: 4:perl-5.10.1-136.el6.x86_64
--> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.1-136.el6.x86_64
--> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.1-136.el6.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.10.1-136.el6.x86_64
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Running transaction check
---> Package perl-Module-Pluggable.x86_64 1:3.90-136.el6 will be installed
---> Package perl-Pod-Simple.x86_64 1:3.13-136.el6 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.13-136.el6.x86_64
---> Package perl-libs.x86_64 4:5.10.1-136.el6 will be installed
---> Package perl-version.x86_64 3:0.77-136.el6 will be installed
--> Running transaction check
---> Package perl-Pod-Escapes.x86_64 1:1.04-136.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                   Arch       Version                 Repository   Size
================================================================================
Installing:
 mysql                     x86_64     5.1.73-3.el6_5          updates     894 k
 mysql-server              x86_64     5.1.73-3.el6_5          updates     8.6 M
Installing for dependencies:
 perl                      x86_64     4:5.10.1-136.el6        base         10 M
 perl-DBD-MySQL            x86_64     4.013-3.el6             base        134 k
 perl-DBI                  x86_64     1.609-4.el6             base        705 k
 perl-Module-Pluggable     x86_64     1:3.90-136.el6          base         40 k
 perl-Pod-Escapes          x86_64     1:1.04-136.el6          base         32 k
 perl-Pod-Simple           x86_64     1:3.13-136.el6          base        212 k
 perl-libs                 x86_64     4:5.10.1-136.el6        base        578 k
 perl-version              x86_64     3:0.77-136.el6          base         51 k
Updating for dependencies:
 mysql-libs                x86_64     5.1.73-3.el6_5          updates     1.2 M

Transaction Summary
================================================================================
Install      10 Package(s)
Upgrade       1 Package(s)

Total download size: 23 M
Is this ok [y/N]: y
Downloading Packages:
(1/11): mysql-5.1.73-3.el6_5.x86_64.rpm                  | 894 kB     00:00     
(2/11): mysql-libs-5.1.73-3.el6_5.x86_64.rpm             | 1.2 MB     00:00     
(3/11): mysql-server-5.1.73-3.el6_5.x86_64.rpm           | 8.6 MB     00:01     
(4/11): perl-5.10.1-136.el6.x86_64.rpm                   |  10 MB     00:01     
(5/11): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm            | 134 kB     00:00     
(6/11): perl-DBI-1.609-4.el6.x86_64.rpm                  | 705 kB     00:00     
(7/11): perl-Module-Pluggable-3.90-136.el6.x86_64.rpm    |  40 kB     00:00     
(8/11): perl-Pod-Escapes-1.04-136.el6.x86_64.rpm         |  32 kB     00:00     
(9/11): perl-Pod-Simple-3.13-136.el6.x86_64.rpm          | 212 kB     00:00     
(10/11): perl-libs-5.10.1-136.el6.x86_64.rpm             | 578 kB     00:00     
(11/11): perl-version-0.77-136.el6.x86_64.rpm            |  51 kB     00:00     
--------------------------------------------------------------------------------
Total                                           4.2 MB/s |  23 MB     00:05     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : mysql-libs-5.1.73-3.el6_5.x86_64                            1/12 
  Installing : 1:perl-Pod-Escapes-1.04-136.el6.x86_64                      2/12 
  Installing : 1:perl-Pod-Simple-3.13-136.el6.x86_64                       3/12 
  Installing : 4:perl-libs-5.10.1-136.el6.x86_64                           4/12 
  Installing : 3:perl-version-0.77-136.el6.x86_64                          5/12 
  Installing : 1:perl-Module-Pluggable-3.90-136.el6.x86_64                 6/12 
  Installing : 4:perl-5.10.1-136.el6.x86_64                                7/12 
  Installing : perl-DBI-1.609-4.el6.x86_64                                 8/12 
  Installing : perl-DBD-MySQL-4.013-3.el6.x86_64                           9/12 
  Installing : mysql-5.1.73-3.el6_5.x86_64                                10/12 
  Installing : mysql-server-5.1.73-3.el6_5.x86_64                         11/12 
  Cleanup    : mysql-libs-5.1.71-1.el6.x86_64                             12/12 
  Verifying  : 1:perl-Module-Pluggable-3.90-136.el6.x86_64                 1/12 
  Verifying  : 1:perl-Pod-Escapes-1.04-136.el6.x86_64                      2/12 
  Verifying  : perl-DBD-MySQL-4.013-3.el6.x86_64                           3/12 
  Verifying  : mysql-libs-5.1.73-3.el6_5.x86_64                            4/12 
  Verifying  : mysql-server-5.1.73-3.el6_5.x86_64                          5/12 
  Verifying  : mysql-5.1.73-3.el6_5.x86_64                                 6/12 
  Verifying  : 4:perl-5.10.1-136.el6.x86_64                                7/12 
  Verifying  : perl-DBI-1.609-4.el6.x86_64                                 8/12 
  Verifying  : 1:perl-Pod-Simple-3.13-136.el6.x86_64                       9/12 
  Verifying  : 4:perl-libs-5.10.1-136.el6.x86_64                          10/12 
  Verifying  : 3:perl-version-0.77-136.el6.x86_64                         11/12 
  Verifying  : mysql-libs-5.1.71-1.el6.x86_64                             12/12 

Installed:
  mysql.x86_64 0:5.1.73-3.el6_5       mysql-server.x86_64 0:5.1.73-3.el6_5      

Dependency Installed:
  perl.x86_64 4:5.10.1-136.el6                                                  
  perl-DBD-MySQL.x86_64 0:4.013-3.el6                                           
  perl-DBI.x86_64 0:1.609-4.el6                                                 
  perl-Module-Pluggable.x86_64 1:3.90-136.el6                                   
  perl-Pod-Escapes.x86_64 1:1.04-136.el6                                        
  perl-Pod-Simple.x86_64 1:3.13-136.el6                                         
  perl-libs.x86_64 4:5.10.1-136.el6                                             
  perl-version.x86_64 3:0.77-136.el6                                            

Dependency Updated:
  mysql-libs.x86_64 0:5.1.73-3.el6_5                                            

Complete!

As we can see from the above output, the MySQL components and any dependencies have been installed.


Starting MySQL


To start the MySQL daemon "mysqld" we can issue the following command:

service mysqld start

To check the current status of "mysqld" we can use the status option:

service mysqld status


Set mysqld to start at system boot


To configure "mysqld" to start at system boot time we can use the "chkconfig command as follows:

chkconfig --level 2345 mysqld on

The above command specifies that the "mysqld" will start automatically on runlevels 2,3,4 and 5.


Securing MySQL server - setting passwords


By default our MySQL installation has no passwords set. To rectify this, we can run a special script called:

mysql_secure_installation

The above script is located in the following path : /usr/bin/mysql_secure_installation By running this script, the following will be accomplished:

  1. set a MySQL root password
  2. remove anonymous users
  3. disallow MySQL root login remotely
  4. remove test databases
  5. reload privileges table

Check that the mysqld is running - If mysqld is not running, issue the "service mysqld start" command. Below is the output from the "mysql_secure_installation" script:



[root@lamp01 ~]# /usr/bin/mysql_secure_installation


NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Now lets test that we can login with the credentials we have just created:

From the command line issue the following commands:

mysql -u root -p
Enter Password: <your new password>

If all has gone ok, you should have been taken to a "mysql" command prompt. To quit from the "mysql" command prompt issue the command "quit".

For more information regarding the setting up of a test mysql database, you can visit our "introduction to mysql page":

MySQL Introduction


Installing PHP Scripting Language


One of the most popular scripting languages used to create dynamic web pages is "PHP". To install the PHP language issue the command below:

yum install php php-mysql php-common php-mbstring php-mcrypt php-devel php-gd php-xm

Below is the output from the above command:



[root@lamp01 ~]# yum install php php-mysql php-common php-mbstring php-mcrypt php-devel php-gd php-xm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.vooservers.com
 * extras: mirror.econdc.com
 * updates: mirror.ox.ac.uk
Setting up Install Process
No package php-mcrypt available.
No package php-xm available.
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.3.3-27.el6_5 will be installed
--> Processing Dependency: php-cli(x86-64) = 5.3.3-27.el6_5 for package: php-5.3.3-27.el6_5.x86_64
---> Package php-common.x86_64 0:5.3.3-27.el6_5 will be installed
---> Package php-devel.x86_64 0:5.3.3-27.el6_5 will be installed
--> Processing Dependency: automake for package: php-devel-5.3.3-27.el6_5.x86_64
--> Processing Dependency: autoconf for package: php-devel-5.3.3-27.el6_5.x86_64
---> Package php-gd.x86_64 0:5.3.3-27.el6_5 will be installed
--> Processing Dependency: libpng12.so.0(PNG12_0)(64bit) for package: php-gd-5.3.3-27.el6_5.x86_64
--> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: php-gd-5.3.3-27.el6_5.x86_64
--> Processing Dependency: libpng12.so.0()(64bit) for package: php-gd-5.3.3-27.el6_5.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: php-gd-5.3.3-27.el6_5.x86_64
--> Processing Dependency: libfreetype.so.6()(64bit) for package: php-gd-5.3.3-27.el6_5.x86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.3.3-27.el6_5.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: php-gd-5.3.3-27.el6_5.x86_64
---> Package php-mbstring.x86_64 0:5.3.3-27.el6_5 will be installed
---> Package php-mysql.x86_64 0:5.3.3-27.el6_5 will be installed
--> Processing Dependency: php-pdo(x86-64) for package: php-mysql-5.3.3-27.el6_5.x86_64
--> Running transaction check
---> Package autoconf.noarch 0:2.63-5.1.el6 will be installed
---> Package automake.noarch 0:1.11.1-4.el6 will be installed
---> Package freetype.x86_64 0:2.3.11-14.el6_3.1 will be installed
---> Package libX11.x86_64 0:1.5.0-4.el6 will be installed
--> Processing Dependency: libX11-common = 1.5.0-4.el6 for package: libX11-1.5.0-4.el6.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.5.0-4.el6.x86_64
---> Package libXpm.x86_64 0:3.5.10-2.el6 will be installed
---> Package libjpeg-turbo.x86_64 0:1.2.1-3.el6_5 will be installed
---> Package libpng.x86_64 2:1.2.49-1.el6_2 will be installed
---> Package php-cli.x86_64 0:5.3.3-27.el6_5 will be installed
---> Package php-pdo.x86_64 0:5.3.3-27.el6_5 will be installed
--> Running transaction check
---> Package libX11-common.noarch 0:1.5.0-4.el6 will be installed
---> Package libxcb.x86_64 0:1.8.1-1.el6 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.8.1-1.el6.x86_64
--> Running transaction check
---> Package libXau.x86_64 0:1.0.6-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch         Version                   Repository     Size
================================================================================
Installing:
 php                 x86_64       5.3.3-27.el6_5            updates       1.1 M
 php-common          x86_64       5.3.3-27.el6_5            updates       525 k
 php-devel           x86_64       5.3.3-27.el6_5            updates       508 k
 php-gd              x86_64       5.3.3-27.el6_5            updates       107 k
 php-mbstring        x86_64       5.3.3-27.el6_5            updates       455 k
 php-mysql           x86_64       5.3.3-27.el6_5            updates        81 k
Installing for dependencies:
 autoconf            noarch       2.63-5.1.el6              base          781 k
 automake            noarch       1.11.1-4.el6              base          550 k
 freetype            x86_64       2.3.11-14.el6_3.1         base          359 k
 libX11              x86_64       1.5.0-4.el6               base          584 k
 libX11-common       noarch       1.5.0-4.el6               base          192 k
 libXau              x86_64       1.0.6-4.el6               base           24 k
 libXpm              x86_64       3.5.10-2.el6              base           51 k
 libjpeg-turbo       x86_64       1.2.1-3.el6_5             updates       174 k
 libpng              x86_64       2:1.2.49-1.el6_2          base          182 k
 libxcb              x86_64       1.8.1-1.el6               base          110 k
 php-cli             x86_64       5.3.3-27.el6_5            updates       2.2 M
 php-pdo             x86_64       5.3.3-27.el6_5            updates        75 k

Transaction Summary
================================================================================
Install      18 Package(s)

Total download size: 8.0 M
Installed size: 28 M
Is this ok [y/N]: y
Downloading Packages:
(1/18): autoconf-2.63-5.1.el6.noarch.rpm                 | 781 kB     00:00     
(2/18): automake-1.11.1-4.el6.noarch.rpm                 | 550 kB     00:00     
(3/18): freetype-2.3.11-14.el6_3.1.x86_64.rpm            | 359 kB     00:00     
(4/18): libX11-1.5.0-4.el6.x86_64.rpm                    | 584 kB     00:00     
(5/18): libX11-common-1.5.0-4.el6.noarch.rpm             | 192 kB     00:00     
(6/18): libXau-1.0.6-4.el6.x86_64.rpm                    |  24 kB     00:00     
(7/18): libXpm-3.5.10-2.el6.x86_64.rpm                   |  51 kB     00:00     
(8/18): libjpeg-turbo-1.2.1-3.el6_5.x86_64.rpm           | 174 kB     00:00     
(9/18): libpng-1.2.49-1.el6_2.x86_64.rpm                 | 182 kB     00:00     
(10/18): libxcb-1.8.1-1.el6.x86_64.rpm                   | 110 kB     00:00     
(11/18): php-5.3.3-27.el6_5.x86_64.rpm                   | 1.1 MB     00:00     
(12/18): php-cli-5.3.3-27.el6_5.x86_64.rpm               | 2.2 MB     00:00     
(13/18): php-common-5.3.3-27.el6_5.x86_64.rpm            | 525 kB     00:00     
(14/18): php-devel-5.3.3-27.el6_5.x86_64.rpm             | 508 kB     00:00     
(15/18): php-gd-5.3.3-27.el6_5.x86_64.rpm                | 107 kB     00:00     
(16/18): php-mbstring-5.3.3-27.el6_5.x86_64.rpm          | 455 kB     00:00     
(17/18): php-mysql-5.3.3-27.el6_5.x86_64.rpm             |  81 kB     00:00     
(18/18): php-pdo-5.3.3-27.el6_5.x86_64.rpm               |  75 kB     00:00     
--------------------------------------------------------------------------------
Total                                           1.9 MB/s | 8.0 MB     00:04     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : php-common-5.3.3-27.el6_5.x86_64                            1/18 
  Installing : autoconf-2.63-5.1.el6.noarch                                2/18 
  Installing : automake-1.11.1-4.el6.noarch                                3/18 
  Installing : php-pdo-5.3.3-27.el6_5.x86_64                               4/18 
  Installing : php-cli-5.3.3-27.el6_5.x86_64                               5/18 
  Installing : php-5.3.3-27.el6_5.x86_64                                   6/18 
  Installing : libjpeg-turbo-1.2.1-3.el6_5.x86_64                          7/18 
  Installing : 2:libpng-1.2.49-1.el6_2.x86_64                              8/18 
  Installing : libXau-1.0.6-4.el6.x86_64                                   9/18 
  Installing : libxcb-1.8.1-1.el6.x86_64                                  10/18 
  Installing : freetype-2.3.11-14.el6_3.1.x86_64                          11/18 
  Installing : libX11-common-1.5.0-4.el6.noarch                           12/18 
  Installing : libX11-1.5.0-4.el6.x86_64                                  13/18 
  Installing : libXpm-3.5.10-2.el6.x86_64                                 14/18 
  Installing : php-gd-5.3.3-27.el6_5.x86_64                               15/18 
  Installing : php-devel-5.3.3-27.el6_5.x86_64                            16/18 
  Installing : php-mysql-5.3.3-27.el6_5.x86_64                            17/18 
  Installing : php-mbstring-5.3.3-27.el6_5.x86_64                         18/18 
  Verifying  : php-pdo-5.3.3-27.el6_5.x86_64                               1/18 
  Verifying  : libX11-common-1.5.0-4.el6.noarch                            2/18 
  Verifying  : php-cli-5.3.3-27.el6_5.x86_64                               3/18 
  Verifying  : php-devel-5.3.3-27.el6_5.x86_64                             4/18 
  Verifying  : php-5.3.3-27.el6_5.x86_64                                   5/18 
  Verifying  : php-gd-5.3.3-27.el6_5.x86_64                                6/18 
  Verifying  : libXpm-3.5.10-2.el6.x86_64                                  7/18 
  Verifying  : php-common-5.3.3-27.el6_5.x86_64                            8/18 
  Verifying  : freetype-2.3.11-14.el6_3.1.x86_64                           9/18 
  Verifying  : php-mbstring-5.3.3-27.el6_5.x86_64                         10/18 
  Verifying  : libX11-1.5.0-4.el6.x86_64                                  11/18 
  Verifying  : libXau-1.0.6-4.el6.x86_64                                  12/18 
  Verifying  : autoconf-2.63-5.1.el6.noarch                               13/18 
  Verifying  : libxcb-1.8.1-1.el6.x86_64                                  14/18 
  Verifying  : 2:libpng-1.2.49-1.el6_2.x86_64                             15/18 
  Verifying  : php-mysql-5.3.3-27.el6_5.x86_64                            16/18 
  Verifying  : libjpeg-turbo-1.2.1-3.el6_5.x86_64                         17/18 
  Verifying  : automake-1.11.1-4.el6.noarch                               18/18 

Installed:
  php.x86_64 0:5.3.3-27.el6_5             php-common.x86_64 0:5.3.3-27.el6_5   
  php-devel.x86_64 0:5.3.3-27.el6_5       php-gd.x86_64 0:5.3.3-27.el6_5       
  php-mbstring.x86_64 0:5.3.3-27.el6_5    php-mysql.x86_64 0:5.3.3-27.el6_5    

Dependency Installed:
  autoconf.noarch 0:2.63-5.1.el6         automake.noarch 0:1.11.1-4.el6         
  freetype.x86_64 0:2.3.11-14.el6_3.1    libX11.x86_64 0:1.5.0-4.el6            
  libX11-common.noarch 0:1.5.0-4.el6     libXau.x86_64 0:1.0.6-4.el6            
  libXpm.x86_64 0:3.5.10-2.el6           libjpeg-turbo.x86_64 0:1.2.1-3.el6_5   
  libpng.x86_64 2:1.2.49-1.el6_2         libxcb.x86_64 0:1.8.1-1.el6            
  php-cli.x86_64 0:5.3.3-27.el6_5        php-pdo.x86_64 0:5.3.3-27.el6_5        

Complete!

PHP is now installed along with any required dependencies.


Testing PHP with the Apache Web Server


To Test that PHP is working correctly we can create a simple test file that when executed will display information relating to the current version of PHP.

Create a file named /var/www/html/test.php with the following phpinfo() function inside php quotes:



// test.php
  <?php
  phpinfo();
  ?>

Your file should look like the one below:



[root@lamp01 html]# pwd
/var/www/html
[root@lamp01 html]# cat test.php 
// test.php
  <?php
  phpinfo();
  ?>

To test the file that we have just created, we need to type the ip address along with our test file name into a web browser of your choice. In this example the IP address is 192.168.0.18.

So we enter: 192.168.0.18/test.php

(If you don't know your IP address, simply issue "ip a s" from the command line to display your IP) You should now see an image similar to the one below:


Samba Share