161
108

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

sudo: unable to resolve host が表示されたら

Last updated at Posted at 2012-12-26

sudo: unable to resolve hostが表示されたら、/etc/hostsにホスト名を追加します。

手順

まずは、/etc/hostsを確認します。

sudo: unable to resolve hostが表示されています。

$ sudo cat /etc/hosts
sudo: unable to resolve host foobar
127.0.0.1       localhost
127.0.1.1       hostname.domainname hostname

/etc/hostsにホスト名を追加します

$ sudo sh -c 'echo 127.0.1.1 $(hostname) >> /etc/hosts'

もう一度、/etc/hostsを確認します。

ホスト名が追加されたので、sudo: unable to resolve hostが表示されません。

$ sudo cat /etc/hosts
127.0.0.1       localhost
127.0.1.1       hostname.domainname hostname
127.0.1.1 foobar
161
108
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
161
108

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?