Setting up Ambari to use an Internet proxy server
To access public software repositories using the Internet, Ambari should use a proxy server.
If you plan to use public repositories (repositories available on the Internet) for installing Apache Ambari and deploying Hadoop components in your cluster, you must provide Ambari and the hosts in the cluster Internet access to obtain the software from those repositories. Specifically:
- Ambari Server: uses Internet access to validate the repositories.
- yum (or an equivalent, OS-specific package manager): performs the software installation from the repositories.
Therefore, if your environment requires use of an Internet proxy server for access, you must:
- Configure Ambari Server to use a proxy server.
- Configure yum on all cluster hosts to use that proxy server.
Ambari can install software if you have no Internet access. If you have no Internet access (via a proxy server or otherwise), you can use local repositories for installing the cluster software. In that case, configuring Ambari to use a proxy server is not required. However, Ambari and the hosts in the cluster must have access to your local repositories.
If the Ambari Server is behind a firewall, you must instruct the ambari-server setup command to use a proxy when downloading a JDK. To do so, define the http_proxy environment variable in the shell before running the setup command. For example:
export http\_proxy=http://{username}:{password}@{proxyHost}:{proxyPort}
ambari-server setup
where {username} and {password} are optional.
Defining a proxy server, username and password in /etc/yum.conf means all users of yum connect to the proxy server with those details. Please consult your system administrators and refer to your operating system documentation for more details on this configuration and possible alternatives.
Configure Ambari Server to use a Proxy Server
You can configure Ambari Server to access the Internet using a proxy server.
Procedure
- On the Ambari Server host, stop Ambari Server. ambari-server stop
- Add proxy settings to the following script: /var/lib/ambari-server/ambari-env.sh. -Dhttp.proxyHost=[YOUR_PROXY_HOST] -Dhttp.proxyPort=[YOUR_PROXY_PORT]
- Optionally, to prevent some host names from accessing the proxy server, define the list of excluded hosts. -Dhttp.nonProxyHosts=[pipe|separated|list|of|hosts]
- If your proxy server requires authentication, add the username and password. -Dhttp.proxyUser=[USER_NAME] -Dhttp.proxyPassword=[PASSWORD]
- Restart the Ambari Server to pick up this change. ambari-server restart
Configuring yum to use Internet proxy settings
You can set up a yum configuration file to use your proxy server.
About this task
Setting up yum to use a proxy server depends a lot on your environment and operating system. These instructions provide some guidance but we strongly recommend you consult with your system administrators and operating system documentation for assistance and specific instructions.
It is important to highlight that defining a proxy server, username and password in /etc/yum.conf means all users of yum connect to the proxy server with those details.
Procedure
- On each host in the cluster, specify the proxy settings in /etc/yum.conf by adding an entry such as: proxy=http://[YOUR_PROXY_HOST]:[YOUR_PROXY_PORT]
- If your proxy server requires authentication, add the username and password, as follows:
enableProxyAuth=1
proxy_username=[USER\_NAME]
proxy_password=[PASSWORD]
- Save the yum configuration file.