GNU/Linux >> Linux Esercitazione >  >> Cent OS

Come modificare il nome host (nome del computer) su Fedora e CentOS

Breve:questo articolo descrive come trovare il nome host corrente del sistema. Inoltre, come puoi cambiare il nome host dei tuoi sistemi basati su Redhat?

Cambia il nome host usando Hostnamectl

Gli ultimi sistemi operativi Fedora e CentOS in esecuzione con systemd utilizza hostnamectl comando per gestire il nome host del computer.

È possibile modificare il nome host del sistema Linux utilizzando il comando seguente. Ad esempio, devi impostare il nome host del computer su workstation1 .

sudo hostnamectl set-hostname workstation1

Questo aggiornerà il file /etc/hostname sul tuo sistema e caricherà nell'ambiente corrente. Ma hai ancora bisogno dell'associazione del nome host con l'IP localhost.

Modifica anche /etc/hosts file e aggiungi un nuovo nome host con indirizzo IP localhost come:
127.0.1.1 workstation1 .

Ora, esegui il comando seguente per trovare il nome host corrente impostato per il tuo sistema.

hostnamectl 

   Static hostname: workstation1
         Icon name: computer-vm
           Chassis: vm
        Machine ID: b669a2e70002461cac387ba87397c78b
           Boot ID: a0b60ab33f8e43aa9d04b9950f91ab6c
    Virtualization: oracle
  Operating System: Fedora 26 (Workstation Edition)
       CPE OS Name: cpe:/o:fedoraproject:fedora:26
            Kernel: Linux 4.13.5-200.fc26.x86_64
      Architecture: x86-64

Cambia nome host manualmente

È inoltre possibile utilizzare il metodo precedente per modificare manualmente il nome host del sistema modificando direttamente i file di configurazione. Per cambiare il nome host, prima modifica il file /etc/hostname e scrivi lì il tuo nome host.

/etc/nomehost:

workstation1

Dopo aver modificato il file, puoi anche impostare il nome host per la sessione corrente per evitare il riavvio del sistema.

hostname workstation1

Dopodiché, modifica il file /etc/hosts per associare il nuovo nome host con l'indirizzo IP di localhost.

127.0.1.1  workstation1

Cent OS
  1. Come impostare/modificare un nome host su CentOS 7 Linux

  2. Come modificare il nome host su CentOS

  3. Come cambiare il nome host su Ubuntu

  4. Come modificare il nome host (nome del computer) su Ubuntu e Debian

  5. Come modificare il nome host su CentOS Linux

Come impostare/modificare il nome host in CentOS 8 / RHEL 8

Come modificare il nome host su CentOS 8

Come cambiare il nome del tuo computer Ubuntu (nome host)

Come modificare il nome host su Fedora 35

Come modificare il nome host in CentOS/RHEL 8

Come modificare il nome host in CentOS/RHEL 7