Update Centos 6.5/6.4 Behind Proxy – Solved

Today i was struggling with CentOS yum updating behind a proxy in my Office. The proxy server is Windows 2003 with authentication (Domain\user\password). I referred many google solutions and none of them help. Finally i found a solution to fix this issue and i wanted to share it with our Unixmen valuable readers. Here you go!

I tried the following methods suggested by various resources to update my CentOS 6.5 server behind a proxy, but i can’t make it.

1. In System -> Preferences -> Network Proxy -> Manual proxy configuration and in Details “Use authentication”.

2. In Firefox, settings -> Advanced -> Network -> Connection settings -> Use system proxy settings

3. In /etc/yum.conf file , i added the following:

proxy=http://proxy.intern.de:port/
proxy_username=my_username
proxy_password=my_passwd
http_proxy="http://my_username:my_passwd@proxy.intern.de:port"
export http_proxy="http://my_username:my_passwd@proxy.intern.de:port"

I tried all the above mentioned methods in CentOS 6.4 server, but still i can’t update the system. Here is my output error:

# yum update
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: centos.mirror.transip.nl
* c6-media:
* extras: archive.cs.uu.nl
* updates: archive.cs.uu.nl
http://centos.mirror.transip.nl/6.4/os/i386/repodata/repomd.xml: [Errno 12] Timeout on http://centos.mirror.transip.nl/6.4/os/i386/repodata/repomd.xml: (28, 'connect() timed out!')
Trying other mirror.

So what to do now?

Here comes cntlm.

Cntlm is a NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy intended to help you break free from the chains of Microsoft proprietary world. You can use a free OS and honor our noble idea, but you can’t hide. Once you’re behind those cold steel bars of a corporate proxy server requiring NTLM authentication, you’re done with. The same even applies to 3rd party Windows applications, which don’t support NTLM natively.

Installing Cntlm

Download the latest version from http://sourceforge.net/projects/cntlm/files/cntlm/.

In my case, i downloaded cntlm-0.92.3-1.i386.rpm file.

Install it with:

# rpm  -ivh cntlm-0.92.3-1.i386.rpm

Now edit the /etc/cntlm.conf file as shown below.

Username userx
Domain domainX
Password passwordx

Proxy proxy-server:port 
Listen 3128
NoProxy         localhost, 127.0.0.*, 10.*, 192.168.*

Restart cntlmd daemon

# /etc/init.d/cntlmd restart
 Shutting down CNTLM Authentication Proxy: [ OK ]
 Starting CNTLM Authentication Proxy: [ OK ]

Check if the daemon Listening 

# netstat -an | grep 3128
tcp 0 0 127.0.0.1:3128 0.0.0.0:* LISTEN

Auto start the service with command:

# chkconfig cntlmd on

And the following line in /etc/yum.conf file as shown below.

proxy=http://127.0.0.1:3128

Or add in /etc/profile so that it will be enabled on every boot:

export http_proxy= http://127.0.0.1:3128/

Now try to update again :

# yum clean  all
# yum install pidgin
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base: centos.crazyfrogs.org
 * extras: centos.crazyfrogs.org
 * updates: centos.crazyfrogs.org
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package pidgin.i686 0:2.7.9-10.el6_4.1 will be installed
--> Processing Dependency: libpurple = 2.7.9-10.el6_4.1 for package: pidgin-2.7.9-10.el6_4.1.i686
--> Processing Dependency: libpurple.so.0 for package: pidgin-2.7.9-10.el6_4.1.i686
--> Processing Dependency: libgstfarsight-0.10.so.0 for package: pidgin-2.7.9-10.el6_4.1.i686
--> Running transaction check
---> Package farsight2.i686 0:0.0.16-1.1.el6 will be installed
--> Processing Dependency: libnice.so.0 for package: farsight2-0.0.16-1.1.el6.i686
--> Processing Dependency: libgupnp-igd-1.0.so.2 for package: farsight2-0.0.16-1.1.el6.i686
--> Processing Dependency: libgupnp-1.0.so.3 for package: farsight2-0.0.16-1.1.el6.i686
--> Processing Dependency: libgssdp-1.0.so.2 for package: farsight2-0.0.16-1.1.el6.i686
---> Package libpurple.i686 0:2.7.9-10.el6_4.1 will be installed

Enjoy!! It should work now.