I must say that I am sorry to those who do not use Ubuntu, but I mainly use Ubuntu. Yes, I need to branch out and work with some others. I do occasionally use CentOS or Fedora. I used to use Linux Mint a bit and Bodhi. I’m sure you’re thinking, “Those are mostly Ubuntu”. The Red Hat distros are mainly for the LFCS articles.
So, let’s go over speeding up Ubuntu and you may see steps that will work with your distro.
Repositories
Downloading updates from your repositories can take a while, especially right after you install a system or it’s been some time since you’ve done an update.
We will need to use the “Software & Updates” app, which may not be installed by default. To install the required app, you need to open a terminal and run the following command:
Once done, you should be able to find the “Software & Updates” app.
Now, get the app running and you should see something similar to Figure 1.
FIGURE 1
How the updates work is that they download from a default server. The server may not be physically close to your location. To speed it up, you need to find a server that allows you the fastest speed. To do this, the application can perform a test (ping) to see which server has the fastest response time and set that server as your default Repository.
Make sure that the selected tab is “Ubuntu Software”, as shown in Figure 1. For the section “Download from:”, it should have selected Servers for your country. As mine says “Servers for United States”. Choose the box and then select “Other…”. On the new window that appears, see Figure 2, you choose the box labeled “Select best Server”. The app will now test for the best server that has the fastest time and set this as the default Repository Server.
FIGURE 2
Once the test is completed, the app will highlight the fastest server and you can then select the button for “Choose Server”. You may need to type in your password for elevated privileges to allow the change to be made.
Performing updates and upgrade should now be faster than before you found the best server.
Upgrade in Parallel
Another method of increasing upgrade time is to download the updates from the Repository in Parallel. This means that multiple files are downloaded at once and not one file at a time.
The program required to do this is ‘apt-fast’, which can be downloaded by:
While installing, you will be prompted by which program you used to install apps. The choices are: ‘apt-get’, ‘apt’ or ‘aptitude’. Once selected, you will be asked the maximum number of connections. This is basically the number of files that can be downloaded at one time. The default of ‘5’ is fine. You are then prompted whether you want the apt-fast confirmations suppressed. The default is ‘no’, which is fine. If you want to automatically download the upgrades and not have to answer ‘Y’, then select ‘Yes’.
Instead of using the command ‘apt-get’, use the command ‘apt-fast’. You could always create an Alias to make ‘apt-fast’ work when just typing in ‘apt-get’. Any command you use ‘apt-get’, you can use ‘apt-fast’. The command is not just for installing, but removing apps as well.
Preload Common Apps
There is a daemon that can be installed, called ‘preload’, that can monitor your used applications. Apps that you use commonly can be loaded into memory for a faster startup of the application.
To start ‘preload’, you need to install it:
Once installed, just restart your computer to make the daemon active.
Once loaded, the daemon tracks your usage and sets up apps to preload when the system is started. This can definitely help common applications to load faster, but this can also use more memory. On a system that has a lot of RAM, this should be fine.
After a bit of monitoring, the common apps are loaded into RAM. You can check this with:
SSD Optimization
On most systems, when a file is deleted from a drive, the file is not removed. The file is simply marked as being removed so it is possible to undelete files. Over time, these deleted files will cause ‘empty’ areas to occur between other files and fragments of files. These files either need to be removed or moved to a location that will not cause fragmentation of files.
When fragmentation occurs, the speed of reading and writing can be reduced. These ‘deleted’ files can be managed on SSD drives.
To determine if you have an SSD, you can run:
For any drives listed that have a ROTA value of ‘0’ is an SSD. If the drive has a value of ‘1’, then it is an HDD.
If you have an SSD, then you can enable the ‘fstrim’ service. The service should be installed automatically. You need to check that the service is enabled:
If the service is not enabled, then you can enable and start it:
You can force a trim at a mount point, such as:
The parameter ‘-v’ sets up a verbose listing to show the space that was trimmed. This is all the space on your drive, as shown in Figure 3.
FIGURE 3
You can keep trimming the SSD until the value is ‘0’ that has been trimmed. The service should auto-trim the device as needed, but you can force it in this way.
Conclusion
These are only a few ways to enhance the performance of Ubuntu.
Every user has shortcuts and other methods of speeding things up. There can be aliases set, scripts made and performance enhancements, like I discussed. These are by no means all of the methods, but these are a start. If you should have some methods, please share them.
So, let’s go over speeding up Ubuntu and you may see steps that will work with your distro.
Repositories
Downloading updates from your repositories can take a while, especially right after you install a system or it’s been some time since you’ve done an update.
We will need to use the “Software & Updates” app, which may not be installed by default. To install the required app, you need to open a terminal and run the following command:
Code:
sudo apt install ubuntu-desktop -y
Once done, you should be able to find the “Software & Updates” app.
Now, get the app running and you should see something similar to Figure 1.
FIGURE 1
How the updates work is that they download from a default server. The server may not be physically close to your location. To speed it up, you need to find a server that allows you the fastest speed. To do this, the application can perform a test (ping) to see which server has the fastest response time and set that server as your default Repository.
Make sure that the selected tab is “Ubuntu Software”, as shown in Figure 1. For the section “Download from:”, it should have selected Servers for your country. As mine says “Servers for United States”. Choose the box and then select “Other…”. On the new window that appears, see Figure 2, you choose the box labeled “Select best Server”. The app will now test for the best server that has the fastest time and set this as the default Repository Server.
FIGURE 2
Once the test is completed, the app will highlight the fastest server and you can then select the button for “Choose Server”. You may need to type in your password for elevated privileges to allow the change to be made.
Performing updates and upgrade should now be faster than before you found the best server.
Upgrade in Parallel
Another method of increasing upgrade time is to download the updates from the Repository in Parallel. This means that multiple files are downloaded at once and not one file at a time.
The program required to do this is ‘apt-fast’, which can be downloaded by:
Code:
sudo add-apt-repository ppa:apt-fast/stable
sudo apt install app-fast
While installing, you will be prompted by which program you used to install apps. The choices are: ‘apt-get’, ‘apt’ or ‘aptitude’. Once selected, you will be asked the maximum number of connections. This is basically the number of files that can be downloaded at one time. The default of ‘5’ is fine. You are then prompted whether you want the apt-fast confirmations suppressed. The default is ‘no’, which is fine. If you want to automatically download the upgrades and not have to answer ‘Y’, then select ‘Yes’.
Instead of using the command ‘apt-get’, use the command ‘apt-fast’. You could always create an Alias to make ‘apt-fast’ work when just typing in ‘apt-get’. Any command you use ‘apt-get’, you can use ‘apt-fast’. The command is not just for installing, but removing apps as well.
Preload Common Apps
There is a daemon that can be installed, called ‘preload’, that can monitor your used applications. Apps that you use commonly can be loaded into memory for a faster startup of the application.
To start ‘preload’, you need to install it:
Code:
sudo apt install preload
Once installed, just restart your computer to make the daemon active.
Once loaded, the daemon tracks your usage and sets up apps to preload when the system is started. This can definitely help common applications to load faster, but this can also use more memory. On a system that has a lot of RAM, this should be fine.
After a bit of monitoring, the common apps are loaded into RAM. You can check this with:
Code:
cat /var/log/preload.log
SSD Optimization
On most systems, when a file is deleted from a drive, the file is not removed. The file is simply marked as being removed so it is possible to undelete files. Over time, these deleted files will cause ‘empty’ areas to occur between other files and fragments of files. These files either need to be removed or moved to a location that will not cause fragmentation of files.
When fragmentation occurs, the speed of reading and writing can be reduced. These ‘deleted’ files can be managed on SSD drives.
To determine if you have an SSD, you can run:
Code:
lsblk -o NAME,ROTA
For any drives listed that have a ROTA value of ‘0’ is an SSD. If the drive has a value of ‘1’, then it is an HDD.
If you have an SSD, then you can enable the ‘fstrim’ service. The service should be installed automatically. You need to check that the service is enabled:
Code:
sudo systemctl status fstrim.timer
If the service is not enabled, then you can enable and start it:
Code:
sudo systemctl enable fstrim.timer
sudo systemctl start fstrim.timer
You can force a trim at a mount point, such as:
Code:
sudo fstrim /media/$USER/ -v
The parameter ‘-v’ sets up a verbose listing to show the space that was trimmed. This is all the space on your drive, as shown in Figure 3.
FIGURE 3
You can keep trimming the SSD until the value is ‘0’ that has been trimmed. The service should auto-trim the device as needed, but you can force it in this way.
Conclusion
These are only a few ways to enhance the performance of Ubuntu.
Every user has shortcuts and other methods of speeding things up. There can be aliases set, scripts made and performance enhancements, like I discussed. These are by no means all of the methods, but these are a start. If you should have some methods, please share them.