我可以在本地保存 LAMP 堆栈的副本吗?

Sou*_*rav 1 lamp apt repository 11.04

有什么方法可以下载 LAMP 并将其保存到 HDD,所以下次如果我安装较新的 Ubuntu,我不必再次下载它?
我今天刚切换到 Ubuntu,无论如何可以像我们在 Windows 中那样保存 EXE 吗?

错误:

Reading package lists... Done
Building dependency tree... 50%
Building dependency tree       
Reading state information... Done
Package gstreamer0.10-plugins-ugly is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'gstreamer0.10-plugins-ugly' has no installation candidate
sou@ubuntu:~$ 
sou@ubuntu:~$ sudo apt-get install apache2 mysql-server php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package apache2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package mysql-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'apache2' has no installation candidate
E: Package 'mysql-server' has no installation candidate
E: Package 'php5' has no installation candidate
Run Code Online (Sandbox Code Playgroud)

Lek*_*eyn 5

您可以安装一个LAMP堆栈的包(在大号inux的部分是Ubuntu的,所需要的其他包一个帕什,中号ySQL和P HP)。因为您使用的是L AMP 堆栈,所以您应该熟悉使用控制台,因为大多数服务器根本没有用于管理的 GUI。因此,要安装软件包 Apache、MySQL 和 PHP,请运行:

sudo apt-get install apache2 mysql-server php5
Run Code Online (Sandbox Code Playgroud)

/var/www默认情况下,webroot 存储在其中,如果您正在执行新安装,请为其创建一个单独的分区/var/www(选择自定义分区以获得它的选项)。MySQL 数据库存储在 中/var/lib/mysql,您可以使用与为 Apache 所做的相同的方式为其创建单独的分区。

配置文件被放入/etc/,所以备份那些:

  • Apache(模块配置,虚拟主机,...): /etc/apache2/
  • MySQL(MySQL 的服务器设置和管理密码): /etc/mysql/
  • PHP(php.ini 文件): /etc/php5/

使用这些文件,您可以在重新安装后设置相同的 LAMP 堆栈。

用于创建名为“lamp-backup.tar.gz”的配置文件、webroot 和数据库的备份的单个命令:

sudo tar cf lamp-backup.tar.gz /etc/{apache2,mysql,php5} /var/www /var/lib/mysql
Run Code Online (Sandbox Code Playgroud)

为获得最佳结果,请在通过运行创建备份之前停止数据库sudo stop mysql。备份后,可以通过运行再次启动数据库sudo start mysql

要恢复先前制作的备份(在全新安装中),请运行:

sudo tar xf lamp-backup.tar.gz -C /
Run Code Online (Sandbox Code Playgroud)

不要忘记安装软件包。