Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(update hostname): update guide for changeing the hostname of an instance #7651

Merged
merged 7 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'Hostname einer Public Cloud Instanz ändern'
excerpt: 'So ändern Sie den Hostnamen einer Public Cloud Instanz'
updated: 2018-09-18
excerpt: 'Erfahren Sie hier, wie Sie den Hostnamen einer Public Cloud Instanz bearbeiten'
updated: 2025-03-20
---

## Ziel
Expand All @@ -14,22 +14,35 @@ Mit dem *cloud-init* Modul können Sie Ihre [Public Cloud Instanz](https://www.o
>
> OVHcloud stellt Ihnen Dienstleistungen zur Verfügung, für die Sie die alleinige Verantwortung tragen. Da wir keinen Zugriff auf diese Maschinen haben, können wir hierfür keinerlei Administrator-Aufgaben übernehmen oder sonstige Hilfeleistung anbieten. Es liegt daher in Ihrer Verantwortung, das Softwaremanagement und die tägliche Sicherheit zu gewährleisten.
>
> Wir stellen Ihnen diese Anleitung zur Verfügung, um Ihnen bei der Bewältigung alltäglicher Verwaltungsaufgaben zu helfen. Wir empfehlen Ihnen jedoch, sich an einen [spezialisierten Dienstleister](https://partner.ovhcloud.com/de/directory/) zu wenden, wenn Sie Schwierigkeiten oder Zweifel hinsichtlich der Verwaltung, Nutzung oder Sicherheit eines Servers haben. Sie können sich auch jederzeit an unsere [Community](https://community.ovh.com/en/) wenden, um sich mit anderen Benutzern auszutauschen.
> Wir stellen Ihnen diese Anleitung zur Verfügung, um Ihnen bei der Bewältigung alltäglicher Verwaltungsaufgaben zu helfen. Wir empfehlen Ihnen jedoch, sich an einen [spezialisierten Dienstleister](/links/partner) zu wenden, wenn Sie Schwierigkeiten oder Zweifel hinsichtlich der Verwaltung, Nutzung oder Sicherheit eines Servers haben. Sie können sich auch jederzeit an unsere [Community](https://community.ovh.com/en/) wenden, um sich mit anderen Benutzern auszutauschen.
>
> Diese Anleitung betrifft **nur** Instanzen, die auf Linux-Distributionen basieren.
>

## Voraussetzungen

- Sie verfügen über eine [Public Cloud Instanz](https://www.ovhcloud.com/de/public-cloud).
- Sie haben [administrativen Zugriff](/pages/public_cloud/compute/public-cloud-first-steps) (sudo) auf Ihre Instanz über SSH.
- Sie verfügen über eine [Public Cloud Instanz](/pages/public_cloud/compute/public-cloud-first-steps).
- Sie haben [administrativen Zugriff](/pages/public_cloud/compute/public-cloud-first-steps#connect-instance) (sudo) auf Ihre Instanz über SSH.

## In der praktischen Anwendung

### *cloud-init* Modul deaktivieren

> [!primary]
>
> Für diese Anleitung verwenden wir den Dateieditor **vi**, da er standardmäßig auf Linux-Distributionen vorhanden ist. Sie können natürlich auch einen Editor Ihrer Wahl verwenden.
>
> Grundlegende Verwendung von vi:
>
> - Drücken Sie **i**, um in den Editiermodus zu wechseln.
> - Drücken Sie **Esc**, um den Editiermodus zu verlassen.
> - Geben Sie **:wq** gefolgt von **Enter** ein, um zu speichern und zu beenden.
> - Geben Sie **:q!** gefolgt von **Enter** ein, um ohne zu speichern zu beenden.

Um das *cloud-init* Modul zu deaktivieren, muss zunächst die Konfigurationsdatei bearbeitet werden.

```sh
sudo vim /etc/cloud/cloud.cfg
sudo vi /etc/cloud/cloud.cfg
```

Fügen Sie einfach die folgenden beiden Zeilen hinzu oder bearbeiten Sie die vorhandenen:
Expand All @@ -41,18 +54,27 @@ manage_etc_hosts: false

### Hostname ändern

Bearbeiten Sie zunächst den Hostnamen:
Der erste Schritt besteht darin, den Hostnamen (*hostname*) zu ändern. In diesem Beispiel ändern wir den Hostnamen zu **webserver**. Sie können natürlich einen beliebigen Namen eingeben:

```sh
sudo vi /etc/hostname
```

Fügen Sie die Zeile hinzu oder ersetzen Sie sie:

```sh
sudo vim /etc/hostname
webserver
```

Bearbeiten Sie dann die Datei `/etc/hosts`:
Anschließend muss noch die Datei `/etc/hosts` geändert werden:

```sh
sudo vim /etc/hosts
sudo vi /etc/hosts
```

Fügen Sie die Zeile hinzu oder ersetzen Sie sie:

```sh
127.0.1.1 webserver.localdomain webserver
127.0.0.1 localhost
```
Expand All @@ -74,4 +96,4 @@ sudo cat /etc/hosts

## Weiterführende Informationen

Für den Austausch mit unserer User Community gehen Sie auf <https://community.ovh.com/en/>.
Treten Sie unserer [User Community](/links/community) bei.
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
---
title: 'Changing the hostname of a Public Cloud instance'
excerpt: 'Find out how to change the hostname of a Public Cloud instance'
updated: 2018-09-18
updated: 2025-03-20
---

## Objective

With the cloud-init module, you can configure your [Public Cloud instance](https://www.ovh.com/asia/public-cloud/instances/){.external} when you create it, and each time you reboot it. If you wish to reconfigure your hostname in order to fix an error creating your instance, or reconfigure your email server, you will need to disable the cloud-init module. This will configure the hostname so that it is not re-established.
With the cloud-init module, you can configure your [Public Cloud instance](https://www.ovhcloud.com/asia/public-cloud/){.external} when you create it, and each time you reboot it. Consequently, if you wish to reconfigure your hostname, because of an error when creating your instance or to reconfigure your email server, you will need to disable the Cloud-init module. This will configure the hostname so that it is not re-established.

**This guide will show you how to reconfigure cloud-init so that you can modify your instance’s hostname.**

> [!warning]
>
> OVHcloud provides services which you are responsible for. In fact, as we do not have administrative access to these machines, we are not administrators and we cannot provide you with support. This means that it is up to you to manage the software and security daily.
> OVHcloud provides services which you are responsible for with regard to their configuration and management. You are therefore responsible for ensuring they function correctly.
>
> We have provided you with this guide in order to help you with common tasks. However, we advise contacting a specialist provider if you experience any difficulties or doubts about administration, usage or server security. You can find more information in the "Go further" section in this guide.
> This guide is designed to assist you in common tasks as much as possible. If you encounter any difficulties performing these actions, please contact a [specialist service provider](/links/partner) and/or discuss the issue with our community on <https://community.ovh.com/en/>. OVHcloud cannot provide you with technical support in this regard.
>
> This guide is for instances based on Linux distributions **only**.
>

## Requirements

- An [OVHcloud Public Cloud instance](https://www.ovh.com/asia/public-cloud/instances/){.external}
- [SSH access](/pages/public_cloud/compute/public-cloud-first-steps) (sudo) to the instance
- An [OVHcloud Public Cloud instance](/pages/public_cloud/compute/public-cloud-first-steps)
- [SSH access](/pages/public_cloud/compute/public-cloud-first-steps#connect-instance) (sudo) to the instance

## Instructions

### Disable the cloud-init module.
### Disable the cloud-init module

> [!primary]
>
> For this guide we will use the file editor **vi** because it is present by default on Linux distributions. You can of course use the editor of your choice.
>
> Basic use of vi:
>
> - Press **i** to enter text insertion mode.
> - Press **Esc** (Esc) to exit insertion mode.
> - Type **:wq** then **Enter** to save and exit.
> - Type **:q!** then **Enter** to exit without saving.

To disable cloud-init, you will need to start by modifying the configuration file:

```sh
sudo vim /etc/cloud/cloud.cfg
sudo vi /etc/cloud/cloud.cfg
```

Simply add the following two lines, or modify them if they already exist:
Expand All @@ -39,20 +52,29 @@ preserve_hostname: true
manage_etc_hosts: false
```

### Modify the hostname.
### Modify the hostname

The first step involves modifying the hostname. In this example, we will change the hostname to **webserver**. You can of course edit as it suits your preference:

The first step involves modifying the hostname:
```sh
sudo vi /etc/hostname
```

Add or replace content by:

```sh
sudo vim /etc/hostname
webserver
```

Next, you will need to modify the `/etc/hosts` file:

```sh
sudo vim /etc/hosts
sudo vi /etc/hosts
```

Add or replace content by:

```sh
127.0.1.1 webserver.localdomain webserver
127.0.0.1 localhost
```
Expand All @@ -63,7 +85,7 @@ You will then need to reboot the instance:
sudo reboot
```

After you reboot it, the hostname modifications will be properly applied:
After the reboot, the hostname modifications will be properly applied:

```sh
sudo cat /etc/hosts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
---
title: 'Changing the hostname of a Public Cloud instance'
excerpt: 'Find out how to change the hostname of a Public Cloud instance'
updated: 2018-09-18
updated: 2025-03-20
---

## Objective

With the cloud-init module, you can configure your [Public Cloud instance](https://www.ovh.com.au/public-cloud/instances/){.external} when you create it, and each time you reboot it. If you wish to reconfigure your hostname in order to fix an error creating your instance, or reconfigure your email server, you will need to disable the cloud-init module. This will configure the hostname so that it is not re-established.
With the cloud-init module, you can configure your [Public Cloud instance](https://www.ovhcloud.com/en-au/public-cloud/){.external} when you create it, and each time you reboot it. Consequently, if you wish to reconfigure your hostname, because of an error when creating your instance or to reconfigure your email server, you will need to disable the Cloud-init module. This will configure the hostname so that it is not re-established.

**This guide will show you how to reconfigure cloud-init so that you can modify your instance’s hostname.**

> [!warning]
>
> OVHcloud provides services which you are responsible for. In fact, as we do not have administrative access to these machines, we are not administrators and we cannot provide you with support. This means that it is up to you to manage the software and security daily.
> OVHcloud provides services which you are responsible for with regard to their configuration and management. You are therefore responsible for ensuring they function correctly.
>
> We have provided you with this guide in order to help you with common tasks. However, we advise contacting a specialist provider if you experience any difficulties or doubts about administration, usage or server security. You can find more information in the "Go further" section in this guide.
> This guide is designed to assist you in common tasks as much as possible. If you encounter any difficulties performing these actions, please contact a [specialist service provider](/links/partner) and/or discuss the issue with our community on <https://community.ovh.com/en/>. OVHcloud cannot provide you with technical support in this regard.
>
> This guide is for instances based on Linux distributions **only**.
>

## Requirements

- An [OVHcloud Public Cloud instance](https://www.ovh.com.au/public-cloud/instances/){.external}
- [SSH access](/pages/public_cloud/compute/public-cloud-first-steps) (sudo) to the instance
- An [OVHcloud Public Cloud instance](/pages/public_cloud/compute/public-cloud-first-steps)
- [SSH access](/pages/public_cloud/compute/public-cloud-first-steps#connect-instance) (sudo) to the instance

## Instructions

### Disable the cloud-init module.
### Disable the cloud-init module

> [!primary]
>
> For this guide we will use the file editor **vi** because it is present by default on Linux distributions. You can of course use the editor of your choice.
>
> Basic use of vi:
>
> - Press **i** to enter text insertion mode.
> - Press **Esc** (Esc) to exit insertion mode.
> - Type **:wq** then **Enter** to save and exit.
> - Type **:q!** then **Enter** to exit without saving.

To disable cloud-init, you will need to start by modifying the configuration file:

```sh
sudo vim /etc/cloud/cloud.cfg
sudo vi /etc/cloud/cloud.cfg
```

Simply add the following two lines, or modify them if they already exist:
Expand All @@ -39,20 +52,29 @@ preserve_hostname: true
manage_etc_hosts: false
```

### Modify the hostname.
### Modify the hostname

The first step involves modifying the hostname. In this example, we will change the hostname to **webserver**. You can of course edit as it suits your preference:

The first step involves modifying the hostname:
```sh
sudo vi /etc/hostname
```

Add or replace content by:

```sh
sudo vim /etc/hostname
webserver
```

Next, you will need to modify the `/etc/hosts` file:

```sh
sudo vim /etc/hosts
sudo vi /etc/hosts
```

Add or replace content by:

```sh
127.0.1.1 webserver.localdomain webserver
127.0.0.1 localhost
```
Expand All @@ -63,7 +85,7 @@ You will then need to reboot the instance:
sudo reboot
```

After you reboot it, the hostname modifications will be properly applied:
After the reboot, the hostname modifications will be properly applied:

```sh
sudo cat /etc/hosts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
---
title: 'Changing the hostname of a Public Cloud instance'
excerpt: 'Find out how to change the hostname of a Public Cloud instance'
updated: 2018-09-18
updated: 2025-03-20
---

## Objective

With the cloud-init module, you can configure your [Public Cloud instance](https://www.ovh.com/ca/en/public-cloud/instances/){.external} when you create it, and each time you reboot it. If you wish to reconfigure your hostname in order to fix an error creating your instance, or reconfigure your email server, you will need to disable the cloud-init module. This will configure the hostname so that it is not re-established.
With the cloud-init module, you can configure your [Public Cloud instance](https://www.ovhcloud.com/en-ca/public-cloud/){.external} when you create it, and each time you reboot it. Consequently, if you wish to reconfigure your hostname, because of an error when creating your instance or to reconfigure your email server, you will need to disable the Cloud-init module. This will configure the hostname so that it is not re-established.

**This guide will show you how to reconfigure cloud-init so that you can modify your instance’s hostname.**

> [!warning]
>
> OVHcloud provides services which you are responsible for. In fact, as we do not have administrative access to these machines, we are not administrators and we cannot provide you with support. This means that it is up to you to manage the software and security daily.
> OVHcloud provides services which you are responsible for with regard to their configuration and management. You are therefore responsible for ensuring they function correctly.
>
> We have provided you with this guide in order to help you with common tasks. However, we advise contacting a specialist provider if you experience any difficulties or doubts about administration, usage or server security. You can find more information in the "Go further" section in this guide.
> This guide is designed to assist you in common tasks as much as possible. If you encounter any difficulties performing these actions, please contact a [specialist service provider](/links/partner) and/or discuss the issue with our community on <https://community.ovh.com/en/>. OVHcloud cannot provide you with technical support in this regard.
>
> This guide is for instances based on Linux distributions **only**.
>

## Requirements

- An [OVHcloud Public Cloud instance](https://www.ovh.com/ca/en/public-cloud/instances/){.external}
- [SSH access](/pages/public_cloud/compute/public-cloud-first-steps) (sudo) to the instance
- An [OVHcloud Public Cloud instance](/pages/public_cloud/compute/public-cloud-first-steps)
- [SSH access](/pages/public_cloud/compute/public-cloud-first-steps#connect-instance) (sudo) to the instance

## Instructions

### Disable the cloud-init module.
### Disable the cloud-init module

> [!primary]
>
> For this guide we will use the file editor **vi** because it is present by default on Linux distributions. You can of course use the editor of your choice.
>
> Basic use of vi:
>
> - Press **i** to enter text insertion mode.
> - Press **Esc** (Esc) to exit insertion mode.
> - Type **:wq** then **Enter** to save and exit.
> - Type **:q!** then **Enter** to exit without saving.

To disable cloud-init, you will need to start by modifying the configuration file:

```sh
sudo vim /etc/cloud/cloud.cfg
sudo vi /etc/cloud/cloud.cfg
```

Simply add the following two lines, or modify them if they already exist:
Expand All @@ -39,20 +52,29 @@ preserve_hostname: true
manage_etc_hosts: false
```

### Modify the hostname.
### Modify the hostname

The first step involves modifying the hostname. In this example, we will change the hostname to **webserver**. You can of course edit as it suits your preference:

The first step involves modifying the hostname:
```sh
sudo vi /etc/hostname
```

Add or replace content by:

```sh
sudo vim /etc/hostname
webserver
```

Next, you will need to modify the `/etc/hosts` file:

```sh
sudo vim /etc/hosts
sudo vi /etc/hosts
```

Add or replace content by:

```sh
127.0.1.1 webserver.localdomain webserver
127.0.0.1 localhost
```
Expand All @@ -63,7 +85,7 @@ You will then need to reboot the instance:
sudo reboot
```

After you reboot it, the hostname modifications will be properly applied:
After the reboot, the hostname modifications will be properly applied:

```sh
sudo cat /etc/hosts
Expand Down
Loading