加快编译速度ubuntu_加快Ubuntu PC速度的6种方法

加快编译速度ubuntu

加快编译速度ubuntu

image

Ubuntu is pretty snappy out-of-the-box, but there are some ways to take better advantage of your system’s memory and speed up the boot process. Some of these tips can really speed things up, especially on older hardware.

Ubuntu相当开箱即用,但是有一些方法可以更好地利用系统的内存并加快启动过程。 这些技巧中的一些技巧确实可以加快速度,尤其是在较旧的硬件上。

In particular, selecting a lightweight desktop environment and lighter applications can give an older system a new lease on life. That old computer that struggles with Ubuntu’s Unity desktop can provide decent performance for years to come.

特别是,选择轻量级的桌面环境和轻量级的应用程序可以使旧系统焕然一新。 与Ubuntu的Unity桌面斗争的那台旧计算机可以在未来几年提供出色的性能。

安装预载 (Install Preload)

Preload is a daemon – a background service, in other words – that monitors the applications you use on your computer. It learns the libraries and binaries you use and loads them into memory ahead of time so the applications start faster. For example, if you always open LibreOffice and Firefox after starting your computer, preload will automatically load each application’s files into memory when your computer starts. When you log in and launch the applications, they’re start faster.

Preload是一个守护程序,即后台服务,它监视您在计算机上使用的应用程序。 它会学习您使用的库和二进制文件,并提前将它们加载到内存中,从而使应用程序启动更快。 例如,如果在启动计算机后始终打开LibreOffice和Firefox,则预加载将在计算机启动时自动将每个应用程序的文件加载到内存中。 登录并启动应用程序时,它们的启动速度更快。

Preload isn’t installed by default on Ubuntu, although some distributions do include it by default. To install Preload, run the following command:

默认情况下,Ubuntu上未安装预加载,尽管默认情况下某些发行版确实包含预加载。 要安装Preload,请运行以下命令:

sudo apt-get install preload

sudo apt-get安装预载

image

That’s it! Preload runs in the background without bothering you. You can tweak Preload’s settings in the /etc/preload.conf file if you want, but the default settings should work fine.

而已! 预加载在后台运行,不会打扰您。 您可以根据需要在/etc/preload.conf文件中调整Preload的设置,但是默认设置应该可以正常工作。

控制启动应用 (Control Startup Applications)

Applications can automatically start when you log into Ubuntu. Packages can automatically add their own autostart entries – for example, install Dropbox and you’ll likely have it automatically starting with your desktop. If you have quite a few of these entries – or a slower system – this can make your desktop take longer to appear. You can control these startup applications from the Startup Applications dialog.

当您登录Ubuntu时,应用程序可以自动启动。 程序包可以自动添加自己的自动启动条目-例如,安装Dropbox,您很可能会自动从桌面启动它。 如果您有很多这样的条目(或者系统速度较慢),这会使您的桌面需要更长的时间才能显示。 您可以从“启动应用程序”对话框中控制这些启动应用程序。

image

Ubuntu hides most of the system’s default autostart entries from this dialog. To view them, run the following command in a terminal:

Ubuntu在此对话框中隐藏了系统的大多数默认自动启动条目。 要查看它们,请在终端中运行以下命令:

sudo sed -i ‘s/NoDisplay=true/NoDisplay=false/g’ /etc/xdg/autostart/*.desktop

sudo sed -i's / NoDisplay = true / NoDisplay = false / g'/etc/xdg/autostart/*.desktop

This command modifies each autostart file and changes the “NoDisplay” parameter from “true” to “false,” making each entry appear in the list. After running this command, restart the Startup Applications dialog and you’ll see more options.

此命令修改每个自动启动文件,并将“ NoDisplay”参数从“ true”更改为“ false”,使每个条目都显示在列表中。 运行此命令后,重新启动“启动应用程序”对话框,您将看到更多选项。

image

Don’t disable an autostart entry unless you understand what it does. For example, if your computer doesn’t have Bluetooth hardware, you can disable the Bluetooth Manager applet – but don’t disable Ubuntu One if you use it.

除非您了解自动启动项,否则不要禁用它。 例如,如果您的计算机没有蓝牙硬件,则可以禁用蓝牙管理器小程序,但如果使用它,则不要禁用Ubuntu One。

You should disable entries by unchecking their check boxes instead of clicking the Remove button. If you need to re-enable an entry later, you can re-enable its check box.

您应该通过取消选中其复选框来禁用条目,而不是单击“删除”按钮。 如果以后需要重新启用条目,则可以重新启用其复选框。

使用较轻的桌面环境 (Use a Lighter Desktop Environment)

If you’re using older hardware that struggles with Ubuntu’s default Unity desktop environment, you may want to use a lighter desktop environment. Good options include LXDE, XFCE – or even something like Xmonad, if you want a super-minimal environment. These options are just scratching the surface of the available lightweight desktop environments.

如果您使用的旧硬件与Ubuntu的默认Unity桌面环境不兼容,则可能需要使用较轻的桌面环境。 如果您想要一个超小型环境,那么不错的选择包括LXDEXFCE –甚至像Xmonad之类的东西。 这些选项只是在摸索可用轻量级桌面环境的表面。

使用打火机应用 (Use Lighter Applications)

Along with a lighter desktop environment, more lightweight applications can increase the performance of an older, slower system. For example, if you’re typing up the occasional text document in LibreOffice Writer, why not try Abiword instead? It has less features, but it’s faster.

伴随着更轻便的桌面环境,更轻便的应用程序可以提高旧的,速度较慢的系统的性能。 例如,如果您要在LibreOffice Writer中键入偶尔的文本文档,为什么不尝试使用Abiword? 它具有较少的功能,但速度更快。

image

If you’re using Mozilla Thunderbird or GNOME Evolution for your email, you might try Sylpheed, a more lightweight graphical email program. You’ll find lightweight alternatives for most programs you use – just give it a Google. You can even ditch graphical applications entirely and do everything with terminal applications – you’ll find a lot of terminal-based alternatives, too.

如果您的电子邮件使用Mozilla Thunderbird或GNOME Evolution,则可以尝试使用Sylpheed(一种更轻量级的图形电子邮件程序)。 您会发现所用大多数程序的轻量级替代品-只需为其提供一个Google。 您甚至可以完全放弃图形应用程序,并使用终端应用程序执行所有操作–您还会发现很多基于终端的替代方案。

减少启动菜单延迟 (Reduce Boot Menu Delay)

If you have multiple operating systems installed, Ubuntu displays the GRUB boot loader menu for 10 seconds when you start your computer. After 10 seconds, it automatically starts your default boot entry. If you normally wait for Ubuntu to select the default boot entry, you can reduce this timeout and take precious seconds off your boot process.

如果安装了多个操作系统,则启动计算机时,Ubuntu将显示GRUB引导加载程序菜单10秒钟。 10秒后,它将自动启动您的默认启动项。 如果您通常等待Ubuntu选择默认的启动项,则可以减少此超时时间,并节省宝贵的启动时间。

To modify this setting, open the /etc/default/grub file in a text editor:

要修改此设置,请在文本编辑器中打开/ etc / default / grub文件:

gksu gedit /etc/default/grub

gksu gedit / etc / default / grub

Change the value of GRUB_TIMEOUT in the file to a lower number. If you set the timeout to something extremely low – say, 1 second – you can access the boot menu by continually pressing the arrow keys or Escape key while your computer boots.

将文件中的GRUB_TIMEOUT的值更改为较小的数字。 如果将超时设置为极低的值(例如1秒),则可以在计算机启动时连续按箭头键或Escape键来访问启动菜单。

image

Save the file and run the following command to apply your changes:

保存文件并运行以下命令以应用更改:

sudo update-grub2

须藤更新grub2

image

You can also modify this setting – and many other GRUB2 settings — with Grub-Customizer.

您还可以使用Grub-Customizer修改此设置以及其他许多GRUB2设置。

音调柔和度 (Tune Swappiness)

The last option is a controversial one. Even Linux kernel developers disagree with each other about the optimal value for the swappiness parameter.

最后一种选择是有争议的。 即使是Linux内核开发人员,对于swappiness参数的最佳值也意见不一致

The swappiness value controls the Linux kernel’s tendency to swap – that is, move information out of RAM and onto the swap file on the disk. It accepts a value between 0 and 100.

swappiness值控制Linux内核的交换趋势-即将信息移出RAM并移至磁盘上的交换文件。 它接受0到100之间的值。

  • 0: The kernel will avoid swapping process out of physical memory and onto the swap partition for as long as possible.

    0:内核将尽可能避免将进程从物理内存中移出到交换分区上。
  • 100: The kernel will aggressively swap processes out of physical memory and onto the swap partition as soon as possible.

    100:内核将积极地将进程从物理内存中交换出来,并尽快交换到交换分区上。

Ubuntu’s default swappiness value is 60. If you find that Ubuntu is swapping processes out to disk when it shouldn’t be, you can try a lower value – say, 10.

Ubuntu的默认swappiness值为60。如果发现Ubuntu在不应该将进程交换到磁盘时,可以尝试使用一个较小的值-例如10。

image

To temporarily change the swappiness value to 10, use the following command:

要将swappiness值临时更改为10,请使用以下命令:

sudo sysctl vm.swappiness=10

须藤sysctl vm.swappiness = 10

This change will be lost when your system restarts. If you want to preserve the value between boots, edit the /etc/sysctl.conf file:

系统重新启动时,此更改将丢失。 如果要保留引导之间的值,请编辑/etc/sysctl.conf文件:

gksu gedit /etc/sysctl.conf

gksu gedit /etc/sysctl.conf

Look for vm.swappiness in the file and change its value. If it doesn’t exist, add it to the end of the file on a new line, like so:

在文件中查找vm.swappiness并更改其值。 如果不存在,则将其添加到文件末尾的新行中,如下所示:

vm.swappiness=10

vm.swappiness = 10

image

Save the file after making the change.

进行更改后保存文件。



How do you speed up your Ubuntu system? Do you have a preferred swappiness value? Leave a comment and let us know.

您如何加快Ubuntu系统的速度? 您有首选的交换价值吗? 发表评论,让我们知道。

翻译自: https://www.howtogeek.com/115797/6-ways-to-speed-up-ubuntu/

加快编译速度ubuntu