Cum instalezi servere LAMP (Linux Appache MySQL PHP) pe CentOS7 (LINUX)

Configurare noua (How To)

Situatie

1. Apache

1.1 Instalarea serverului Apache:

sudo yum install httpd

1.2 Se porneste serverul Apache:

sudo systemctl start httpd.service

1.3 Se verifica functionalitatea

http://adresa_server 

Daca totul functioneaza corect trebuie sa arate asa:

1.4 Pentru pornirea automata a serverului:

sudo systemctl enable httpd.service

2. MySQL (MariaDB)

2.1 Instalare:

sudo yum install mariadb-server mariadb

2.2 Pornirea serverului:

sudo systemctl start mariadb

2.3 Configurare:

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorization.

New password: password
Re-enter new password: password
Password updated successfully!
Reloading privilege tables..
 … Success!

2.4 Pornire automata la repornire server:

sudo systemctl enable mariadb.service

3. PHP

3.1 Instalare:

Se cauta pachetele necesare

Exemplu:

yum search php-

php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php-cli.x86_64 : Command-line interface for PHP
php-common.x86_64 : Common files for PHP
php-dba.x86_64 : A database abstraction layer module for PHP applications
php-devel.x86_64 : Files needed for building PHP extensions
php-embedded.x86_64 : PHP library for embedding in applications
php-enchant.x86_64 : Enchant spelling extension for PHP applications
php-fpm.x86_64 : PHP FastCGI Process Manager
php-gd.x86_64 : A module for PHP applications for using the gd graphics library
. . .

Pentru a afla informatii despre un pachet:

yum info package_name

Pentru instalarea pachetului necesar sau a pachetelor necesare:

sudo yum install package1 package2 …

Se editeaza scriptul info.php:

sudo vi /var/www/html/info.php

Se completeaza liniile:

<?php phpinfo(); ?>

Se scriu regulile pentru firewall

sudo firewall-cmd –permanent –zone=public –add-service=http
sudo firewall-cmd –permanent –zone=public –add-service=https
sudo firewall-cmd –reload

Se acceseaza: http://adresa_IP_server/info.php

Rezultatul trebuie sa arate ca in figura de mai jos:

Solutie

Tip solutie

Permanent

Voteaza

(29 din 87 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?