UbuntuでFQDNを変更する方法


3

私はを使用してUbuntuのFQDNを変更しようとしました sudo -i gedit /etc/hosts そして以下のように変更します。

127.0.0.1   localhost
127.0.1.1   ubuntu.example.com
192.168.217.129 ubuntu.example.com

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

その後、私は試してみました:

hostname -f 

それは示します:

hostname: Name or service not known

FQDNを変更する方法


ここで最も人気のある答えを試してみてください。 askubuntu.com/questions/158957/…
Kinnectus

下のリンクはあなたを助けるでしょう。 askubuntu.com/questions/158957/…
Hussain7

まあそれは知っている!
Kinnectus

geditでsudoを使うのではなく、nanoをお勧めしますか?とても簡単です。時折、 vi 唯一の現実的な選択肢です - しかし私はそれが現実的に唯一のvisudoのためだと思います。私はgeditとsudoを混同しないでください。
Thufir

回答:


3

編集する /etc/hostname そして、置きます ubuntu

echo "ubuntu" > /etc/hostname

プット hostname 次の形式のエントリも /etc/hosts

IP  fqdn   hostname

きみの /etc/hosts のようになります

  127.0.0.1   localhost
  127.0.1.1   ubuntu.example.com  ubuntu
  192.168.217.129 ubuntu.example.com  ubuntu 
# The following lines are desirable for IPv6 capable hosts
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.