Menu
User

DropVPS Team

Writer: Cooper Reagan

How to set proxy for apt ubuntu?

How to set proxy for apt ubuntu?

Publication Date

03/07/2025

Category

Articles

Reading Time

3 Min

Table of Contents

Setting a proxy for APT (Advanced Package Tool) in Ubuntu is a straightforward process that allows you to download packages through a proxy server. This can be particularly useful in environments where direct internet access is restricted or when you want to improve your download speeds. In this guide, we’ll walk you through the steps to configure APT to use a proxy server.

Step 1: Identify Your Proxy Server

Before configuring APT, you need to know the details of your proxy server, including the IP address and port number. A common format for a proxy server is:

http://username:[email protected]:port

If your proxy does not require authentication, you can skip the username and password.

Step 2: Configure APT to Use the Proxy

You will need to create or modify the configuration file for APT. Open a terminal window and use a text editor like nano or vim to edit the APT configuration file:

sudo nano /etc/apt/apt.conf.d/99proxy

In this file, you can specify your proxy settings. Add the following lines, replacing the placeholder values with your actual proxy details:

For an HTTP proxy:

Acquire::http::Proxy "http://username:[email protected]:port/";

If your proxy does not require authentication, use:

Acquire::http::Proxy "http://proxyserver.com:port/";
Acquire::https::Proxy "http://proxyserver.com:port/";

Step 3: Save and Exit

After you have entered the proxy configuration, save the changes and exit the text editor. In nano, you can do this by pressing CTRL + X, then Y, and finally Enter.

Step 4: Update APT and Install Packages

Now that you have configured the proxy, you can update your package list and install packages using APT. Run the following commands:

sudo apt update

If everything is set up correctly, APT will use the specified proxy to connect to the repositories and download package information.

Step 5: Testing Your Configuration

To ensure that your proxy settings are working properly, you can try installing a package. For example, to install curl, run:

sudo apt install curl

If the installation proceeds without errors, your proxy configuration is working correctly.

By following these steps, you have successfully configured APT to use a proxy in Ubuntu. This setup will help you manage package installations and updates in environments where direct internet access is restricted. For more tips and tutorials, visit DropVPS.com!

Linux VPS
U
Loading...

Related Posts

How to set proxy for apt ubuntu?