ブログ - Raspbianでホスト名変更
Rapsberry Pi3にraspbianをインストールすると,デフォルトでホスト名はraspberrypiが設定荒れている.
ホスト名は次のファイルに記載されている.
これを任意のものに変更する.変更するにはroot権限が必要.ここではcommetという名前にしている.
hostsファイルも変更.
追加した結果を確認.
OK.
pi@raspberrypi:~ $ hostname
raspberrypi
pi@raspberrypi:~ $
pi@raspberrypi:~ $ cat /etc/hostname
raspberrypi
pi@raspberrypi:~ $
pi@raspberrypi:~ $ su
パスワード:
root@raspberrypi:/home/pi# echo commet > /etc/hostname
root@raspberrypi:/home/pi# cat /etc/hostname
commet
root@raspberrypi:/home/pi#
hostsファイルも変更.
root@commet:~# echo '192.168.0.141 commet' >> /etc/hosts
root@commet:~#
root@commet:~# cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 raspberrypi
192.168.0.141 commet
root@commet:~#