安装 LAMP Stack Fedora 23

[ad_1]

是 Web 服务解决方案堆栈的原型模型,以其原始四个开源组件名称的首字母缩写命名: 操作系统, 这 Apache HTTP服务器, 这 MySQL/MariaDB 关系数据库管理系统,以及 PHP编程语言. 这 组件在很大程度上可以互换,并且不限于原始选择。 作为解决方案堆栈, 适用于 构建动态网站和网络应用程序.
在本教程中,让我们看看 如何安装 LAMP 堆栈 Fedora 23台服务器.

安装 LAMP Fedora 23台服务器

我们将首先使用以下命令确保我们的系统是最新的:

# sudo dnf update -y

我们现在准备安装 Apache.

安装 Apache 服务器开启 Fedora 23

Apache 是一个开源的、多平台的 网络服务器. 它提供了全方位的 Web 服务器功能,包括 CGI、SSL 和虚拟域。
安装 Apache 通过运行以下命令:

# dnf install httpd

进而 Enter 当它问“这个可以吗 [y/N]”在安装过程中。
开始 Apache 使用以下命令:

# systemctl start httpd.service

启用 httpd 服务在每次重新启动时自动启动:

# systemctl enable httpd

并调整防火墙,允许httpd服务从远程客户端访问。

# firewall-cmd --permanent --add-service=http
# firewall-cmd --permanent --add-service=https

重启 firewalld 服务:

# firewall-cmd --reload

核实 Apache 通过键入安装 https://ip.add.re.ss 在您的浏览器上。

安装 MariaDB Fedora 23

玛丽亚数据库 是 MySQL 的替代品。 它是一个健壮、可扩展和可靠的 SQL服务器 这带来了丰富的增强功能。

使用以下命令安装它:

# dnf install mariadb mariadb-server -y

使用以下命令在启动时启用 mariadb 服务:

# systemctl enable mariadb

启动 mariadb 服务 使用命令:

# systemctl start mariadb

默认情况下,mysql root 用户密码为空。 因此,为了防止未经授权访问 mysql 数据库,让我们设置一个 root 用户密码:

# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
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 authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] y     ## Enter 'y' and press enter ##
New password:               ## Enter password ##
Re-enter new password:      ## Re-enter password ##
Password updated successfully!
Reloading privilege tables..
 ... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]    ## Press Enter ##
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] ## Press Enter ##
 ... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] ## Press Enter ##
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] ## Press Enter ##
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

安装 PHP

默认情况下 Apache 服务器 只支持 HTML 语言,不支持 PHP,因为我们需要安装 PHP。 要安装 PHP,请按照以下步骤操作。 在终端上键入以下行并按回车键,此命令包含一个支持包 玛丽亚数据库.

# dnf install php php-mysql -y

安装 PHP 后,您需要重新启动 apache 服务,为此在终端上键入以下内容。

# systemctl restart httpd.service

我们可以通过使用以下命令在下面的 HTML 目录中创建一个测试 PHP 文件来验证 PHP 安装:

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

添加以下几行:


现在保存文件。 返回浏览器并输入以下内容:

https://ip.add.re.ss/info.php
检查 PHP 信息

就是这样。 开始使用 灯堆栈上 Fedora 23.

[ad_2]

Related Posts