LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices

Reply
 
Search this Thread
Old 06-10-2005, 02:14 PM   #1
cpopham
LQ Newbie
 
Registered: Jun 2005
Location: wv
Posts: 4

Rep: Reputation: 0
Post New User question: Get hostname


I am very new to Linux. Just installed my first Mandriva Linux 10.1 OS. Now I want to install MySQL on it. I have used mysql on Windows XP. To use one peice of software that I use with mysql, I have to have to host name or IP address of the machine running MySql. We use DHCP, so everytime the machine boots, it gets a different IP so I can not rely on the IP address. In Windows, I can just click on control panel and then system and then Computer name which is also the hostname. How do I get the Hostname/Computer name in Madrake Linus 10.1???

Thank you for the help.

Chester
 
Old 06-10-2005, 02:33 PM   #2
kencaz
Senior Member
 
Registered: Mar 2005
Location: Las Vegas, NV
Distribution: Mandriva Slackware FreeBSD
Posts: 1,468

Rep: Reputation: 48
You can use:

hostname
uname -a

for Network info:
netstat -nr
ifconfig -a

Just a few ways to do it...

KC
 
Old 06-10-2005, 02:34 PM   #3
Feebles
LQ Newbie
 
Registered: Jul 2003
Location: Boulder, Colorado
Distribution: Mandrake
Posts: 16

Rep: Reputation: 0
Aloha,

If you just want the IP address of the machine you're on, use 'ifconfig <interface>' (most likely eth0). That will give you a whole slew of information, including the IP address. If you the need the hostname as well, you can use the command 'hostname' with various options. Type 'man hostname' for more info. Shout if that doesn't work for you.

-Feebles
 
Old 06-10-2005, 02:57 PM   #4
cpopham
LQ Newbie
 
Registered: Jun 2005
Location: wv
Posts: 4

Original Poster
Rep: Reputation: 0
Thank you for the help!!!

Chester
 
Old 06-12-2005, 11:56 PM   #5
mhearne
Member
 
Registered: Nov 2004
Location: Amarillo, TX
Distribution: Mandriva
Posts: 91

Rep: Reputation: 15
Simply typing "hostname" will give you your hostname.

Typing "hostname mercury.planet.net" (for example) will assign your hostname to 'mercury.planet.net'.

Placing all this in /etc/sysconfig/network makes it permanent. Here is mine:

NETWORKING=yes
DOMAINNAME=kc5yfl.net
HOSTNAME=proton.kc5yfl.net
FORWARD_IPV4=true

Note that this is my local network and it is not available on the Internet. However, you need to do this for your local network to make Apache and ftp work.

Don't forget your hosts file, /etc/hosts:

#127.0.0.1 localhost.localdomain localhost #sshd fails here.
127.0.0.1 proton.kc5yfl.net localhost
192.168.0.1 proton.kc5yfl.net proton
192.168.0.253 graviton.kc5yfl.net graviton
192.168.0.252 neutron.kc5yfl.net neutron
192.168.0.251 quark.kc5yfl.net quark
192.168.0.250 photon.kc5yfl.net photon
192.168.0.249 meson.kc5yfl.net meson
192.168.0.248 lepton.kc5yfl.net lepton

My other machines are named for atomic particles, but you can use the Table of Elements (common) or the Moons of the Solar System (I think there are 160 odd).

Try not to assign user names for machine names, or your users/passwords will start getting confused with your machine/domain names.

Each machine has to have a name, and then you must also name your network. And since you are a network, then .net is obvious.

HTH

Michael

Last edited by mhearne; 06-13-2005 at 12:10 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Hostname question GUIPenguin Linux - Networking 1 01-18-2005 09:59 PM
hostname question?? rnj Linux - Newbie 1 10-08-2004 08:09 AM
hostname question wendallsan Linux - Networking 4 10-16-2003 05:46 PM
Hostname Question darkfnord Linux - Newbie 1 09-04-2003 08:27 PM
hostname question (urgent) dincer80 Linux - Networking 11 07-31-2003 08:01 AM


All times are GMT -5. The time now is 03:19 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration