Re: [CentOS] How to set hostname and domainnmae in CentOS 7?

2016-04-09 Thread Gregory P. Ennis
We can permanently set hostname using  hostnamectl set-hostname. How
can we
permanently set *domain name* in CentOS 7?
I found an article

that recommended setting FQDN using hostnamectl. Is that the right way
to
set hostname and domainname at the same time using *hostnamectl
set-hostname* command?

 Running *hostnamectl set-hostname* will set the hostname in*
/etc/hostname*
but it doesn't change */etc/hosts*. What's the proper way of adding
hostname and FQDN to */etc/hosts *in CentOS 7?

Thanks,

Joe
___

Joe,

I used the following command in the /etc/rc.d/rc.local file which is
used at boot time.

/bin/domainname Domain.com

Make sure you also use :

chmod +x /etc/rc.d/rc.local

to make sure the file is executable.

Greg



___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] How to set hostname and domainnmae in CentOS 7?

2016-04-06 Thread John R Pierce

On 4/6/2016 11:34 AM, James Hogarth wrote:

On 6 April 2016 at 15:45, Mark Haney  wrote:


>Not sure about everyone else, but I always put my hostname in /etc/hosts.
>Maybe that's from years of not always having DNS available back when the
>earth was cooling.
>
>

This behaviour plays havoc with templated VMs though or any time you can't
be sure the IP there will be correct ...


indeed, most all my servers except a few key infrastructure servers are 
configured with DHCP reservations.




--
john r pierce, recycling bits in santa cruz

___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] How to set hostname and domainnmae in CentOS 7?

2016-04-06 Thread James Hogarth
On 6 April 2016 at 15:45, Mark Haney  wrote:

> Not sure about everyone else, but I always put my hostname in /etc/hosts.
> Maybe that's from years of not always having DNS available back when the
> earth was cooling.
>
>
This behaviour plays havoc with templated VMs though or any time you can't
be sure the IP there will be correct ...

At which point you start having to script fixing it etc or weird things
happen.

I can't recall if it hit EL7 yet but Fedora has nss-myhostname so it'll
probably arrive in EL7 eventually to ensure the local hostname is always
resolvable to the system IP if it exists or at least   127.0.0.2 so stuff
relying on gethostname() doesn't have issues and  the older /etc/hosts
shenanigans are not required.
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] How to set hostname and domainnmae in CentOS 7?

2016-04-06 Thread Mark Haney
Not sure about everyone else, but I always put my hostname in /etc/hosts.
Maybe that's from years of not always having DNS available back when the
earth was cooling.


On Apr 5, 2016 16:30, "James Hogarth"  wrote:

> On 5 April 2016 at 20:24, Joe Smithian  wrote:
>
> > We can permanently set hostname using  hostnamectl set-hostname. How can
> we
> > permanently set *domain name* in CentOS 7?
> > I found an article
> > <
> >
> http://unix.stackexchange.com/questions/239920/how-to-set-the-fully-qualified-hostname-on-centos-7-0
> > >
> > that recommended setting FQDN using hostnamectl. Is that the right way to
> > set hostname and domainname at the same time using *hostnamectl
> > set-hostname* command?
> >
> >  Running *hostnamectl set-hostname* will set the hostname in*
> > /etc/hostname*
> > but it doesn't change */etc/hosts*. What's the proper way of adding
> > hostname and FQDN to */etc/hosts *in CentOS 7?
> >
> >
> Technically speaking one shouldn't put the hostname in /etc/hosts as it's
> not required so long as your DNS is working ... which it should be ...
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos
>
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] How to set hostname and domainnmae in CentOS 7?

2016-04-05 Thread James Hogarth
On 5 April 2016 at 20:24, Joe Smithian  wrote:

> We can permanently set hostname using  hostnamectl set-hostname. How can we
> permanently set *domain name* in CentOS 7?
> I found an article
> <
> http://unix.stackexchange.com/questions/239920/how-to-set-the-fully-qualified-hostname-on-centos-7-0
> >
> that recommended setting FQDN using hostnamectl. Is that the right way to
> set hostname and domainname at the same time using *hostnamectl
> set-hostname* command?
>
>  Running *hostnamectl set-hostname* will set the hostname in*
> /etc/hostname*
> but it doesn't change */etc/hosts*. What's the proper way of adding
> hostname and FQDN to */etc/hosts *in CentOS 7?
>
>
Technically speaking one shouldn't put the hostname in /etc/hosts as it's
not required so long as your DNS is working ... which it should be ...
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] How to set hostname and domainnmae in CentOS 7?

2016-04-05 Thread Mark Haney
vi or your text editor of choice. Though there should be a 'domainname'
command to set it as well, though I just prefer editing /etc/hosts directly.



On Tue, Apr 5, 2016 at 3:24 PM, Joe Smithian  wrote:

> We can permanently set hostname using  hostnamectl set-hostname. How can we
> permanently set *domain name* in CentOS 7?
> I found an article
> <
> http://unix.stackexchange.com/questions/239920/how-to-set-the-fully-qualified-hostname-on-centos-7-0
> >
> that recommended setting FQDN using hostnamectl. Is that the right way to
> set hostname and domainname at the same time using *hostnamectl
> set-hostname* command?
>
>  Running *hostnamectl set-hostname* will set the hostname in*
> /etc/hostname*
> but it doesn't change */etc/hosts*. What's the proper way of adding
> hostname and FQDN to */etc/hosts *in CentOS 7?
>
> Thanks,
>
> Joe
> ___
> CentOS mailing list
> CentOS@centos.org
> https://lists.centos.org/mailman/listinfo/centos
>



-- 

Mark Haney ::: Senior Systems Engineer
*VIF* *International Education*
P.O. Box 3566 ::: Chapel Hill, N.C. 27515 ::: USA
919-265-5006 office

Global learning for all.
www.viflearn.com
Find VIF on Facebook  |
Twitter  | LinkedIn


Recognized as a ‘Best for the World’
 B Corp!
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos


[CentOS] How to set hostname and domainnmae in CentOS 7?

2016-04-05 Thread Joe Smithian
We can permanently set hostname using  hostnamectl set-hostname. How can we
permanently set *domain name* in CentOS 7?
I found an article

that recommended setting FQDN using hostnamectl. Is that the right way to
set hostname and domainname at the same time using *hostnamectl
set-hostname* command?

 Running *hostnamectl set-hostname* will set the hostname in* /etc/hostname*
but it doesn't change */etc/hosts*. What's the proper way of adding
hostname and FQDN to */etc/hosts *in CentOS 7?

Thanks,

Joe
___
CentOS mailing list
CentOS@centos.org
https://lists.centos.org/mailman/listinfo/centos