Close Menu
    Facebook X (Twitter) Instagram
    • Articles
    • How it Works
    • Our Story
    • Contact Us
    Facebook X (Twitter) Instagram Pinterest Vimeo
    IT Beginner
    • Home
    • Blog
      • Happiness
      • Productivity
      • Leadership
    • About us
    • Contact us
    IT Beginner
    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
    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
    • Productivity
    • Leadership

    No posts

    No posts

    Subscribe to Newsletter
    Our Socials
    • Instagram
    • Facebook
    • Twitter
    • YouTube
    • LinkedIn

    Archives

    • April 2025
    • May 2024
    • March 2023
    • July 2022
    • March 2022
    • July 2020
    • January 2019
    • August 2018
    • July 2018
    • August 2017
    • July 2017
    • September 2016

    Categories

    • Business
    • CCNA 1 Instructor Materials
    • CentOS
    • Database
    • Debian
    • Fedora
    • Firefox
    • Happiness
    • Hardware
    • ICND1 Labs
    • ICND2 Labs
    • Leadership
    • Linux Essentials
    • Linux Mint
    • Marketing
    • My SQL
    • Netflix
    • Networking
    • Productivity
    • Resources
    • Security
    • SEO
    • Server
    • Social Media
    • Software
    • Tips – Tricks
    • Ubuntu
    • Uncategorized
    • User Experience
    • WordPress
    • Xubuntu

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna accumsan in scelerisque.

    Facebook X (Twitter) Instagram Pinterest

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

    wpDiscuz