LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-28-2011, 10:33 AM   #1
joeldavis
LQ Newbie
 
Registered: Mar 2011
Posts: 28

Rep: Reputation: 1
Setting hostname for install


Coming from a regular syslinux prompt is there any way to set the node's hostname? Basically I'm trying to start an install and the syslog= parameter needs to have the hostname set. It doesn't look like it's getting set by DHCP.
 
Old 04-29-2011, 03:17 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,260

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
Put 'hostname = $HOSTNAME' somewhere? Usually /etc/hostname has it.
 
Old 04-29-2011, 03:21 AM   #3
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Hi,

In /etc/rc.conf you should have an entry called "hostname" - you can edit the entry there.

Alternatevely, use hostname

Quote:
hostname newbox
There's more info here and there ...

Thor
 
Old 04-29-2011, 03:27 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

It depends also on the distro you use. In RHEL for example I set it in /etc/sysconfig/network, neither of the above mentioned files exist in RHEL5.5. In Debian you can use the /etc/hostname file but /etc/rc.conf doesn't exist. And so on...

In future when asking a question please provide us with information about the distro you're using so that more fine-grained solutions can be offered.

Kind regards,

Eric
 
Old 04-29-2011, 11:50 AM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,974

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
I have been trying to figure out the deal here. syslog ought to be started before networking so it really can't have any hostname. (I could be wrong) Further why would one need to have it at syslog creation time?

DHCP does have an option I believe to send a hostname but only if the server is set and known to work but it also requires that the boot process be kind of far along. Unless you are pxe booting then that is a whole different ball of wax.
 
Old 04-30-2011, 09:35 AM   #6
joeldavis
LQ Newbie
 
Registered: Mar 2011
Posts: 28

Original Poster
Rep: Reputation: 1
Thanks for the replies, is it possible to access the command prompt edit the sysconfig and "service network restart" to set the hostname to whatever it needs to be during a fresh install? I tried the ALT-F1-7 thing but all I got were some blank screens and two buffers of some sort (one of which looks like the syslog). Basically the use case is large deployment with kickstarts on plenty of machines taking care of it with %pre, but some machines have to be manually installed but the install is being remotely monitored by a single group of people and they need to be able to differentiate between this manual install and that manual install.


- Joel
 
Old 04-30-2011, 10:53 AM   #7
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

On RedHat (and most likely on other distros too, if not on all), after setting the hostname in the necessary file(s), you can just run:
Code:
hostname <yourhostname>
Then logout and the hostname is set. No need to reboot if the only reason is to set the hostname. Try to see if it works.

Kind regards,

Eric
 
Old 04-30-2011, 10:58 AM   #8
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi again,

Sorry, after reading your last post I noticed you're referring to the installation process, so disregard my previous post. That only works when you have your system installed. But you mentioned kickstart, why don't you set the hostname from within kickstart? I use it like this:
Code:
network --device eth0 --bootproto static --ip 10.95.98.1 --netmask 255.255.255.0 --gateway 4.4.4.4 --nameserver 8.8.8.8 --hostname origin.domain.net
With that line at the install part of kickstart, that is before %pre you can set your complete network environment.

Just found this on the Internet on how to ask user input from the %post section of kickstart. Perhaps you can use that to ask for the hostname and then change the necessary files on the system. Since it's in %post it will work and on reboot after installation your hostname will be set:
Quote:
This is the workaround. If you sent the questions you want to ask to tty6 you can fill them in. In tty1 to tty4 runs bussybox so you won't be able to get the user input. When you press enter in tty1 to tty4 he will activate the console and will not understand the input.
Code:
%post
exec < /dev/tty6 > /dev/tty6
chvt 6
clear
echo "################################"
echo "# Running Post Configuration   #"
echo "################################"
your commands
###Go back to tty1##
exec < /dev/tty1 > /dev/tty1
chvt 1
Haven't tried the above yet so it's up to you for testing. Please let us know if it works out.

Kind regards,

Eric

Last edited by EricTRA; 04-30-2011 at 11:02 AM. Reason: Possible solution
 
  


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
FC13 install can ping by hostname, ssh by hostname fails jeffk42 Linux - Networking 4 11-14-2011 11:27 AM
Changed hostname during install, now CUPS has wrong hostname on web interface slinx Linux - Software 1 08-07-2009 08:01 PM
Fresh Install Freezes on Setting Hostname nonothing Linux - Networking 3 12-11-2004 02:26 PM
setting hostname skunk1 Solaris / OpenSolaris 3 04-02-2003 01:00 AM
setting up a hostname sakeeb Linux - Networking 3 04-28-2002 04:37 AM

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

All times are GMT -5. The time now is 01:54 PM.

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