Microsoft Azure: How to change a repository in a Linux Ubuntu VM

If you have a particular repository you want to use for your Linux VM from within Azure to install packages from, simply follow the below instructions. For our example, we will update the repository for installing Nginx.

First, sudo su to elevate to root.

Next, vim /etc/apt/sources.list (you may use your favorite text editor)

Add the following lines to the file:

*taken from this page here.

Save the file.

cd to /etc/apt/


to download the necessary key to authenticate the repository signature, which is necessary for Debian/Ubuntu.

To add the downloaded key to the apt program keyring, type the following command:

Then to complete the install from the new repo, type the following:

And that’s it! You should see your install pull from the newly specified repository instead of the default one specified in your sources.list file.

Reminder: All of my posts are provided "AS IS", imply no warranties, and confer no rights or special privileges. Use of included postings, code samples and other works are subject to the terms specified at Microsoft. For more information, click here.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.