I spent lot of time figuring out how to set proxy on Ubuntu Server from command line. There are multiple ways mentioned on internet. Some works and some dont. Here’s what works and what dont. Hope this is useful.
What works: This worked first time .
Create the file /etc/apt/apt.conf and put this line with your proxy settings : (By default I found that this file does not exist. so you need to create this).
example: Acquire::http::Proxy “http://bob:123bob@bobproxy:8070“;
What does not work: For me this method even after trying multiple times did not work.
Edit your /etc/bash.bashrc file as root.
Put these line at the end of your /etc/bash.bashrc file :