加快編譯速度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

相關文章
相關標籤/搜索