• \[SOLVED\]/etc/hosts file configuration


    Hi,

    I was installing Java EE development kit which hangs at one particular steps. I think this problem is related to /etc/hosts file. I may not have configured /etc/hosts file correctly. I use network switch to share internet connection in more than one PC. For that I have setup IP address manually. My router has IP address 192.168.1.1 . My Antergos linux has IP Address which I have setup through NetworkManager applet is 192.168.1.2, NetMask 255.255.255.0 Gateway is 192.168.1.1 with DNS servers 208.67.222.222, 208.67.220.220 . This all I have setup through NetworkManager applet. My /etc/hosts file has following configuration.

    \#  
    \# /etc/hosts: static lookup table for host names  
    \#  
      
    \#<ip-address\> <hostname.domain.org\> <hostname\>  
    127.0.0.1 localhost.localdomain localhost  
    ::1 localhost.localdomain localhost  
      
    \# End of file  
    
    

    I think something is wrong here.

    [code:o4c2dtxu]hostname[/code:o4c2dtxu]

    command gives following output

    mainhost

    Do I need to add 192.168.1.2 IP address in /etc/hostname?

  • Hi,

    I was installing Java EE development kit which hangs at one particular steps. I think this problem is related to /etc/hosts file. I may not have configured /etc/hosts file correctly. I use network switch to share internet connection in more than one PC. For that I have setup IP address manually. My router has IP address 192.168.1.1 . My Antergos linux has IP Address which I have setup through NetworkManager applet is 192.168.1.2, NetMask 255.255.255.0 Gateway is 192.168.1.1 with DNS servers 208.67.222.222, 208.67.220.220 . This all I have setup through NetworkManager applet. My /etc/hosts file has following configuration.

    \#  
    \# /etc/hosts: static lookup table for host names  
    \#  
      
    \#<ip-address\> <hostname.domain.org\> <hostname\>  
    127.0.0.1 localhost.localdomain localhost  
    ::1 localhost.localdomain localhost  
      
    \# End of file  
    
    

    I think something is wrong here.

    [code:o4c2dtxu]hostname[/code:o4c2dtxu]

    command gives following output

    mainhost

    Do I need to add 192.168.1.2 IP address in /etc/hostname?

  • What exactly is your problem with JDK?

    Please give a feedback after you get help so the thread can be set to solved.

  • It’s not problem with JDK. It is problem with installation of JEE 7 SDK. Installatin hangs at the point where it creates domain. I have workaround for it, that is not an issue. But I want to check if my /etc/hosts is correct or do I need to add my IP address in it with hostname.

  • HI,

    YOur hosts file looks correct. The output of the hostname command will be whatever you set your computer name to be during installation.

    Cheers!

  • Like Dustin said,

    your hosts file is correct by default and you don’t need to add any IP addresses relating to your network.

    Please give a feedback after you get help so the thread can be set to solved.

  • ok, thanks.

  • ok my /etc/hosts file was not correct.

    Here is correct /etc/hosts

      
    \#  
    \# /etc/hosts: static lookup table for host names  
    \#  
      
    \#<ip-address\> <hostname.domain.org\> <hostname\>  
    127.0.0.1 localhost.localdomain localhost mainhost  
    ::1 localhost.localdomain localhost  
      
    \# End of file  
    
    

    Because it was giving problem to me while starting Glassfish server saying port 4848 is already in use when it was not. Then I corrected my /etc/hosts and glassfish server started without any error.

    reference [url:1rnqbsav]http://stackoverflow.com/questions/7391466/unable-to-start-glassfish-3-1-even-though-port-not-occupied[/url:1rnqbsav]

  • I’m glad it’s working now.
    You talked about writing your IP adress into the hosts file. And this is not necessary.
    If you answered my question with “glassfish”:
    @“b1n0ry”:3q8jpyy4 said:

    What exactly is your problem with JDK?[/quote:3q8jpyy4]

    I would’ve told you that you have to write your hostname into the hosts file

    Please give a feedback after you get help so the thread can be set to solved.

  • It was not problem with JDK anyway. JEE SDK includes [email protected]“cb9”:3uq3gdsa said:

    It’s not problem with JDK. It is problem with installation of JEE 7 SDK. Installatin hangs at the point where it creates domain. I have workaround for it, that is not an issue. But I want to check if my /etc/hosts is correct or do I need to add my IP address in it with hostname.[/quote:3uq3gdsa]
    When I said installation hangs at a place where it creates domain, it actually means Glassfish is creating domain. About adding IP address, I have faced this problem before, but I did not remember if I added IP address or hostname in /etc/hosts file. Anyway I will not forget now.

  • Just to be clear, your host file was correct. It appears glassfish requires the change you made. I’m not familiar with glassfish, unfortunately. In any case, glad to see this is resolved. Thanks for providing your solution for other users to benefit

    Cheers!

Posts 11Views 1986
Log in to reply