{"id":108078,"date":"2021-10-27T22:31:41","date_gmt":"2021-10-27T19:31:41","guid":{"rendered":"https:\/\/computingforgeeks.com\/?p=108078"},"modified":"2023-01-25T12:07:25","modified_gmt":"2023-01-25T09:07:25","slug":"how-to-set-system-proxy-on-debian-linux","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/how-to-set-system-proxy-on-debian-linux\/","title":{"rendered":"How To Set System Proxy on Debian 11\/10\/9"},"content":{"rendered":"\n<p>A proxy server is a machine that sits in your network infrastructure with a purpose of translating traffic between networks or protocols. You can think of it as an intermediary server that separates the end-user clients from the destinations that they browse \/ need to access. There are quite some security features that you get by having a Proxy server in your Infrastructure. A proxy server caches content to reduce bandwidth and load web pages more quickly.<\/p>\n\n\n\n<p>In this article, we show you how to configure system proxy settings on Debian 11\/10\/9 Linux system for the HTTP, HTTPS, and FTP protocol and when using wget command line tool. Proxy settings can be applied to a particular user account on a Linux system or push settings that affect all logged in users. This can be done on a graphical interface or configuring from the command line.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1) Set System-Wide Proxy settings on Debian from GUI<\/h2>\n\n\n\n<p>If you have a Desktop Environment you can set Proxy under<strong>&nbsp;Settings &gt; Network &gt; Network Proxy &gt; Manual<\/strong> interface.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-debian.png\"><img loading=\"lazy\" decoding=\"async\" width=\"982\" height=\"687\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-debian.png\" alt=\"setup proxy gui debian\" class=\"wp-image-22864\" title=\"How To Set System Proxy on Ubuntu 20.04|18.04 1\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-debian.png 982w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-debian-300x210.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-debian-768x537.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-debian-100x70.png 100w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-debian-696x487.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-debian-600x420.png 600w\" sizes=\"auto, (max-width: 982px) 100vw, 982px\" \/><\/a><\/figure>\n\n\n\n<p>Populate proxy values for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>HTTP Proxy<\/li>\n\n\n\n<li>HTTPS Proxy<\/li>\n\n\n\n<li>FTP Proxy<\/li>\n\n\n\n<li>Socks Host if applicable<\/li>\n\n\n\n<li>Ignore Hosts &#8211; List of  destination IP addresses or domain names where Proxy settings should not be applied.<\/li>\n<\/ul>\n\n\n\n<p>For users using Firefox Web browser, you need to update proxy settings under&nbsp;<strong>Preferences &gt; Network Settings &gt; Manual Proxy configuration<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-firefox-1024x717.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"717\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-firefox-1024x717.png\" alt=\"setup proxy gui firefox\" class=\"wp-image-22873\" title=\"How To Set System Proxy on Ubuntu 20.04|18.04 3\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-firefox-1024x717.png 1024w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-firefox-300x210.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-firefox-768x538.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-firefox-100x70.png 100w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-firefox-696x488.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-firefox-1068x748.png 1068w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-firefox-599x420.png 599w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/07\/setup-proxy-gui-firefox.png 1236w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Configure Proxy and click \u201c<em>OK<\/em>\u201d to save. The settings should take effect immediately after applying them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2) Set System-Wide Proxy settings on Debian from CLI<\/h2>\n\n\n\n<p>For this we will create a file inside <code>\/etc\/profile.d<\/code> directory and set Proxy settings that will work for all users on a Debian Linux system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vim <meta charset=\"utf-8\">\/etc\/profile.d\/proxy.sh<\/code><\/pre>\n\n\n\n<p>Populate your proxy values.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># set proxy config via profie.d - should apply for all users\n# http\/https\/ftp\/no_proxy\nexport http_proxy=\"http:\/\/10.10.1.20:8080\/\"\nexport https_proxy=\"http:\/\/10.10.1.20:8080\/\"\nexport ftp_proxy=\"http:\/\/10.10.1.20:8080\/\"\nexport no_proxy=\"127.0.0.1,localhost\"\n\n<em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\"># For curl\n<\/mark><\/em>export HTTP_PROXY=\"http:\/\/10.10.1.20:8080\/\"\nexport HTTPS_PROXY=\"http:\/\/10.10.1.20:8080\/\"\nexport FTP_PROXY=\"http:\/\/10.10.1.20:8080\/\"\nexport NO_PROXY=\"127.0.0.1,localhost\"<\/code><\/pre>\n\n\n\n<p>Add any additional IP address to be excluded to the <em>NO_PROXY<\/em> &amp; <em>no_proxy<\/em> environment variables. When done add execution bit to the script created.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chmod +x \/etc\/profile.d\/proxy.sh<\/code><\/pre>\n\n\n\n<p>Any user in the system that needs to use these settings have to log out and back in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>logout<\/code><\/pre>\n\n\n\n<p>Alternatively, source the file for runtime use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>source \/etc\/profile.d\/proxy.sh<\/code><\/pre>\n\n\n\n<p>Confirm proxy has been loaded in your environment.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>env | grep -i proxy<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3) Set proxy for APT package manager<\/h2>\n\n\n\n<p>The Proxy settings in method 1 and 2 will only work for applications and command-line tools connectivity, but not for APT package manage.<\/p>\n\n\n\n<p>If you need to set proxy for the APT package manager, configure like below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\">sudo vim \/etc\/apt\/apt.conf.d\/80proxy<\/mark>\nAcquire::http::proxy \"http:\/\/10.10.1.20:8080\/\";\nAcquire::https::proxy \"https:\/\/10.10.1.20:8080\/\";\nAcquire::ftp::proxy \"ftp:\/\/10.10.1.20:8080\/\";<\/code><\/pre>\n\n\n\n<p>Replace&nbsp;<em>10.10.1.20 with the&nbsp;<\/em>correct IP address for your proxy servers. If Authentication is required, set like this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Acquire::http::proxy \"http:\/\/&lt;username&gt;:&lt;password&gt;@&lt;proxy&gt;:&lt;port&gt;\/\";\nAcquire::https::proxy \"https:\/\/&lt;username&gt;:&lt;password&gt;@&lt;proxy&gt;:&lt;port&gt;\/\";\nAcquire::ftp::proxy \"ftp:\/\/&lt;username&gt;:&lt;password&gt;@&lt;proxy&gt;:&lt;port&gt;\/\";<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4) Set Proxy for wget CLI only<\/h2>\n\n\n\n<p>If you would like to set proxy for use with <code>wget<\/code> command line tool, the file to modify is <code>~\/.wgetrc<\/code>&nbsp;file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <span class=\"has-inline-color has-pale-pink-color\">vim ~\/.wgetrc      <\/span>                     \nuse_proxy = on\nhttp_proxy = http:\/\/10.10.1.20:8080\/ \nhttps_proxy = http:\/\/10.10.1.20:8080\/ \nftp_proxy = http:\/\/10.10.1.20:8080\/ <\/code><\/pre>\n\n\n\n<p>If you were experiencing connectivity issues as a result of Proxy settings required in your system, you should now be connected. The configurations given should work with any Proxy server and not specific to any type. Below we have links on Squid proxy installation. Feel free to check them out:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/computingforgeeks.com\/install-and-configure-squid-proxy-server-on-ubuntu\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Configure Squid Proxy Server on Ubuntu<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/install-and-configure-squid-proxy-on-centos-rhel-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Configure Squid Proxy on CentOS 8 \/ RHEL 8<\/a><\/li>\n\n\n\n<li><a style=\"font-family: Verdana, BlinkMacSystemFont, -apple-system, &quot;Segoe UI&quot;, Roboto, Oxygen, Ubuntu, Cantarell, &quot;Open Sans&quot;, &quot;Helvetica Neue&quot;, sans-serif;\" href=\"https:\/\/computingforgeeks.com\/how-to-setup-squid-proxy-server-on-ubuntu-centos\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to setup Squid proxy on Ubuntu \/ CentOS 7<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>A proxy server is a machine that sits in your network infrastructure with a purpose of translating traffic between networks or protocols. You can think of it as an intermediary server that separates the end-user clients from the destinations that they browse \/ need to access. There are quite some security features that you get &#8230; <a title=\"How To Set System Proxy on Debian 11\/10\/9\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/how-to-set-system-proxy-on-debian-linux\/\" aria-label=\"Read more about How To Set System Proxy on Debian 11\/10\/9\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":63888,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,299,50,75],"tags":[348,36202,36152],"class_list":["post-108078","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian","category-how-to","category-linux-tutorials","category-security","tag-proxy","tag-system-proxy","tag-system-proxy-on-debian"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/108078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=108078"}],"version-history":[{"count":0,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/108078\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/63888"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=108078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=108078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=108078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}