Search code examples
javaazurerhel7

Can't access third party repo using yum in Azure RHEL node


We have provisioned a RHEL server from Azure. I understand that our infrastructure guys are a bit strict on access.

We need to install Oracle JDK in this machine and it looks like wget is not an option on getting rpms, only yum. However, I need to enable Third-party repo like Oracle in order to yum install a JDK, so I issued this command:

subscription-manager repos --enable rhel-7-server-thirdparty-oracle-java-rpms

and I get

Network error, unable to connect to server. Please see /var/log/rhsm/rhsm.log for more information

When I do yum update and yum install telnet, it seems to do its job.

My question is, do I have an alternative in getting JDK installed? For those who are knowledgeable about Azure and networking configuration, what specific request should we ask from our infrastructure people to enable "download"?


Solution

  • Per my experience, i think the issue may be caused by the VM network. But, this has not problems when you run yum update. So i suggest that you can run ping www.microsoft.com in the VM terminal to inspect whether your VM can connect to extranet.

    For your first question, we can use an alternative method to install oracle JDK on RHEL.

    1.You could download the Oracle JDK(.tar.gz) from Oracle official website just as below.
    http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html 
    

    2.You could upload JDK package which you have downloaded to your Azure VM directory by ftp tools like FileZilla.

    description image

    3.You could use SecureCRT to connect to Azure VM.

    description image

    4. Install java with alternatives.

         #cd /home/johnny
         #tar -zxf jdk-7u79-linux-x64.tar.gz -C /opt/    
         #cd /opt/jdk1.7.0_79/
         #alternatives --install /usr/bin/java java /opt/jdk1.7.0_79/bin/java 2
         #alternatives --config java
         the output may be below:
    

    description image.

    you could input 1 to continue.

    5.Now, you may also require to set up javac and jar commands path using alternative commands.

         #alternatives --install /usr/bin/jar jar /opt/jdk1.7.0_79/bin/jar 2
         #alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_79/bin/javac 2
         #alternatives --set jar /opt/jdk1.7.0_79/bin/jar
         #alternatives --set javac /opt/jdk1.7.0_79/bin/javac
    

    6. Check installed java version.

         #java -version
    

    description image

    7.Configuring environment variables.

          Setup JAVA HOME variable:
          #export JAVA_HOME= /opt/jdk1.7.0_79
          Setup JRE HOME variable:
          #export JRE_HOME=/opt/jdk1.7.0_79/jre
          Setup PATH variable:
          #export PATH=$PATH:/opt/jdk1.7.0_79/bin:/opt/jdk1.7.0_79/jre/bin
    
          There is another method to config environment variables.
          Modify the config file: /etc/profile. In this method, anyone who has logged in can use java.
    

    description image

    8.The refference:

    http://tecadmin.net/steps-to-install-java-on-centos-5-6-or-rhel-5-6/#

    For your second question, you can ask some problems about azure network config.

    Hope it helps. Any concerns, please feel free to let me know.