LAMP SERVER installation through Repository Packages

The website you see or the blog you are reading right now is working on a web server and to write that website some coding language has been used, using a database to store the information. Thus, when these components work together to serve a web page or website to the user or visitor, they create a LAMP Server. These components together are called LAMP Stack.

 

By LAMP Stack here means is;

(L)inux as Operating System (OS)

(A)pache as Web Server (WS)

(M)ySQL as a Database (DB)

(P)HP (Hypertext preprocessor) as a programming language,

 

But for these OS, WS, DB, and programming languages, other options can also be considered. For in place of LINUX, one can use windows, then, it will be called WAMP, or In place of PHP, perl or python can be used or APACHE can be replaced by nginx or mariadb can be used in place of MySQL. All 4 components are used or opted for according to the requirements.


Why LAMP server, when other forms of the server are present there?

LAMP is open source, easily customizable, customer-support is available, and it is a mature stack, thus, mentioned all characteristics make the LAMP server more accepting and easier to use.

The open-source servers are MEAN, XAMPP, LLLMP, LEAP, and LAMP and the non-open-source servers are WAMP, WIMP, and MAMP.

Requirements for making a web server for a web page are a VM based on the required OS.

1.) OS of choice, like for LAMP server LINUX is the required OS.

      2.) Install APACHE: The Apache web server is a popular open-source web server that can be used along with PHP to host dynamic websites. It’s well-documented and has been in wide use for much of the history of the web.

       --To clean old configurations if any:

   sudo yum clean all   

--To update the package      

   sudo yum update                                                  

--To install APACHE server service

   sudo yum install httpd -y                                     

--To enable Apache service

   sudo systemctl enable httpd.service                   

--To start Apache

  sudo systemctl start httpd.service                       

--To know the status of Apache service,  it should be in running status

  sudo systemctl status httpd                                

--To enable port 80 (http) on firewall for Apache

   sudo firewall-cmd --permanent --zone=public --add-service=http                      

 --To enable port 443(https) on firewall for APACHE (remember to install SSL module and call the      same in the configuration file.

   sudo firewall-cmd --permanent --zone=public --add-service=https                    

 --Reload Firewall service

   sudo firewall-cmd --reload 

--To know the version and status of the APACHE server

   sudo rpm -qi httpd    

--To know error logs, if face any                                              

   sudo /var/log/httpd/error_log      

--To enable port 443 we need to have the specific module for https in conf.d                           

     cd /etc/httpd/conf.d           

1.1) How to give a name to your webserver

--Install Bind to give a name to your webserver

   sudo yum install bind  

--Edit conf file with this zone creation in the same file                                           

   cd  /etc/named.conf                                                

   zone "example.com" {                                             

        type master;

        file "/var/named/example.com.zone";

    };

--In the zone file, do these entries

cd /var/named/example.com.zone                     

$TTL 86400

@   IN SOA  ns1.example.com. root.example.com. (

        2017022801 ; serial

        3600       ; refresh

        1800       ; retry

        604800     ; expire

        86400      ; minimum

)

@   IN NS   ns1.example.com.

@   IN A    10.197.52,185

 --Create zone name files in APACHE server config folder

cd /etc/httpd/conf.d/example.com.conf             

<VirtualHost *:80>

    ServerName example.com

    ServerAlias www.example.com

    DocumentRoot /var/www/html

</VirtualHost>

--Restart the Apache service and check the same IP with the name this time instead of the IP

   sudo systemctl restart httpd                                  

 

 3). MariaDB installation: maria DB function is to manage the database and this database can be vertical or horizontal scalable.

  --To install mariadb

      install mariadb-server mariadb -y     

  --To start mariadb                           

     systemctl start mariadb                                               

  --To enable mariadb

     systemctl enable mariadb                                            

  --To know status of mariadb

    systemctl status mariadb                                                                                 

  4). PHP Installation: To run or create any web page or to run multiple pages or options over that web page, a language will be required and for that PHP, Perl, or python language package needs to be installed.

    --To update all the packages

        sudo yum update 

    --To install php database                                                                 

       sudo yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml      

   --To restart service

      sudo systemctl restart httpd                                                  

   --To verify that PHP is installed and working, create a file as 'info.php' in the root directory as   

     /var/www/html/ with the following content

      <?php

      phpinfo();

       ?>

      After creating check at the following URL "http://server-address/info.php". 

      If your PHP is working fine, you will see a page with the PHP information.

      Bravo! your LAMP server is ready.

 

Comments

Popular posts from this blog

NetMission.Asia Ambassador: A journey of Exploring Internet Governance through an Asia Pacific Perspective"

ICANN78: A fellow journey!!

Networking!!