Close Menu
    Facebook X (Twitter) Instagram
    • Download Cisco Packet Tracer
    Facebook X (Twitter) Instagram Pinterest Vimeo
    IT Beginner
    • Home
    • Server
    • WordPress
    IT Beginner
    Home»CentOS»How to change hostname on centos
    CentOS

    How to change hostname on centos

    17/07/2017Updated:19/07/2017No Comments1 Min Read

    To change hostname in centos, here is how to do

    Temporary hostname change (this will be reseted after reboot)
    hostname newhostname

    Permanent hostname change
    nano /etc/sysconfig/network

    This is from one of my vps

    NETWORKING=”yes”
    GATEWAYDEV=”venet0″
    NETWORKING_IPV6=”yes”
    IPV6INT=”no”
    IPV6_DEFAULTDEV=”venet0″
    HOSTNAME=”namhuy.org”

    Change hosts file
    Change the host that is related to your main IPaddress for your server, this is for internal networking
    nano /etc/hosts

    127.0.0.1 localhost.localdomain localhost localhost4.localdomain4 localhost4
    # Auto-generated hostname. Please do not remove this comment.
    xxx.xxx.xxx.xxx namhuy.org namhuy
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

    After saving the file, you should restart network service
    service network restart
    or
    /etc/init.d/network restart

    Check your hostname again to make sure it has been update
    hostname.

    centos hostname hosts
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleImport/Export Big MYSQL Database
    Next Article Kill All Processes PIDS For a Single User

    Related Posts

    CentOS

    How to install vsftpd on centos 6

    03/08/2017
    CentOS

    How To Install WordPress with nginx on Centos 6

    02/08/2017
    CentOS

    How to install OpenVPN Access Server OpenVPN-AS on CentOS 6

    29/07/2017
    Subscribe
    Notify of
    guest

    guest

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    0 Comments
    Oldest
    Newest Most Voted
    Inline Feedbacks
    View all comments
    Tags
    apache centos Centos 6 cuda Desktop Environment dual boot environment featured gnome GUI hostname hosts intel kernel kill lamp server lemp server life MariaDB netflix nginx nvidia password php-fpm phpmyadmin pids processes s.m.a.r.t Security session solid state drive ssd ssh ssh server tag 1 tag 2 Ubuntu upgrade varnish VirtualBox VNC Server web server window manager wordpress xfce
    Facebook X (Twitter) Instagram Pinterest

    Type above and press Enter to search. Press Esc to cancel.

    wpDiscuz