如何在Ubuntu和LinuxMint上使用tasksel快速安装LAMP

时间:2019-05-29 14:47:53  来源:igfitidea点击:

Tasksel是一个用于基于Debian的系统的命令行实用程序,用于安装用于特定任务的一组包。
Tasksel提供了许多组包来配置服务器快速,如“LAMP服务器”,“DNS服务器”,“邮件服务器”和“Tomcat Java服务器”等。
本文将安装tasksel,然后使用tasksel在Debian、Ubuntu和LinuxMint操作系统上快速安装LAMP。

安装Tasksel

tasksel包可以在大多数Ubuntu、Debian和LinuxMint操作系统的默认存储库中使用。
使用以下命令安装它。

sudo apt-get install tasksel

使用Tasksel安装LAMP

在系统上安装tasksel包之后,让我们在Ubuntu、Debian和LinuxMint系统上安装LAMP。
在终端上使用sudo访问执行tasksel命令,安装lamp-server

sudo tasksel install lamp-server

安装MySQL服务器时没有为root用户配置任何密码。
我们可以简单地访问MySQL而不需要任何密码。
然后执行下面的命令,通过命令行向导设置新密码并保护MySQL安装。

sudo mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

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:   **y**  

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG:   **1**  
Please set the password for root here.

New password:   **************  
Re-enter new password:   **************  

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) :   **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) :   **y**  
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? (Press y|Y for Yes, any other key for No) :   **y**  
Success.

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**  
 - Dropping test database...
Success.

 - 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? (Press y|Y for Yes, any other key for No) :   **y**  
Success.

All done!

测试LAMP

使用浏览器打开 http://服务器ip应该能看到Apache默认页面。

创建一个php文件 /var/www/html/info.php
内容如下:

<?php
phpinof();
?>

使用浏览器打开 http://服务器ip/info.php.可以看到有关php的信息。