CentOS 7/RHEL 7: How To Install LAMP Tools
I would like to setup LAMP server enviroment on my latest centos 7 or RHEL 7 system. HOw Do I install LAMP tools under centos 7 or rhel 7 operating system? How to install apache/php/Mariadb packages? this post will show you how to install lamp tools (Apache/PHP/Mariadb).
You need to use yum install command to install apache/php/mariadb package on you system, then using systemctl to start service.
CentOS 7 Install LAMP Tools
Step1# CentOs 7 install Apache server
To install apache package by running the following command:
yum install http
outputs:
[root@osetc /]# yum install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.btte.net
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-18.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
httpd x86_64 2.4.6-18.el7.centos updates 2.7 M
Transaction Summary
==============================================================================================
Install 1 Package
Total download size: 2.7 M
Installed size: 9.3 M
Is this ok [y/d/N]: y
Downloading packages:
httpd-2.4.6-18.el7.centos.x86_64.rpm | 2.7 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : httpd-2.4.6-18.el7.centos.x86_64 1/1
Verifying : httpd-2.4.6-18.el7.centos.x86_64 1/1
Installed:
httpd.x86_64 0:2.4.6-18.el7.centos
Complete!
Enable Apache Service while system starts up
Type the following command:
systemctl enable httpd.service
outputs:
[root@osetc/]# systemctl enable httpd.service ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.servic
CentOS 7 Start Apache service
Type the below command to start apache service:
systemctl start httpd.service
or
systemctl start httpd
Step2# CentOS 7 install Maria DB
To install MariaDB package, issue the following command:
yum install mariadb-server mariadb
outputs:
[root@osetc/]# yum install mariadb-server mariadb
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.btte.net
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.40-1.el7_0 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.40-1.el7_0 for package: 1:mariadb-5.5.40-1.el7_0.x86_64
---> Package mariadb-server.x86_64 1:5.5.40-1.el7_0 will be installed
--> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.40-1.el7_0.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.40-1.el7_0.x86_64
--> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.40-1.el7_0.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.35-3.el7 will be updated
---> Package mariadb-libs.x86_64 1:5.5.40-1.el7_0 will be an update
---> Package perl-DBD-MySQL.x86_64 0:4.023-5.el7 will be installed
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
--> Running transaction check
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
mariadb x86_64 1:5.5.40-1.el7_0 updates 8.9 M
mariadb-server x86_64 1:5.5.40-1.el7_0 updates 11 M
Installing for dependencies:
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBD-MySQL x86_64 4.023-5.el7 base 140 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k
Updating for dependencies:
mariadb-libs x86_64 1:5.5.40-1.el7_0 updates 753 k
Transaction Summary
==============================================================================================
Install 2 Packages (+7 Dependent packages)
Upgrade ( 1 Dependent package)
Total size: 22 M
Total download size: 21 M
Is this ok [y/d/N]: y
Downloading packages:
(1/9): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm | 32 kB 00:00:00
(2/9): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm | 57 kB 00:00:00
(3/9): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:00
(4/9): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:00
(5/9): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00:00
(6/9): perl-DBI-1.627-4.el7.x86_64.rpm | 802 kB 00:00:00
(7/9): mariadb-5.5.40-1.el7_0.x86_64.rpm | 8.9 MB 00:00:07
(8/9): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm | 140 kB 00:00:07
(9/9): mariadb-server-5.5.40-1.el7_0.x86_64.rpm | 11 MB 00:00:13
----------------------------------------------------------------------------------------------
Total 1.6 MB/s | 21 MB 00:00:13
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 1/11
Installing : 1:mariadb-5.5.40-1.el7_0.x86_64 2/11
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 3/11
Installing : perl-Net-Daemon-0.48-5.el7.noarch 4/11
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 5/11
Installing : perl-IO-Compress-2.061-2.el7.noarch 6/11
Installing : perl-PlRPC-0.2020-14.el7.noarch 7/11
Installing : perl-DBI-1.627-4.el7.x86_64 8/11
Installing : perl-DBD-MySQL-4.023-5.el7.x86_64 9/11
Installing : 1:mariadb-server-5.5.40-1.el7_0.x86_64 10/11
Cleanup : 1:mariadb-libs-5.5.35-3.el7.x86_64 11/11
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 1/11
Verifying : perl-Net-Daemon-0.48-5.el7.noarch 2/11
Verifying : 1:mariadb-5.5.40-1.el7_0.x86_64 3/11
Verifying : 1:mariadb-server-5.5.40-1.el7_0.x86_64 4/11
Verifying : 1:mariadb-libs-5.5.40-1.el7_0.x86_64 5/11
Verifying : perl-PlRPC-0.2020-14.el7.noarch 6/11
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 7/11
Verifying : perl-DBI-1.627-4.el7.x86_64 8/11
Verifying : perl-IO-Compress-2.061-2.el7.noarch 9/11
Verifying : perl-DBD-MySQL-4.023-5.el7.x86_64 10/11
Verifying : 1:mariadb-libs-5.5.35-3.el7.x86_64 11/11
Installed:
mariadb.x86_64 1:5.5.40-1.el7_0 mariadb-server.x86_64 1:5.5.40-1.el7_0
Dependency Installed:
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBD-MySQL.x86_64 0:4.023-5.el7 perl-DBI.x86_64 0:1.627-4.el7
perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7
perl-PlRPC.noarch 0:0.2020-14.el7
Dependency Updated:
mariadb-libs.x86_64 1:5.5.40-1.el7_0
Complete!
Enable mariadb service while system starts up
Issue the following command:
systemctl enable mariadb.service
outputs:
[root@osetc /]# systemctl enable mariadb.service ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
Centos 7 start mariadb service
Issue the following command:
systemctl start mariadb.service
Step3# CentOS 7 install php
Install php and correspond package using the following command:
yum install php php-mysql php-gd php-pear
outputs:
[root@osetc/]# yum install php php-mysql php-gd php-pear
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.btte.net
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.16-23.el7_0.3 will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.16-23.el7_0.3 for package: php-5.4.16-23.el7_0.3.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.4.16-23.el7_0.3 for package: php-5.4.16-23.el7_0.3.x86_64
---> Package php-gd.x86_64 0:5.4.16-23.el7_0.3 will be installed
--> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.4.16-23.el7_0.3.x86_64
---> Package php-mysql.x86_64 0:5.4.16-23.el7_0.3 will be installed
--> Processing Dependency: php-pdo(x86-64) = 5.4.16-23.el7_0.3 for package: php-mysql-5.4.16-23.el7_0.3.x86_64
---> Package php-pear.noarch 1:1.9.4-21.el7 will be installed
--> Processing Dependency: php-xml for package: 1:php-pear-1.9.4-21.el7.noarch
--> Processing Dependency: php-posix for package: 1:php-pear-1.9.4-21.el7.noarch
--> Running transaction check
---> Package php-cli.x86_64 0:5.4.16-23.el7_0.3 will be installed
---> Package php-common.x86_64 0:5.4.16-23.el7_0.3 will be installed
--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-23.el7_0.3.x86_64
---> Package php-pdo.x86_64 0:5.4.16-23.el7_0.3 will be installed
---> Package php-process.x86_64 0:5.4.16-23.el7_0.3 will be installed
---> Package php-xml.x86_64 0:5.4.16-23.el7_0.3 will be installed
---> Package t1lib.x86_64 0:5.1.2-14.el7 will be installed
--> Running transaction check
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
php x86_64 5.4.16-23.el7_0.3 updates 1.3 M
php-gd x86_64 5.4.16-23.el7_0.3 updates 124 k
php-mysql x86_64 5.4.16-23.el7_0.3 updates 97 k
php-pear noarch 1:1.9.4-21.el7 base 357 k
Installing for dependencies:
libzip x86_64 0.10.1-8.el7 base 48 k
php-cli x86_64 5.4.16-23.el7_0.3 updates 2.7 M
php-common x86_64 5.4.16-23.el7_0.3 updates 561 k
php-pdo x86_64 5.4.16-23.el7_0.3 updates 95 k
php-process x86_64 5.4.16-23.el7_0.3 updates 52 k
php-xml x86_64 5.4.16-23.el7_0.3 updates 122 k
t1lib x86_64 5.1.2-14.el7 base 166 k
Transaction Summary
==============================================================================================
Install 4 Packages (+7 Dependent packages)
Total download size: 5.7 M
Installed size: 21 M
Is this ok [y/d/N]: y
ownloading packages:
(1/11): libzip-0.10.1-8.el7.x86_64.rpm | 48 kB 00:00:01
(2/11): php-gd-5.4.16-23.el7_0.3.x86_64.rpm | 124 kB 00:00:01
(3/11): php-5.4.16-23.el7_0.3.x86_64.rpm | 1.3 MB 00:00:01
(4/11): php-mysql-5.4.16-23.el7_0.3.x86_64.rpm | 97 kB 00:00:00
(5/11): php-pdo-5.4.16-23.el7_0.3.x86_64.rpm | 95 kB 00:00:00
(6/11): php-cli-5.4.16-23.el7_0.3.x86_64.rpm | 2.7 MB 00:00:02
(7/11): t1lib-5.1.2-14.el7.x86_64.rpm | 166 kB 00:00:00
(8/11): php-process-5.4.16-23.el7_0.3.x86_64.rpm | 52 kB 00:00:00
(9/11): php-xml-5.4.16-23.el7_0.3.x86_64.rpm | 122 kB 00:00:01
(10/11): php-pear-1.9.4-21.el7.noarch.rpm | 357 kB 00:00:01
(11/11): php-common-5.4.16-23.el7_0.3.x86_64.rpm | 561 kB 00:00:06
----------------------------------------------------------------------------------------------
Total 920 kB/s | 5.7 MB 00:00:06
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libzip-0.10.1-8.el7.x86_64 1/11
Installing : php-common-5.4.16-23.el7_0.3.x86_64 2/11
Installing : php-cli-5.4.16-23.el7_0.3.x86_64 3/11
Installing : php-pdo-5.4.16-23.el7_0.3.x86_64 4/11
Installing : php-process-5.4.16-23.el7_0.3.x86_64 5/11
Installing : php-xml-5.4.16-23.el7_0.3.x86_64 6/11
Installing : t1lib-5.1.2-14.el7.x86_64 7/11
Installing : php-gd-5.4.16-23.el7_0.3.x86_64 8/11
Installing : 1:php-pear-1.9.4-21.el7.noarch 9/11
Installing : php-mysql-5.4.16-23.el7_0.3.x86_64 10/11
Installing : php-5.4.16-23.el7_0.3.x86_64 11/11
Verifying : php-common-5.4.16-23.el7_0.3.x86_64 1/11
Verifying : php-pdo-5.4.16-23.el7_0.3.x86_64 2/11
Verifying : t1lib-5.1.2-14.el7.x86_64 3/11
Verifying : php-process-5.4.16-23.el7_0.3.x86_64 4/11
Verifying : php-5.4.16-23.el7_0.3.x86_64 5/11
Verifying : php-gd-5.4.16-23.el7_0.3.x86_64 6/11
Verifying : php-xml-5.4.16-23.el7_0.3.x86_64 7/11
Verifying : php-mysql-5.4.16-23.el7_0.3.x86_64 8/11
Verifying : php-cli-5.4.16-23.el7_0.3.x86_64 9/11
Verifying : libzip-0.10.1-8.el7.x86_64 10/11
Verifying : 1:php-pear-1.9.4-21.el7.noarch 11/11
Installed:
php.x86_64 0:5.4.16-23.el7_0.3 php-gd.x86_64 0:5.4.16-23.el7_0.3
php-mysql.x86_64 0:5.4.16-23.el7_0.3 php-pear.noarch 1:1.9.4-21.el7
Dependency Installed:
libzip.x86_64 0:0.10.1-8.el7 php-cli.x86_64 0:5.4.16-23.el7_0.3
php-common.x86_64 0:5.4.16-23.el7_0.3 php-pdo.x86_64 0:5.4.16-23.el7_0.3
php-process.x86_64 0:5.4.16-23.el7_0.3 php-xml.x86_64 0:5.4.16-23.el7_0.3
t1lib.x86_64 0:5.1.2-14.el7
Complete!
done…..