At my work, I installed Linux Ubuntu on VirtualBox but when I run the virtual machine, I could not get on the internet. After some time, I finally got it working and I would like to share my solution with you.
First, you have to question yourself: could the proxy be the problem or my VirtualBox settings? In my case, it was the proxy. If you’re not behind a proxy, I’m sorry but this tutorial is not for you 🙁 If you do, you are a lucky guy 😀 let us start!
Luckily, we don’t need to change VirtualBox settings. I just use NAT as network adapter. So all the configuration will be done in Ubuntu.
First, startup your Ubuntu VirtualBox, then press Ctrl + Alt + T and the terminal will open. Enter the following commands:
sudo -i
nano /etc/bash.bashrc
At the bottom of that file, add the following lines:
export http_proxy=http://username:password@proxyserver.net:port
export https_proxy=http://username:password@proxyserver.net:port
After you did that, press Ctrl + O, Enter, Ctrl + X. Next, we do the same in another file.
nano /etc/environment
At the bottom of that file, add the following lines:
export http_proxy=http://username:password@proxyserver.net:port
export https_proxy=http://username:password@proxyserver.net:port
After you did that, press Ctrl + O, Enter, Ctrl + X again. Finally, we need to manipulate the last file:
nano /etc/apt/apt.conf
Add the following lines:
Acquire::http::Proxy "http://username:password@proxyserver.net:port";
Acquire::https::Proxy "http://username:password@proxyserver.net:port";
Again, press Ctrl + O, Enter, Ctrl + X and you’re done! :D. Now reboot and enjoy internet.
NOTE! At the https settings, you need to add a http url and not the https url
Thank you so much! You helped me to revive internet in my linux terminal.
Good, I was aware of /etc/apt/apt.conf but not of 2 others and this stuck me for hours.
It seems a reboot is necessary, not sure.
IMPORTANT: Finish each line by a “/” (http://myproxy:8080/“)
should I finish each line by a “/” just in the apt.conf file or in all the others also?
thank you!! this works perfectly in 16.04 and 17.10!
you sir deserve a prize!
This is gold and still works on Ubuntu 18