Napeljati Apache2, MariaDB in PHP5 podpore v CentOS 7

Yesterday I installed CentOS 7 to test it out. Danes, I am going to show you how to namestite LAMP Stack (Linux, Apache2, MySQL (MariaDB) and PHP) in CentOS 7.This tutorial should be brief and simple, and for those who are new to CentOS, should have no problem reading and applying the steps below in their own environments.

In this step-by-step tutorial, I will show you how to namestite Apache2, then show you how to install MariaDB, an alternative to MySQL and support for PHP5. These servers and packages allow for hosting PHP websites like WordPress, Joomla and other CMSs.

If you haven’t already installed CentOS 7, please check this post I wrote yesterday. It should help you install CentOS 7 via NetInstall. After installing CentOS 7, continue below to install these servers and packages.

 

  • Installing Apache2 Server

 

Apache is a spletni strežnik. Web servers are programs that manage the distribution of web pages. If you open a web browser on your computer and type www.liberiangeek.net, a spletni strežnik will go and fetch and retrieve the default index page for liberiageek.net and return it to the client computer to display. There are many web server available today, but Apache is the most popular of them all.

To install Apache in CentOS, prost dostop zapoved spodaj.

<zbornik>yum -y install httpdcode>

After installing Apache run the commands below to configure it so that it automatically starts up every time you reboot your server. Za to, prost dostop zapoved spodaj

systemctl enable httpd.service

The commands below will manually začetek Apache

systemctl start httpd.service

 

  • Installing MariaDB Database Server

 

MariaDB is a database server. Database servers are programs that facilitate storing and manipulation of data or information. Data are stored in databases.

In a client/server nastavitev, the client requests information and the database server goes and retrieve the stored information for the client.

To install MariaDB in CentOS 7, prost dostop zapoved spodaj

yum -y install mariadb-server mariadb

After installing run the commands below to manually start MariaDB server.

systemctl start mariadb.service

To configure your server to automatically starts MariaDB after reboots, prost dostop zapoved spodaj.

systemctl enable mariadb.service

Končno, run the commands below create a geslo for the database korenski uporabnik, remove the temporary database, and enable to security feature.

mysql_secure_installation

When prompted with the choices, always choose the default answers wish is Yes, ali Y.

 

  • Enabling PHP5 Support in CentOS 7

 

Končno, the last service we’ll want to enable is PHP5 along with other important modules. PHP5 support allows web server to run and manage PHP5 scripts.

If Apache is to run PHP scripts, then you must install tools and packages to enable PHP support. The commands below to make that possible.

yum -y install php php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel

Restart Apache to enable the new PHP scripts function

systemctl restart httpd.service

 

To je to!.

 

Before you can access the web server remotely you must enable http port on the firewall. To enable Apache port on the firewall, prost dostop zapoved spodaj

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

Then reload the firewall z uporabo ukazi, ki so pod.

firewall-cmd --reload

 

To test these servers and services, follow the step below.

Apache is the easiest to test. All you have to do is open a web browser and type the computer IP naslov or host name in it, if Apache default web page is shown, then Apache is up and functioning.

 

Apache default page in centos 7

 

To test PHP support, create a datoteke in the default root imenik of Apache which is at /var/www/html.

The add these lines in it and save it. Call it phptest.php.

<?php
phpinfo();
?>

Then open a web browser, and go to the page, ex. http://hostname/phptest.php

 

Testing php 5 in centos 7

 

 

If you see the page below, then PHP is up and functioning.

 

Uživajte!

 

 

 

Pustite Odgovori