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:

##Nginx Test Fix
deb trusty nginx
deb-src trusty nginx

*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:

apt-key add nginx_signing.key

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

apt-get update
apt-get install nginx

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.

Skip to main content