本教程将介绍如何在具有PHP 7(通过PHP-FPM )和MySQL支持的Ubuntu 16.04服务器上安装Apache Webserver。 PHP-FPM(FastCGI Process Manager)是一种替代的PHP FastCGI实现,具有对任何大小的网站(特别是繁忙的站点)有用的一些附加功能。
1初步说明
在本教程中,我将使用IP地址为192.168.1.100的hostname server1.example.com 。 这些设置可能会有所不同,因此您必须在适当的情况下更换它们。
我使用root权限运行本教程中的所有步骤,因此请确保以root用户身份登录:
sudo su
2安装MySQL或MariaDB
Ubuntu提供了MySQL以及MariaDB软件包。 MariaDB是原始MySQL开发人员Monty Widenius提供的MySQL fork。 按照2.1或2.2章安装数据库服务器。
2.1安装MySQL 5.7
首先,我们像这样安装MySQL 5.7:
apt-get -y install mysql-server mysql-client
您将被要求为MySQL root用户提供密码 - 此密码对用户root @ localhost以及root@server1.example.com有效 ,因此我们不必在以后手动指定MySQL根密码:
MySQL“root”用户的新密码: < - yourrootsqlpassword
重复MySQL“root”用户的密码: < - yourrootsqlpassword
运行mysql_secure_installation以保护MySQL数据库并禁用对测试数据库的访问。
mysql_secure_installation
你会被问到这些问题:
Enter current password for root (enter for none):
Set root password? [Y/n]
New password:
Re-enter new password:
Remove anonymous users? [Y/n]
Disallow root login remotely? [Y/n]
Reload privilege tables now? [Y/n]
2.2安装MariaDB
运行以下命令来安装MariaDB-server和client:
apt-get -y install mariadb-server mariadb-client