{"id":3993,"date":"2019-08-17T16:05:24","date_gmt":"2019-08-17T13:05:24","guid":{"rendered":"https:\/\/kifarunix.com\/?p=3993"},"modified":"2019-08-17T16:05:25","modified_gmt":"2019-08-17T13:05:25","slug":"configure-apt-proxy-on-debian-10-buster","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/configure-apt-proxy-on-debian-10-buster\/","title":{"rendered":"Configure APT Proxy on Debian 10 Buster"},"content":{"rendered":"\n<p>In this guide guide, we are going to learn how to configure APT Proxy on Debian 10 Buster. If you are be running a Debian 10 system behind a proxy server, chances are you have unsuccessfully tried to install packages. Learn how to configure APT package manager to use HTTP or HTTPS proxy server while pulling packages from the repositories.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Configure APT Proxy on Debian 10 Buster<\/h2>\n\n\n\n<p>To configure APT proxy on Debian 10 Buster, you need to have the IP address and the port of the proxy server as well as the authentication username and password if at all your proxy server supports authentication. APT can be temporarily or permanently configured to use proxy.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Temporary APT Proxy Configuration<\/h3>\n\n\n\n<p>Temporary APT proxy configuration involves creating proxy environment variables which can either be <strong>http_proxy<\/strong> or <strong>https_proxy<\/strong> as shown below;<\/p>\n\n\n\n<p>In my environment, <strong>192.168.43.1<\/strong> is the proxy server IP and <strong>3128<\/strong> is the proxy server port.<\/p>\n\n\n\n<p>For HTTP proxy, simply run the command below to create an <strong>http_proxy<\/strong> environment variable which defines your proxy server and the port.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>export <strong>http_proxy<\/strong>='<strong>http<\/strong>:\/\/192.168.43.1:3128'<\/code><\/pre>\n\n\n\n<p>For HTTPS proxy;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>export <strong>https_proxy<\/strong>='<strong>https<\/strong>:\/\/192.168.43.1:3128'<\/code><\/pre>\n\n\n\n<p>If your proxy supports authentication and requires a username\/password for login, simply use;<\/p>\n\n\n\n<p>For HTTP(S) proxy;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>export <strong>http_proxy<\/strong>='<strong>http<\/strong>:\/\/<code><strong>USERNAME:PASSWORD<\/strong>@<\/code>192.168.43.1:3128'<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>export <strong>https_proxy<\/strong>='<strong>https<\/strong>:\/\/<code><strong>USERNAME:PASSWORD<\/strong>@<\/code>192.168.43.1:3128'<\/code><\/pre>\n\n\n\n<p>You can as well prefix apt command with proxy settings as shown below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo 'http_proxy=http:\/\/192.168.43.100:3128' apt update<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo 'http_proxy=http:\/\/Username:Password@192.168.43.100:3128' apt update<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Permanent APT Proxy Configuration<\/h3>\n\n\n\n<p>You can permanently configure APT proxy on APT configuration file. For example, you can create a proxy configuration file under the <strong>\/apt\/apt.conf.d<\/strong> directory as shown below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/apt\/apt.conf.d\/02proxy<\/code><\/pre>\n\n\n\n<p>For HTTP Proxy;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><code>Acquire::http::Proxy \"http:\/\/PROXYSERVERIP:PROXYPORT\";<\/code><\/pre>\n\n\n\n<p>For HTTPS;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><code>Acquire::<strong>https<\/strong>::Proxy \"<strong>https<\/strong>:\/\/PROXYSERVERIP:PROXYPORT\";<\/code><\/pre>\n\n\n\n<p>To configure for both HTTP and HTTPS;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><code>Acquire::http::Proxy \"http:\/\/PROXYSERVERIP:PROXYPORT\";<\/code>\n<code>Acquire::<strong>https<\/strong>::Proxy \"<strong>https<\/strong>:\/\/PROXYSERVERIP:PROXYPORT\";<\/code><\/pre>\n\n\n\n<p>Or simply;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Acquire {\n  HTTP::proxy \"http:\/\/PROXYSERVERIP:PROXYPORT\";\n  HTTPS::proxy \"http:\/\/PROXYSERVERIP:PROXYPORT\";\n}<\/code><\/pre>\n\n\n\n<p>If your proxy supports authentication, replace;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>http:\/\/PROXYSERVERIP:PROXYPORT<\/code><\/pre>\n\n\n\n<p>with;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>http:\/\/USERNAME:PASSWORD@PROXYSERVERIP:PROXYPORT<\/code><\/pre>\n\n\n\n<p>Such that your lines look like;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Acquire::http::proxy \"http:\/\/USERNAME:PASSWORD@PROXYSERVERIP:PROXYPORT\";\nAcquire::https::proxy \"https:\/\/USERNAME:PASSWORD@PROXYSERVERIP:PROXYPORT\";<\/code><\/pre>\n\n\n\n<p>You can also configure system wide proxy that applies to any user that logs into the system on <strong>\/etc\/profile.d<\/strong> by setting the\u00a0<code>http_proxy<\/code>\u00a0and\u00a0<code>https_proxy<\/code>\u00a0variables. For example, create a file, <strong>\/etc\/profile.d\/proxy.sh<\/strong> with the following environment variables set.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/profile.d\/proxy.sh<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>export http_proxy='http:\/\/USERNAME:PASSWORD@192.168.43.1:3128'\nexport https_proxy='https:\/\/USERNAME:PASSWORD@192.168.43.1:3128'<\/code><\/pre>\n\n\n\n<p><code>source<\/code> the proxy configuration file to reload environment variables.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>source \/etc\/profile.d\/proxy.sh<\/code><\/pre>\n\n\n\n<p>If you are using bash shell, then to set the proxy that applies for a single user, you can edit the <strong>$HOME\/.bashrc<\/strong> file and add the lines;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim $HOME\/.bashrc<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>export http_proxy='http:\/\/USERNAME:PASSWORD@192.168.43.1:3128'\nexport https_proxy='https:\/\/USERNAME:PASSWORD@192.168.43.1:3128'<\/code><\/pre>\n\n\n\n<p>source the\u00a0$HOME\/.bashrc\u00a0file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>source $HOME\/.bashrc<\/code><\/pre>\n\n\n\n<p>Now, if you try to run apt command, you will note that it tries to connect to proxy server. If connection is successful, you APT will run with no issues.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update\n0% [Connecting to 192.168.43.1 (192.168.43.1)]...<\/code><\/pre>\n\n\n\n<p>That is all on how to configure APT Proxy on Debian 10 Buster. Enjoy<\/p>\n\n\n\n<p>Related Tutorials;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-grafana-plugins-behind-a-proxy-server\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install Grafana Plugins Behind a Proxy server<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-set-system-wide-proxy-in-ubuntu-18-04\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">How to Set System Wide Proxy in Ubuntu 18.04<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/how-to-setup-squid-proxy-basic-authentication-with-username-and-password\/\" target=\"_blank\">Setup Squid Proxy Authentication on Ubuntu 18.04\/Fedora 29\/28\/CentOS 7<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-install-and-configure-squid-proxy-on-fedora-29-fedora-28-centos-7\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">How to Install and Configure Squid Proxy on Fedora 29\/Fedora 28\/CentOS 7<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide guide, we are going to learn how to configure APT Proxy on Debian 10 Buster. If you are be running a Debian<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,250,34],"tags":[1082,997,1039,252,357],"class_list":["post-3993","post","type-post","status-publish","format-standard","hentry","category-howtos","category-proxy","category-security","tag-apt-proxy","tag-debian-10","tag-debian-10-buster","tag-proxy","tag-system-proxy","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3993"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=3993"}],"version-history":[{"count":3,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3993\/revisions"}],"predecessor-version":[{"id":4010,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3993\/revisions\/4010"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=3993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=3993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=3993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}