Centos8 安装LAMP
LAMP服务器是Linux Web托管的基础。如果您想建立一个LAMP堆栈来托管您的网站,本指南将为您提供有关如何在RHEL 8 / CentOS 8 Linux服务器上开始使用LAMP的必要信息。
在本教程中,您将学习:
- 如何在RHEL 8 / CentOS 8上安装所有LAMP必备软件包。
- 如何保护MariaDB数据库。
- 如何启动httpd和MariaDB服务。
- 如何打开HTTP和HTTPS防火墙端口。
- 首先安装依赖
以下命令将安装执行LAMP安装所需的依赖:1
dnf install php-mysqlnd php-fpm mariadb-server httpd
- 在防火墙上打开HTTP及HTTPS端口80,443 :
1
2
3firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload - 启动Apache Web服务器和MariaDB服务: 允许服务自启动
1
2systemctl start mariadb
systemctl start httpd1
2systemctl enable mariadb
systemctl enable httpd - 保护您的MariaDB安装并设置root密码:
1
mysql_secure_installation
- 确认LAMP服务器安装。在/var/www/html/目录中创建一个info.php,包含以下内容:
1
<?php phpinfo(); ?>
- 更改权限:
1
2chown -R apache:apache /var/www/html/*
chcon -t httpd_sys_rw_content_t /var/www/html/ -R - 浏览器打开http://localhost/info.phpURL,然后配置LAMP安装
- 安装其他PHP模块。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36dnf search php-
php-gd.x86_64 : A module for PHP applications for using the gd graphics library
php-fpm.x86_64 : PHP FastCGI Process Manager
php-pdo.x86_64 : A database access abstraction module for PHP applications
php-gmp.x86_64 : A module for PHP applications for using the GNU MP library
php-dbg.x86_64 : The interactive PHP debugger
php-pdo.x86_64 : A database access abstraction module for PHP applications
php-xml.x86_64 : A module for PHP applications which use XML
php-fpm.x86_64 : PHP FastCGI Process Manager
php-cli.x86_64 : Command-line interface for PHP
php-dba.x86_64 : A database abstraction layer module for PHP applications
php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
php-ldap.x86_64 : A module for PHP applications that use LDAP
php-pear.noarch : PHP Extension and Application Repository framework
php-intl.x86_64 : Internationalization extension for PHP applications
php-json.x86_64 : JavaScript Object Notation extension for PHP
php-odbc.x86_64 : A module for PHP applications that use ODBC databases
php-devel.x86_64 : Files needed for building PHP extensions
php-pgsql.x86_64 : A PostgreSQL database module for PHP
php-common.x86_64 : Common files for PHP
php-common.x86_64 : Common files for PHP
php-recode.x86_64 : A module for PHP applications for using the recode library
php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php-enchant.x86_64 : Enchant spelling extension for PHP applications
php-process.x86_64 : Modules for PHP script using system process interfaces
php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php-opcache.x86_64 : The Zend OPcache
php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
php-pecl-zip.x86_64 : A ZIP archive management extension
php-embedded.x86_64 : PHP library for embedding in applications
php-pecl-apcu.x86_64 : APC User Cache
php-pecl-apcu-devel.x86_64 : APCu developer files (header) - 安装软件包后,请重新加载httpd服务:
1
systemctl reload httpd
- 安装完成
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 3mile的博客!
评论