In my previous post I have posted the LAMP configuration in centos 6 and also how to install the wordpress.

Here I took joomla open source for installing and configuring of LAMP for centos 7.

There is no difference between centos 6 and centos 7 the version only changed. And there is slight difference in commands used in SSH.

LAMP-indicates Linux, Apache, mysql and php.

The LAMP Components includes,

  • Operating system – Linux (e.g. CentOS)
  • Web server – Apache
  • Database – MySQL
  • Programming language – PHP (Hypertext Preprocessor)

Steps to Install Apache:

Before going to install the Apache server we have to confirmed that we are having seperate VPS with root access.

1.Make sure your software is up to date before you begin any installation.

 yum update

2.Install Apache using the command.

 yum install httpd

3.Start Apache using below command.

 systemctl start httpd.service

4.Set Apache to start on server boot using below command.

 systemctl enable httpd.service

5.Verify that Apache is installed by going to,

http:// server IP address.

If Apache is installed, the Apache Test Page displays.

 

set up the virtual host.

Create the virtual directories for your domain:

mkdir -p /var/www/html/ourdomain.com/public_html

Change the ownership to the Apache group:

chown -R apache:apache /var/www/html/ourdomain.com/public_html

This lets Apache modify files in your web directories.

Change the directory's permissions so they can be read from the internet:

sudo chmod -R 755 /var/www/

create content for the website

If you have the content for the website prepped, you can upload it to the /public_htmlfolder you created in the last section.

If you don't have content ready to upload, you can create a sample home page (also known as an index file, which is the first page that loads when visitors come to your domain).

Create the index file:

sudo vim /var/www/ourdomain.com/public_html/index.html

Add content to the file:

<html>

<head>

<title>Welcome to my site!</title>

</head>

<body>

<h1>Your virtual host is working!</h1>

</body>

</html>

Apache has a global configuration file where all the default settings are stored and applied to the server. The virtual host directive can be stored in that same default httpd.conf file or another one which will be respective to the configured website/domain.

That global Apache configuration file in CentOS 7 is /etc/httpd/conf/httpd.conf. You may use a text editor of your choice and check the content of that file so you get some insight on how Apache is configured.

The con fig file has commented lines before every setting that explain their use. So for example, the Server Root setting is the top of the directory tree under which lie the Apache configuration files.

The Listen directive binds Apache to a specific IP address and port. Apache’s default listening port is 80.

Another important setting is Document Root which is the directory out of which the data will be served to the visitor. Usually, in most distros the default document root for Apache is set to /var/www/html/ so if you put data in /var/www/html/ you will be able to access that same data via a web browser using your server IP address.

There is a setting (Include Optional) in Apache’s global config whose included directory stores separate config files.

Therefore, let’s create a your_domain.conf file where we will configure a virtual host directive for your domain. Once you are logged into your server enter the following command:

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

Paste the below content into the file:

<VirtualHost *:80>
ServerAdmin [email protected]_domain.com
DocumentRoot "/var/www/html/our_domain/"
ServerName our_domain.com
ServerAlias www.your_domain.com
ErrorLog "/var/log/httpd/our_domain.com-error_log"
CustomLog "/var/log/httpd/our_domain.com-access_log" combined

<Directory "/var/www/html/our_domain/">
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Steps to Install MySQL:

Mysql is a database used to access the web page in other words we can say it will contains all the database which the website contains.

So mysql plays an important role in web page building. The following steps can easily explained the installation of MYSQL.

First you need to Install Maria Db, the community-of MySQL.

 yum install mariadb-server mariadb

Now start the service.

 systemctl start mariadb

Set MySQL to start on server boot.

systemctl enable mariadb.service

Execute the below command to finish setting up the installation,

mysql_secure_installation

Type “Y” to set the root password. Because now you have been asked to set the root password.
Enter and confirm the new password.
Press “Y” to respond system prompts and security configuration.

after installation of MySQL in webserver we want to create the user name and password to access the databases.the following steps will clearly explain the MYSQL access,

CREATE DATABASE exampledb;
CREATE USER 'balajikc'@'localhost' IDENTIFIED BY 'zxcvbnm' ;
GRANT ALL PRIVILEGES ON exampledb.* TO [email protected] IDENTIFIED BY 'zxcvbnm';
FLUSH PRIVILEGES;

Steps to Install PHP:

Run below command to Install PHP:

 yum install php php-mysql

Enter “Y” to install.

Now restart Apache:

 systemctl restart httpd.service

The web application may need some PHP modules, we can install them .

First view all available PHP modules using below command,

 yum search php-

The list displays the available PHP modules. To view the description of a specific package, use the following command.

 yum info "the name of the package you want to use"

Install the required package.

 yum install "the name of the package you want to use"

 

 To test PHP processing on Apache,

Create a new PHP file under the /var/www/html directory.

 vim /var/www/html/info.php

Please type in the following code in the newly created PHP file.

<?php

phpinfo();
?>

Save and close the file using below command.

:wq!

Type this URL in your browser, to check if it is working or not –http://your server’s IP address/info.php
The screen will display a page with the Version of the PHP, extensions, build date, and other information. Now you know how to build a LAMP stack on CentOS.

 

now we can see the php installed and is version .than next step is we want to install any open source content management system like word pres,Joomla and drupal etc..

for installation of any one CMS in the above is the same what we installed in centos6.