Linux,这个词几乎立刻让许多非极客的眼睛呆住了。然而,桌面Linux产品现在几乎可以与(Linux)Windows和MacOS等大牌相提并论。
由于数十年来的社区工作和来自Canonical等组织的支持,您现在可以下载Ubuntu Linux之类的东西,并使用(Ubuntu Linux)Windows做几乎所有可以做的事情。所有这些都不需要计算机科学学位。现代(Modern)桌面Linux发行版看起来不错,运行良好并且适合普通用户。
然而,与商业操作系统相比,它们有一个巨大的不同——开源(– Open Source)许可。
这意味着我们可以完全访问Linux的所有内部工作。您无需付费即可使用它,并且可以以您喜欢的任何方式对其进行自定义。这对于喜欢修补螺母和螺栓的高级用户来说非常棒,但是如果您只想保留自己调整过的自定义Linux安装怎么办?
实际上,您可以创建一个全新的Linux安装,按照您想要的方式进行设置,然后将其转换为实时的、可引导的安装。由于几个原因,这非常有用。首先(First),这意味着如果您必须重新安装操作系统,您将不会有任何停机时间。
您的所有设置和软件从一开始就已经在等待。它还使得创建用于分发的自定义安装变得非常容易。假设您必须在装满 PC 的整个计算机实验室上安装Linux,然后安装教育软件包。使用自定义分发工具意味着您只需进行一次自定义,然后像往常一样简单地安装。
最简单的工具之一是
Linux Live Kit,我们将研究如何将现有的Linux安装更改回自定义发行版。
设置机器
为了使用Linux Live Kit,您需要安装Linux进行自定义。虽然您可以继续进行主安装,但如果您想为除主计算机之外的其他东西创建自定义发行版,这不是最实用的方法。
所以我们要做的是将 Ubuntu
Linux安装到VirtualBox虚拟机上。这为我们提供了一个干净、可控的安装环境。这也意味着您可以根据需要从Windows机器上制作定制的Linux发行版。(Linux)最后,这是测试您刚刚创建的发行版以确保其正常工作的好方法。
我们将使用以下组件:
请记住(Remember),如果您在Linux安装上使用(Linux)Linux Live Kit并在计算机上正常运行,而不是在虚拟机中运行,则该过程的工作方式完全相同。
安装 Linux
首先要做的是安装Linux。显然,如果你想使用现有的安装,你可以跳过这一步。
以通常的方式安装Linux只需从DVD或USB安装介质启动。因为我们使用的是
VirtualBox,所以我们只需要创建一个新的虚拟机,然后将其指向我们下载的Ubuntu磁盘映像。以下是您需要遵循的步骤。
照顾依赖关系
由于Linux Live Kit只是一个巧妙的脚本集合,它需要在您的(Linux Live Kit)Linux机器上存在某些其他软件包。在许多情况下,它们已经是您选择的Linux(Linux)版本的默认部分,但您必须以任何方式验证这一点。
您需要确保您选择的Linux发行版使用的内核支持aufs。您可以在此处(here)查看哪些内核版本支持 aufs 。如果您选择的内核不支持 aufs,您需要寻找Linux Live Kit的替代解决方案。
现在我们需要确保系统上安装了Squashfs 。这是 Linux Live Kit 使用的压缩技术。要安装它,请执行以下操作。
首先,打开终端(Terminal)。在Ubuntu中,您可以通过单击屏幕左下方的“显示应用程序”按钮来执行此操作。( “Show Application” )这将弹出一个搜索栏。搜索“终端”( “Terminal” )并在出现时单击它。
现在,在终端中,键入以下内容:
sudo apt-get update && sudo apt-get install squashfs-tools
如果一切顺利,软件包将被安装。如果遇到麻烦,您必须参考您的操作系统文档版本。对存储库和安装问题进行故障排除超出了本教程的范围。
修剪脂肪
由于您的 live 发行版将具有与您安装的所有相同的内容,因此您应该从安装中删除任何不需要的文件。如果您使用闪存驱动器,您不必这样做,而且这些天存储很便宜。如果您不知道什么可以安全删除,请暂时跳过此部分。
定制
现在您可以继续为您的现场发行版进行所需的更改。安装(Install)应用程序、调整设置等。完成此操作后,我们可以继续讨论Live Kit本身。
下载 Linux Live 工具包
现在是时候下载我们需要的脚本了。你可以在GitHub 上(GitHub)找到它。请特别(Pay)注意此处README中的提示。(README)其中一些可能与您的需求或情况有关。例如,如果您想制作可引导的 Live CD,则有特定说明。
Save
the downloaded files to /tmp。在下载中,您会找到一个名为“/DOC/. 这充满了额外的自述信息,以帮助您以防遇到障碍。
生成您的实时操作系统
现在脚本文件在它们应该在的位置,我们要实际运行脚本。为此,我们必须从普通用户切换到超级用户(Super User)。在Ubuntu中,打开终端(open the terminal)并输入以下内容:(type the following:)
cd /tmp
这会将您切换到我们解压缩Live Kit文件的(Live Kit)TMP文件夹。
我们需要做的最后一件事是运行脚本,所以输入:(type:)
sudo ./build
现在等到脚本完成!
运行你的 Live Distro
那么你如何获得你的 live 发行版呢?该脚本在 /TMP 文件夹中生成两个版本。您可以将ISO映像刻录到光盘或加载到虚拟机中进行测试。然而,大多数人会关心可引导的USB文件。这些也在 /TMP 文件夹中。
将它们复制到您的闪存驱动器,记住在此过程中解压缩它们。一旦它们在那里,使用终端(Terminal)并导航到 /boot 目录。然后运行“bootinst.sh”脚本以使该闪存驱动器可启动。
如果一切顺利,您现在将拥有自己的实时操作系统!
Make a Custom Live Linux Distro with Linux Live Kit
Linux, it’s a word thаt makes many a non-geek’s eyes glaze over almost immediately. Howevеr, desktop Lіnux offerings are now pretty muсh on par with the big names such as Windows and MacOS.
Thanks to decades of community work and support from organizations like Canonical, you can download something like Ubuntu Linux today and do almost all the things you can with Windows. All without needing a degree in computer science. Modern desktop Linux distros look good, work well and are suitable for average users.
However, they have one huge difference
compared to commercial operating systems – Open Source licensing.
This means we have full access to all the
inner workings of Linux. You don’t have to pay to use it and you can customize
it in just about any way you like. That’s great for power users who like to
tinker with the nut and bolts, but what if you just want to preserve your own
tweaked custom Linux installation?
You can actually create a fresh install of Linux, set it up just the way you want it and then turn it into a live, bootable installation. This is super-useful for a few reasons. First of all, it means you won’t have any downtime if you have to reinstall your operating system.
All your settings and software will already be waiting right from the start. It also makes it very easy to create custom installations for distribution. Let’s say you have to install Linux on a whole computer lab full of PCs and then install educational packages. Using a custom distribution tool means you only have to do that customization once and then simply install as usual.
One of the easiest tools out there is called
Linux Live Kit and we’re going to look at exactly how you can change an
existing Linux installation back into a custom distro.
Setting Up The Machine
In order to use the Linux Live Kit, you need
an installation of Linux to customize. While you can go ahead and do it with
your main installation, it’s not the most practical approach if you want to
create customized distributions for something other than your main computer.
So what we’ll be doing is installing Ubuntu
Linux to a VirtualBox virtual machine. That gives us a clean, controlled
installation environment. It also means you can make custom Linux distros from
a Windows machine if you like. Finally, it’s a good way to test the distro
you’ve just created, to make sure it works properly.
We are going to use the following components:
- Windows 10
- VirtualBox
- Ubuntu 18 LTS
Remember, the process works exactly the same
if you use the Linux Live Kit on a Linux installation that running as normal on
a computer, rather than in a virtual machine.
Installing Linux
The first thing to do is install Linux.
Obviously if you want to use an existing installation, you can skip this step.
Installing Linux the usual way simply requires
that you boot from the DVD or USB installation media. Because we’re using
VirtualBox, we just have to create a new virtual machine and then point it
towards the Ubuntu disc image we downloaded. Here are the steps you need to
follow.
Taking Care of Dependencies
Since Linux Live Kit is just a clever
collection of scripts, it needs certain other software packages to be present
on your Linux machine. In many cases they will already be a default part of the
version of Linux you have chosen, but you’ll have to verify this either way.
You need to make sure that aufs is supported by the kernel used by your chosen Linux distribution. You can check which kernel versions supports aufs here. If your chosen kernel does not support aufs, you’ll need to look at an alternative solution to Linux Live Kit.
Now we need to make sure that Squashfs is
installed on the system. This is the compression technology used by Linux Live
Kit. To install it, here’s what to do.
First, open the Terminal. In Ubuntu you can do this by clicking the “Show Application” button at the bottom left of the screen. This will bring up a search bar. Search for “Terminal” and click it when it comes up.
Now, in the terminal, type the following:
sudo
apt-get update && sudo apt-get install squashfs-tools
If all goes well the package will be
installed. If you run into trouble, you’ll have to refer to your version of the
OS documentation. Troubleshooting repository and installation issues are
outside our scope for this tutorial.
Trimming the Fat
Since your live distro iw going to have all
the same content as your installed one, you should remove any files you don’t
need from your installation. You don’t have to do this and storage is cheap
these days if you’re using a flash drive. If you don’t know what’s safe to remove,
skip this part for now.
Customizing
Now you can go ahead and make the changes you
want for your live distro. Install applications, tweak settings and so on. Once
you are done with that, we can move on to the Live Kit itself.
Download Linux Live Kit
Now it’s time to download the scripts we need.
You can find it on GitHub. Pay special attention to the tips in
the README here. Some of them may be relevant to your needs or situation. For
example, there are specific instructions if you want to make a bootable live
CD.
Save
the downloaded files to /tmp. In the download you’ll
find a folder named “/DOC/. This is filled with additional readme information
to help you in case you hit a snag.
Generating Your Live OS
Now that the script files are where they
should be, we want to actually run the script. To do this, we’ll have to switch
from being a regular user to being a Super User. In Ubuntu, open the terminal and type the following:
cd /tmp
This switches you to the TMP folder where we
unpacked the Live Kit files.
The
last thing we need to do is run the script, so type:
sudo ./build
Now just wait until the script is done!
Running Your Live Distro
So how do you get your live distro? The script
generates two version in the /TMP folder. There’s an ISO image that you can
burn to a disc or load up in a virtual machine to test. Most people are however
going to care about the bootable USB files. These are also in the /TMP folder.
Copy them to your flash drive, remember to
unzip them in the process. Once they are on there, use the Terminal and
navigate to the /boot directory. Then run the “bootinst.sh” script to make that
flash drive bootable.
If all goes well, you’ll now have your own
live OS!