Some tips on CentOS

Santosh

2013/04/20

Categories: Linux Tags: Configuring yum Installing package on CentOS tips on CentOS Using yum with a Proxy Server

Today I tried CentOS for first time. As a newbie I struggled with it for quite some time. This struggle left me with some of the learning. I thought of sharing that learning here with all.

Installing package on CentOS:

You can install any package from repositories by typing

yum install package_name

You will need root privileges to install the packages.

Installing GCC:

For installing GCC compiler type

yum install gcc

Installing G++:

For installing GNU C++ compiler type

yum install gcc-c++

Configuring yum:

I tried to follow above commands for installing package but got following error.

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"

By searching over Google, I came to know that this is something to do with nameservers. To configure your name servers you can edit resolv.conf file. Type

gedit /etc/resolv.conf

and add following lines before other nameserver entries.

nameserver 8.8.8.8
nameserver 8.8.4.4

This will set the nameservers to Google nameservers, which might help in resolving the issue.

Using yum with a Proxy Server

But, it too didn’t resolve the issue for me. After some time, I realized that I was using a proxy server to connect to internet. So I need to makeyum get trough the proxy server. To do so you need to make entries for proxy server in your /etc/yum.conf file. Enter following lines:

# The proxy server - proxy server:port number 
proxy=http://mycache.mydomain.com:3128 
# The account details for yum connections 
proxy_username=yum-user 
proxy_password=qwerty

After completing this, I was able to install the packages using yum. I will discuss more explorations in next article.