LMAP的安装流程
在这里使用的是Ubuntu 18.04 Lts版本 请注意.
首先,你需要一个IP是可以正常访问到该服务器的.
确保当前登录状态为root,服务器为最新状态.命令: apt update && apt upgrade -y
(检查更新并安装更新)
安装Apache2
在服务上完整安装Apache2 服务器.命令: apt install apache2 -y
安装完毕后你可以通过服务器上的ip来查看是否安装成功,当你成功出现以下画面后就代表已经安装成功了.
安装完毕后你的Web文件都存储在默认的目录 /var/www/html
你可以更改其所在的位置并加以个性化.(之后讲怎么操作)
安装MySQL
通过这条命令安装它 命令: apt install mysql-server -y
安装完毕后我们还需要在对它进行一些操作 命令: mysql_secure_installation
这条命令是告诉它 我们需要对其进行初始化操作.
第一个要求我们安装验证密码插件(一般来说没有什么用),我会回复它 "N"来拒绝它 当然,你也可以回答"Y"
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No:
然后它会询问我们MySQL的管理员密码(输入密码的过程中是不会有显示的,放心)
New password:
Re-enter new password:
它现在要求你删除匿名账号,我们总要回答它"Y" 因为我们并不想把我们的数据交给其他人
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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? (Press y|Y for Yes, any other key for No) :
接下来,它会询问是否要远程禁止root登录,因为我有所需要,所以我回答的是"N" 大部分情况下应该回答"Y".
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? (Press y|Y for Yes, any other key for No) :
它要求删除测试数据库并访问它 回答它“Y”
By default, MySQL 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? (Press y|Y for Yes, any other key for No) :
它最后会要求重新加载权限表. 一般情况下回答 "Y" 即可
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) :
安装LMAP最后的组件-----PHP(PHP超文本预处理器)
运行这条命令用来安装它 命令: apt install php -y
我们需要确保PHP是否工作:
在 /var/www/html
中创建一个文件,命名为1.php,并在其中输入以下内容:
<?php
phpinfo();
?>
保存然后退出该文件.
在浏览器中浏览Url:
http://{你服务器的ip}/1.php (输入时请把{}符号去除!)
它应该反馈以下类似内容:
确认它正常工作后删除它,以免信息泄露: rm /var/www/html/info.php
安装PHP模块
当安装基于PHP的应用程序时,它具有PHP模块依赖性.
一个常见的PHP模块是php-curl模块
我们可以通过Ubuntu自带的命令apt来下载它,只需要在模块前面添加"php-",示例: apt install php-curl
至此 安装结束,好好享用它吧! (*^_^*)
Ps:可能出现MySQL 1698 报错,解决方案:ERROR 1698 (28000): Access denied for user ‘root’@’localhost’