Ubuntu provides a easy way of installing and updating packages from repositories through Synaptic package manager. If you love doing everything from terminal, you can use the apt-get command instead.You can check our article on how to install software in Ubuntu .
But if you are behind a proxy server or firewall which restricts direct access to the internet, you need to configure the proxy settings to get around the above methods to work.
Lets go through configuring the proxy settings for the traditional command line way of doing things first.
1) Using apt-get in terminal
- Edit the file /home/USERNAME/.bashrc using any editor.
- Add the following lines at the end replacing proxyhost and port with appropriate values.
export http_proxy="http://username:password@proxyhost:port" export ftp_proxy="http://username:password@proxyhost:port"
If your proxy does not require a username and password, you can leave out those giving only http://proxyhost:port . Close the terminal and open it again so that the variables will be updated.
- In some cases, the following step should also be performed. Edit the file /etc/apt/apt.conf with root permissions.
sudo gedit /etc/apt/apt.conf
- Paste the following lines with appropriate values.
Acquire::http::proxy "http://username:password@proxyhost:port/"; Acquire::ftp::proxy "http://username:password@proxyhost:port/";
You can leave out the username and password, if your proxy server do not require them.
- Now that you have configured the above two files, the following commands should work for updating the repositories and installing packages.
sudo apt-get update sudo apt-get install package-name
2) Using Synaptic Package manager
Open Synaptic Package manager from System->Administration menu.
Go to Settings -> Preferences -> Network.
Select Manual proxy configuration and enter the details of your proxy server and port. If your proxy also requires a username and password to access, then click Authentication to enter those details. You can also set No proxy for local servers, if your repositories are located in your intranet to which you have direct access. Check the screenshot below.
Don’t hesitate to post a comment, if you have any issues or alternate ways.
You can also check some Ubuntu related articles :
- How to install Ubuntu
- How to install MATLAB on Ubuntu
- How to use Gtalk in Ubuntu
- How to recover permanently deleted files in Linux
- How to use multiple dropbox accounts in Linux