If our CentOS server is behind a proxy we will have to configure it to access the internet, we will enable the HTTP and HTTPS ports. It is possible that our CentOS on a regular basis does not have to have internet access but for some tasks such as installing or updating through YUM it will not be necessary.

The server must be able to connect to the Internet, either by any of the usual protocols, that is, http, https and ftp. You should also be able to download files successfully using the wget command.

Configure Proxy on CentOS

We will modify several files, which are the following:

/etc/yum.conf

From where you can add parameters for the use of this command.

/etc/profile.d/proxy.sh

The file dedicated to general environment variables. Its usage is the same as / etc / environement of Debian.

/home/usuario/.bashrc

This file contains the terminal configuration.

/ etc / wgetrc

Configuration file for the wget command.

First thing first we need to add the following lines to the /etc/yum.conf file.

▸We indicate address plus proxy port

proxy = http: //domain.o.IP: port

▸proxy_username = user-yum

proxy_password = password

The same with the /etc/profile.d/proxy.sh file:

▸http_proxy = http: /domain.o.IP: port

▸https_proxy = http: //domain.o.IP: port

ftp_proxy=http://dominio.o.IP:puerto

We modify the file /home/usuario/.bashrc

http_proxy = http: /domain.o.IP: port

https_proxy = http: //domain.o.IP: port

ftp_proxy = http: //domain.o.IP: port

for the wget command to work correctly we have to modify the / etc / wgetrc file

The following lines must be edited:

You can set the default proxies for Wget to use for http, https, and ftp.

They will override the value in the environment.

https_proxy = http://proxy.yoyodyne.com:18023/

http_proxy = http://proxy.yoyodyne.com:18023/

ftp_proxy = http://proxy.yoyodyne.com:18023/

And instead add our IP and port settings.

If our proxy has authentication we must also uncomment and modify the following lines:

http_proxy = http: //proxy.domain.extension: 8080 /

proxy_user = user

proxy_password = password

And that’s it, our Proxy is ready for CentOS.


Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *