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
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.
To test these servers and services, follow the step below.
The add these lines in it and save it. Call it phptest.php.
Then open a web browser, and go to the page, ex. http://hostname/phptest.php
If you see the page below, then PHP is up and functioning.