{"id":484,"date":"2016-07-28T05:54:56","date_gmt":"2016-07-28T05:54:56","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2016\/07\/28\/setting-the-proxy-configuratin-in-linux-and-windows\/"},"modified":"2018-09-25T08:56:25","modified_gmt":"2018-09-25T08:56:25","slug":"setting-the-proxy-configuratin-in-linux-and-windows","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/setting-the-proxy-configuratin-in-linux-and-windows\/","title":{"rendered":"How to Set or Configure Proxy in Linux and Windows System? &#8211; scmGalaxy"},"content":{"rendered":"<div><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3044 size-full\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2016\/07\/proxy-configuration-in-linu.png\" alt=\"proxy-configuration-in-linux-and-windows\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2016\/07\/proxy-configuration-in-linu.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2016\/07\/proxy-configuration-in-linu-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/div>\n<div><\/div>\n<div><strong>Setting the proxy configuration in Linux and Windows<\/strong><\/div>\n<div><\/div>\n<div>If you use a proxy server or firewall, you may need to set the http_proxy environment variable in order to access some url from command-line.<\/div>\n<div><\/div>\n<div><strong>Windows Command line<\/strong><\/div>\n<div>set http_proxy=http:\/\/your_proxy:your_port<\/div>\n<div>set http_proxy=http:\/\/username:password@your_proxy:your_port<\/div>\n<div>set https_proxy=https:\/\/your_proxy:your_port<\/div>\n<div>set https_proxy=https:\/\/username:password@your_proxy:your_port<\/div>\n<div><\/div>\n<div><strong>Windows GUI<\/strong><\/div>\n<div>1. Open the Control Panel and click the System icon.The System Properties dialog is displayed.<\/div>\n<div>2. On the Advanced tab, click on Environment Variables. The Environment Variables dialog is displayed.<\/div>\n<div>3. Click New in the System variables panel. The New Sytem Variable dialog is displayed.<\/div>\n<div>4. Add http_proxy with the appropriate proxy information<\/div>\n<div><\/div>\n<div><strong>Windows Registry<\/strong><\/div>\n<div>IE can set username and password proxies, so maybe setting it there and import does work<\/div>\n<div><\/div>\n<div>reg add &#8220;HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings&#8221; \/v ProxyEnable \/t REG_DWORD \/d 1<\/div>\n<div>reg add &#8220;HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings&#8221; \/v ProxyServer \/t REG_SZ \/d name:port<\/div>\n<div>reg add &#8220;HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings&#8221; \/v ProxyUser \/t REG_SZ \/d username<\/div>\n<div>reg add &#8220;HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings&#8221; \/v ProxyPass \/t REG_SZ \/d password<\/div>\n<div>netsh winhttp import proxy source=ie<\/div>\n<div><\/div>\n<div><strong>Command to enable proxy usage:<\/strong><\/div>\n<div>reg add &#8220;HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings&#8221; \/v ProxyEnable \/t REG_DWORD \/d 1 \/f<\/div>\n<div><\/div>\n<div><strong>Command to disable proxy usage:<\/strong><\/div>\n<div>reg add &#8220;HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings&#8221; \/v ProxyEnable \/t REG_DWORD \/d 0 \/f<\/div>\n<div><\/div>\n<div><strong>Command to change the proxy address:<\/strong><\/div>\n<div>reg add &#8220;HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings&#8221; \/v ProxyServer \/t REG_SZ \/d proxyserveraddress:proxyport \/f<\/div>\n<div><\/div>\n<div><strong>Linux\u00a0<\/strong><\/div>\n<div>export http_proxy=http:\/\/your_proxy:your_port<\/div>\n<div>export http_proxy=http:\/\/username:password@your_proxy:your_port<\/div>\n<div>export https_proxy=https:\/\/your_proxy:your_port<\/div>\n<div>export https_proxy=https:\/\/username:password@your_proxy:your_port<\/div>\n<div>export https_proxy=https:\/\/%username%:%password%@your_proxy:your_port<\/div>\n<div><\/div>\n<div><strong>FAQ<\/strong><\/div>\n<div>1. How to escape if password has a @ character<\/div>\n<div>Ans &#8211; try %40 instead of @<\/div>\n<div><\/div>\n<div>2. What is the file name where it stroed the proxy in Ubantu<\/div>\n<div>Ans &#8211; \/etc\/environment<\/div>\n<div><\/div>\n<div>3. How to set proxy inforamtin in Apt?<\/div>\n<div>Ans &#8211; Adding following line to \/etc\/apt\/apt.conf has solved the problem:<\/div>\n<div>Acquire::http::proxy &#8220;http:\/\/10.1.3.1:8080\/&#8221;;<\/div>\n<div>If file does not exist, create it. Do not confuse it with apt.conf.d directory.<\/div>\n<div><\/div>\n<div>4. How to set proxy inforamtin in linux Profile?<\/div>\n<div><\/div>\n<div>5. Why manual export failed to affect apt-get with the proxy info?<\/div>\n<div>Ans &#8211; The reason your manual export failed to affect apt-get is because sudo ignores that environment variable by default (i.e. it doesn&#8217;t pass it on to the command). For one-off runs, you could do sudo env http_proxy=http:\/\/10.1.3.1:8080 apt-get update. Otherwise, you could configure sudo to allow http_proxy to fall through.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Setting the proxy configuration in Linux and Windows If you use a proxy server or firewall, you may need to set the http_proxy environment variable in order to access some&#8230; <\/p>\n","protected":false},"author":1,"featured_media":3044,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[4957],"tags":[254,545,1163,1164,1161,1162,460,379,1159,1165,1166,1160,1158,182],"class_list":["post-484","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-configure","tag-how","tag-how-to-configure-proxy-in-linux","tag-how-to-configure-proxy-in-windows","tag-how-to-set-proxy-in-linux","tag-how-to-set-proxy-in-windows","tag-linux","tag-proxy","tag-proxy-configuration","tag-proxy-configuration-in-linux","tag-proxy-configuration-in-windows","tag-proxy-setting","tag-set","tag-windows"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/484","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=484"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/484\/revisions"}],"predecessor-version":[{"id":3262,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/484\/revisions\/3262"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/3044"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}