Installing LAMP (Linux, Apache, MariaDB, PHP/PhpMyAdmin) in RHEL/CentOS 7.0

Step 1: Install Apache Server with Basic Configurations

1. Install Apache 2.4 httpd service binary package provided form official repositories using the following command.

# yum install httpd
Install Apache Web Server

2. After yum manager finish installation, use the following commands to manage Apache daemon, since CentOS 7.0 both migrated their init scripts from SysV to systemd – you can also use SysV and Apache scripts the same time to manage the service.

# systemctl status|start|stop|restart|reload httpd 
# service httpd status|start|stop|restart|reload 
# apachectl configtest| graceful
Start Apache Web Server

3. On the next step start Apache service using systemd init script and open CentOS 7.0 Firewall rules using firewall-cmd, which is the default command to manage iptables through firewalld daemon.

# firewall-cmd --add-service=http

NOTE: Make notice that using this rule will lose its effect after a system reboot or firewalld service restart, because it opens on-fly rules, which are not applied permanently. To apply consistency iptables rules on firewall use –permanent option and restart firewalld service to take effect.

# firewall-cmd --permanent --add-service=http
# systemctl restart firewalld
Enable Firewall in CentOS 7

Other important Firewalld options are presented below:

# firewall-cmd --state
# firewall-cmd --list-all
# firewall-cmd --list-interfaces
# firewall-cmd --get-service
# firewall-cmd --query-service service_name
# firewall-cmd --add-port=8080/tcp

4. To verify Apache functionality open a remote browser and type your server IP Address using HTTP protocol on URL (http://server_IP), and a default page should appear like in the screenshot below.

Apache Default Page

5. For now, Apache DocumentRoot path it’s set to /var/www/html system path, which by default doesn’t provide any index file. If you want to see a directory list of your DocumentRoot path open Apache welcome configuration file and set Indexes statement from to + on <LocationMach> directive, using the below screenshot as an example.

# nano /etc/httpd/conf.d/welcome.conf
Apache Directory Listing

6. Close the file, restart Apache service to reflect changes and reload your browser page to see the final result.

# systemctl restart httpd
Apache Index File

Step 2: Install PHP5 Support for Apache

7. Before installing PHP5 dynamic language support for Apache, get a full list of available PHP modules and extensions using the following command.

# yum search php
Install PHP in CentOS 7

8. Depending on what type of applications you want to use, install the required PHP modules from the above list, but for a basic MariaDB support in PHP and PhpMyAdmin you need to install the following modules.

# yum install php php-mysql php-pdo php-gd php-mbstring
Install PHP Modules
Install PHP mbstring Module

9. To get a full information list on PHP from your browser, create a info.php file on Apache Document Root using the following command from root account, restart httpd service and direct your browser to the http://server_IP/info.php address.

# echo "<?php phpinfo(); ?>" > /var/www/html/info.php
# systemctl restart httpd
Check PHP Info in CentOS 7

10. If you get an error on PHP Date and Timezone, open php.ini configuration file, search and uncomment date.timezone statement, append your physical location and restart Apache daemon.

# nano /etc/php.ini

Locate and change date.timezone line to look like this, using PHP Supported Timezones list.

date.timezone = Continent/City
Set Timezone in PHP

Step 3: Install and Configure MariaDB Database

11. Red Hat Enterprise Linux/CentOS 7.0 switched from MySQL to MariaDB for its default database management system. To install MariaDB database use the following command.

# yum install mariadb-server mariadb
Install MariaDB in CentOS 7

12. After MariaDB package is installed, start database daemon and use mysql_secure_installation script to secure database (set root password, disable remotely logon from root, remove test database and remove anonymous users).

# systemctl start mariadb
# mysql_secure_installation
Start MariaDB Database
Secure MySQL Installation

13. To test database functionality login to MariaDB using its root account and exit using quit statement.

mysql -u root -p
MariaDB > quit
Connect MySQL Database

Step 4: Install PhpMyAdmin

14. By default official RHEL 7.0 or CentOS 7.0 repositories doesn’t provide any binary package for PhpMyAdmin Web Interface. If you are uncomfortable using MySQL command line to manage your database you can install PhpMyAdmin package by enabling CentOS 7.0 rpmforge repositories using the following command.

# yum install

After enabling rpmforge repository, next install PhpMyAdmin.

# yum install phpmyadmin
Enable RPMForge Repository

15. Next configure PhpMyAdmin to allow connections from remote hosts by editing phpmyadmin.conf file, located on Apache conf.d directory, commenting the following lines.

# nano /etc/httpd/conf.d/phpmyadmin.conf

Use a # and comment this lines.

# Order Deny,Allow
# Deny from all
# Allow from
Allow Remote PhpMyAdmin Access

16. To be able to login to PhpMyAdmin Web interface using cookie authentication method add a blowfish string to phpmyadmin file like in the screenshot below using the generate a secret string, restart Apache Web service and direct your browser to the URL address http://server_IP/phpmyadmin/.

# nano /etc/httpd/conf.d/phpmyadmin.conf
# systemctl restart  httpd
Add Blowfish in PhpMyAdmin
PhpMyAdmin Dashboard

Step 5: Enable LAMP System-wide

17. If you need MariaDB and Apache services to be automatically started after reboot issue the following commands to enable them system-wide.

# systemctl enable mariadb
# systemctl enable httpd
Enable Services System Wide

That’s all it takes for a basic LAMP installation on Red Hat Enterprise 7.0 or CentOS 7.0. The next series of articles related to LAMP stack on CentOS/RHEL 7.0 will discuss how to create Virtual Hosts, generate SSL Certificates and Keys and add SSL transaction support for Apache HTTP Server.





CentOS 6.5 Released – Installation Guide with Screenshots

Karanbir Singh has announced the release of CentOS 6.5 on 1st December, 2013 and made available to download for both the 32-bit and 64-bit architectures. This is the fourth release in 6.x branches, CentOS-6.5 is based on the upstream release EL 6.5 comes with bug fixes, new functionalities & updates. It’s highly recommended to go through release notes as well as the upstream technical notes about the changes before an installation or up-gradation.

CentOS 6.5 Features

  1. Support for sub-microsecond clock accuracy over the LAN using the Precision Time Protocol (PTP)
  2. OpenSSL 1.0.1
  3. OpenSSL & NSS Support TLS 1.1 and 1.2
  4. Read only support of VMDK and VHDX files
  5. CPU hot pluggingUpdated virt-v2v-/virt-p2v-conversion tools
  6. Updated drivers for Hyper-V and VMware
  7. LibreOffice Version 4.0.4
  8. Evolution 2.32
  9. Depreciated features are matahari, python-qmf, python-qpid, qupd-cpp, qpid-qmf, qpid-tests, saslwrapper, ruby-qpid etc.

Download CentOS-6.5 DVD ISO’s

Torrent files for the DVD‘s are available at:

  1. CentOS-6.5-x86_64-bin-DVD1to2.torrent
  2. CentOS-6.5-x86_64-bin-DVD1to2.torrent

Torrent files for LiveCD and LiveDVD, Download these from either a mirror close to you or the torrents listed here.

  1. CentOS-6.5-i386-LiveCD.torrent
  2. CentOS-6.5-i386-LiveDVD.torrent
  3. CentOS-6.5-x86_64-LiveCD.torrent
  4. CentOS-6.5-x86_64-LiveDVD.torrent

Upgrade CentOS 6.x to CentOS 6.5

Please follow article below to upgrade from other 6.x branches to latest CentOS 6.5 version.

  1. Upgrade from other 6.x branches to latest CentOS 6.5

CentOS 6.5 Installation Guide

  1. Boot your system with CentOS bootable media or ISO, you’ll get following screen.

    CentOS Boot Menu
  2. Check the media. You can Skip it.

    Media Check
  3. CentOS Installer started.

    CentOS Installation
  4. Language to choose during installation process.

    Language Selection
  5. Select Keyboard type.

    Select Keyboard
  6. Select Storage Devices “Basic Storage Devices” and “Specialized Storage Devices (For advanced users)”.

    Select Storage Devices
  7. Storage device warning, Click “Yes, discard any data“.

    Storage Device Warning
  8. Give Hostname. Click on “Configure Network” button below if you want to configure network settings during installation. Same can be configure manually later on also.

    Set Hostname
  9. Select location.

    Select Location
  10. Set root password.

    Define root password
  11. Select “Use All Space“, Click on Review and Modify partitioning layout if you want to verify or edit file system manually.

    Select Installation Type
  12. Selecting “Create Custom layout” screen where we can create RAID partitions and LVM as well.

    Create Storage
  13. Partitions review.

    Partition Table
  14. Format Warnings. Click “Format” which will erase existing data.

    Device Formatting
  15. Writing storage configuration to disk.

    Write Changes to Device
  16. Formatting drive.

    Formatting Devices
  17. Bootloader installation confirmation. Check “Use a boot loader password” box if you would like to give bootloader password.

    Bootloader Installation
  18. Choose application to install. Select “Customize now” further selection of software’s.

    Select Installation Software
  19. Select applications of your choice.

    Select Installation Applications
  20. The installation has begin.

    Installation Started
  21. Installation is still in progress.

    Installation in Progress
  22. Installation is complete. Eject media and click on “reboot“.

    Installation Completed
  23. Login Screen.

    CentOS Login Screen