LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-12-2007, 11:00 PM   #1
harpoon45
LQ Newbie
 
Registered: Oct 2007
Posts: 17

Rep: Reputation: 0
localhost is empty


I have FC6: 2.6.18.8
When i run "echo $localhost"
i get an empty time.
I checked /etc/hosts and it has:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost localhost

How can I setup the localhost properly???
 
Old 12-12-2007, 11:05 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
I don't have $localhost set on my system either - that doesn't mean you have it set up wrongly. If you need the variable set for one of your applciations you can export it from (for example) ~/.bash_profile

If that's not what you meant - can you post more info about what you're trying to do please?

Last edited by gilead; 12-12-2007 at 11:07 PM.
 
Old 12-12-2007, 11:14 PM   #3
harpoon45
LQ Newbie
 
Registered: Oct 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by gilead View Post
I don't have $localhost set on my system either - that doesn't mean you have it set up wrongly. If you need the variable set for one of your applciations you can export it from (for example) ~/.bash_profile

If that's not what you meant - can you post more info about what you're trying to do please?
Thanks Gilead
I'm trying to run a ruby application and it fails. From what i read online it said that the problem might be because localhost isn't setup properly
and hence the question
 
Old 12-14-2007, 01:16 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
The entry you have in /etc/hosts is enough for communicating with the local host. As long as your ruby app is trying to access either localhost or 127.0.0.1 it should be fine - anything else will resolve as a remote host (unless you have DNS entries pointing back to that box). Are you getting a "getaddrinfo" error?
 
Old 12-14-2007, 02:09 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
You have not provided enough information. What is the intent of your application? socket programming, HTML etc.

localhost references the network local loopback adapter (lo) i.e. 127.0.0.1 on each TCP/IP computer. In a nutshell lo lets you run network server/client apps on the same computer. For example if running a webserver you can view the default page on the same computer by typing http://localhost in a web browser.
 
Old 12-14-2007, 03:50 PM   #6
SiegeX
Member
 
Registered: Jul 2004
Location: Silicon Valley, CA
Distribution: Slackware
Posts: 171

Rep: Reputation: 38
$localhost is a shell variable, this is not what you want. When you run a network-aware program such as ping,telnet,ssh etc and you provide a *hostname* rather than an IP address, i.e. ping localhost with no '$' in front, it will first try to look at /etc/hosts to see if there is an entry in there to see what the IP address is. If that hostname does not exist in /etc/hosts it will then do a DNS query to see if it can find out what the IP address is.

Last edited by SiegeX; 12-14-2007 at 03:53 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apache : localhost/ works localhost/index.html does not PhilA Linux - Server 4 05-27-2007 07:32 PM
MySQL: Why are there two roots localhost, and localhost.localdomain? paulsiu Linux - Server 6 04-18-2007 09:43 AM
Change mathieu@LOCALHOST (the localhost) frz Linux - Newbie 12 07-03-2006 08:04 PM
Message from syslogd@localhost localhost kernel: Disabling IRQ #21 ylts Linux - Hardware 0 02-26-2005 08:01 AM
Gentoo VNC, empty dialog box !! "Question" window is empty ! TheHushedCaskeT Linux - Software 0 02-01-2005 10:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration