One of the problems that Ubuntu server users face when installing their required packages is the slow download speed of the packages. Many users use the default mirrors to download packages, but these mirrors may not be suitable for servers inside Iran in terms of download speed. In this tutorial, we will teach you how to configure an Iranian mirror, also known as an Iranian repository, in Ubuntu to increase the speed of updating and downloading your packages.
The Importance of Choosing the Right Mirror in Ubuntu
While Ubuntu is very popular, you may encounter problems such as slow package downloads and system updates when using it. One of the main causes of these problems is choosing an inappropriate mirror for downloading packages and updates. This means that if you do not choose the right mirror, the download and update speeds will be drastically reduced. On the other hand, using domestic mirrors improves the package download speed on servers inside Iran. For this reason, choosing the right mirror for Ubuntu is very important and should be done with care and knowledge.
Setting Up the Iranian Mirror for Ubuntu
If you want to set up the Iranian mirror for your Ubuntu operating system, you can do so in SSH by following these steps:
Edit the sources.list file
Edit the sources.list file with root access. To do this, enter the following command in the terminal:
nano /etc/apt/sources.list
By running this command, the nano editor will open, and you can edit the sources.list file.
Change the Mirror to ir.archive.ubuntu.com
In the opened file, change all mirrors that start with http:// to http://ir.archive.ubuntu.com. For example, the address may be us.archive.ubuntu.com, in which case you should change the word “us” to “ir.”
Then press Ctrl + X and save the file.
The address ir.archive.ubuntu.com points to the Ubuntu mirror server inside Iran. This address is usually the Iranian Ubuntu repository for an Iranian company. Also, the Iranian repository server for this address may change and point to the server of another company.
Also, to make this easier without editing the file, we have written a terminal command for you that you can enter in SSH to do this automatically and quickly:
sed -i 's/http://[a-z]*.archive.ubuntu.com/http://ir.archive.ubuntu.com/g' /etc/apt/sources.list
This command finds the patterns http://*.archive.ubuntu.com and replaces them with http://ir.archive.ubuntu.com. Thus, all mirrors that start with the specified pattern in sources.list are replaced with the Iranian mirror.
Conclusion
In conclusion, setting up the appropriate mirror for the Ubuntu operating system can improve the speed of downloading and installing software packages and reduce download speed issues from foreign mirrors. Also, using domestic mirrors may help reduce communication costs. By following the steps outlined in this tutorial, you can select the appropriate mirror for your Ubuntu operating system and enjoy faster download and update speeds for software packages.