Article

Table of Contents
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $300 by adding new articles!

Change Hostname on FreeBSD

Last Updated: Fri, May 29, 2020
BSD Best Practices System Admin

Supported Versions

This guide applies to FreeBSD 12 and earlier.

Introduction

When creating a new Vultr VPS, you can set the Server Hostname before deployment. If you skip this step or decide to rename your server later, you'll discover that changing the server hostname from the Customer Portal also performs a fresh reinstall of the entire server.

Change Hostname Example Screenshot

Follow this guide if you need to change the server hostname without reinstalling.

Examples

This guide uses olddog for the old hostname and newtricks for the new hostname.

1. Check the Current Hostname

Check the hostname with hostname.

$ hostname
olddog

2. Change Hostname

Change the hostname to newtricks using a text editor:

  1. Change all occurrences of the old server name to the new server name in /etc/rc.conf.
  2. Change all occurrences of the old server name to the new server name in /etc/hosts.

3. Confirm the Change

  1. Reboot the server.
  2. Test your change with hostname.

    $ hostname
    newtricks
    

Update DNS

Your server hostname is changed and ready to use. This procedure does not change your DNS name, and you'll need to perform those steps at your domain registrar.

Want to contribute?

You could earn up to $300 by adding new articles