Use of yum install linux mysql php command on Linux box


 

Use of yum install linux mysql php command on Linux box

Learn how to use yum command to quickly install php, MySQL and Apache server on your Linux machine.

Learn how to use yum command to quickly install php, MySQL and Apache server on your Linux machine.

Install PHP, MySQL and Apache server using yum command.

In this section you will see the process of installing PHP, MySQL and apache server with the help of popular yum tool. You can install PHP, MySQL and Apache manually, but its a tedious process and required good knowledge of linux OS. With the help of yum command you can easily install PHP, MySQL and apache on the Linux box with the help of few yum commands.

Here is the steps to install PHP, MySQL and Apache with the help of yum command:

Step 1: Logion to your Linux box as root

Step 2: Install apache server using following command:
yum install httpd

Here is sample output of the command:

[root@localhost ~]# yum install httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirror.optus.net
* base: ftp.swin.edu.au
* extras: ftp.swin.edu.au
* updates: ftp.swin.edu.au
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.i386 0:2.2.3-31.el5.centos.4 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=================================================
Package Arch Version Repository Size
=================================================
Updating:
httpd i386 2.2.3-31.el5.centos.4 updates 1.2 M

Transaction Summary
=================================================
Install 0 Package(s)
Update 1 Package(s)
Remove 0 Package(s)

Total download size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
httpd-2.2.3-31.el5.centos.4.i386.rpm | 1.2 MB 01:12
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : httpd 1/2
Cleanup : httpd 2/2

Updated:
httpd.i386 0:2.2.3-31.el5.centos.4

Complete!

Step 3: Install PHP using following command:
yum install php

Here is the output of the command:

[root@localhost ~]# yum install php
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirror.optus.net
* base: ftp.swin.edu.au
* extras: ftp.swin.edu.au
* updates: ftp.swin.edu.au
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.i386 0:5.1.6-24.el5_4.5 set to be updated
--> Processing Dependency: php-common = 5.1.6-24.el5_4.5 for package: php
--> Processing Dependency: php-cli = 5.1.6-24.el5_4.5 for package: php
--> Running transaction check
---> Package php-cli.i386 0:5.1.6-24.el5_4.5 set to be updated
---> Package php-common.i386 0:5.1.6-24.el5_4.5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================
Package Arch Version Repository Size
=====================================================
Installing:
php i386 5.1.6-24.el5_4.5 updates 1.1 M
Installing for dependencies:
php-cli i386 5.1.6-24.el5_4.5 updates 2.1 M
php-common i386 5.1.6-24.el5_4.5 updates 152 k

Transaction Summary
==================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 3.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): php-common-5.1.6-24.el5_4.5.i386.rpm | 152 kB 00:09
(2/3): php-5.1.6-24.el5_4.5.i386.rpm | 1.1 MB 01:07
(3/3): php-cli-5.1.6-24.el5_4.5.i386.rpm | 2.1 MB 02:04
--------------------------------------------------------------------------------
Total 17 kB/s | 3.4 MB 03:23
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php-common 1/3
Installing : php-cli 2/3
Installing : php 3/3

Installed:
php.i386 0:5.1.6-24.el5_4.5

Dependency Installed:
php-cli.i386 0:5.1.6-24.el5_4.5 php-common.i386 0:5.1.6-24.el5_4.5

Complete!

Step 4: Install mysql server using following command:
yum install mysql-server mysql

Here is the output of the command:

[root@localhost ~]# yum install mysql-server mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirror.optus.net
* base: ftp.swin.edu.au
* extras: ftp.swin.edu.au
* updates: ftp.swin.edu.au
Setting up Install Process
Package mysql-5.0.77-4.el5_4.2.i386 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.i386 0:5.0.77-4.el5_4.2 set to be updated
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server
--> Running transaction check
---> Package perl-DBD-MySQL.i386 0:3.0007-2.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================
Package Arch Version Repository Size
====================================================
Installing:
mysql-server i386 5.0.77-4.el5_4.2 updates 9.8 M
Installing for dependencies:
perl-DBD-MySQL i386 3.0007-2.el5 base 148 k

Transaction Summary
====================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 9.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): perl-DBD-MySQL-3.0007-2.el5.i386.rpm | 148 kB 00:08
(2/2): mysql-server-5.0.77-4.el5_4.2.i386.rpm | 9.8 MB 09:44
------------------------------------------------------------------------------
Total 17 kB/s | 9.9 MB 09:54
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-DBD-MySQL 1/2
Installing : mysql-server 2/2

Installed:
mysql-server.i386 0:5.0.77-4.el5_4.2

Dependency Installed:
perl-DBD-MySQL.i386 0:3.0007-2.el5

Complete!

That's it! Now your server is ready and you can use for testing or deploying your applications.

User the following command to start apache:

service httpd start

Use following command to start MySQL:

service mysqld start

You can create a php file and add following code into it:

<?php phpinfo(); ?>

Save on apache server html directory "/var/www/html" and test the php page from the browser.

 

Ads