Rework assigning hostname and service files (#150)

* Rework assigning hostname and service files

* docs: small fix in hostname article

* Correct path to setup.bash in clever.service

* docs: correct ip in hostname article

* init_rpi: put normal and .local hostname on one line in hosts

* docs: add English version of hostname article

* clever.service: use sh instead of bash

* docs: Spellcheck english version, add note about hostname vs SSID

* clever.service: return roscore requirement back
This commit is contained in:
Oleg Kalachev
2019-08-04 00:40:27 +03:00
committed by GitHub
parent 05af14a792
commit 1538ec33f7
10 changed files with 73 additions and 53 deletions

View File

@@ -50,6 +50,7 @@
* [Interfacing with a laser rangefinder](laser.md)
* [PX4 Simulation](sitl.md)
* [Software autorun](autolaunch.md)
* [Hostname](hostname.md)
* [Controlling the copter from Arduino](arduino.md)
* [Using an external 3G modem](3g.md)
* Clever-based projects

31
docs/en/hostname.md Normal file
View File

@@ -0,0 +1,31 @@
# Hostname
[By default](microsd_images.md) the hostname of the Clever drone is set to `clever-xxxx`, where `xxxx` are random numbers. These numbers are the same as in the [Wi-Fi SSID](wifi.md).
Thus, Clever is accessible on machines that support mDNS as `clever-xxxx.local`. You can use this name to access Clever over SSH:
```bash
ssh pi@clever-xxxx.local
```
Also, this name can be used in place of IP-address to open Clever web pages in browser, accessing ROS master, etc.
## Changing hostname
In some situations it is necessary to change Clever's hostname. You can use the `hostnamectl` utility for that:
```bash
sudo hostnamectl set-hostname newname
```
Where `newname` is the new name of the machine. `hostnamectl` utility will change the name in `/etc/hostname` file.
You should also put the new name to `/etc/hosts` file:
```txt
127.0.1.1 newname newname.local
```
Setting `newname.local` is necessary to allow ROS to resolve this name in situations where all the network interfaces are down (when Wi-Fi is turned off or disconnected).
> **Note** Changing the hostname does not affect the Wi-Fi SSID (and vice versa, changing the Wi-Fi SSID won't affect the hostname).

View File

@@ -54,6 +54,7 @@
* [Работа с SITL](sitl.md)
* [Контейнер с симулятором](sitl_docker.md)
* [Автозапуск ПО](autolaunch.md)
* [Имя хоста](hostname.md)
* [Взаимодействие с Arduino](arduino.md)
* [3G-модем](3g.md)
* [Установка ROS Kinetic](ros-install.md)

31
docs/ru/hostname.md Normal file
View File

@@ -0,0 +1,31 @@
# Имя хоста
[По умолчанию](microsd_images.md) на Клевере установлено имя хоста (hostname) `clever-xxxx`, где `xxxx` случайные цифры. Имя хоста соответствует SSID [точки доступа Wi-Fi](wifi.md).
Таким образом, Клевер доступен на машинах, поддерживающих mDNS, под именем `clever-xxxx.local`. Вы можете использовать это имя для SSH-доступа на Клевер:
```bash
ssh pi@clever-xxxx.local
```
Также это имя может быть использовано вместо IP-адреса для открытия страницы Клевера в браузере и т. д.
## Изменение имени хоста
В некоторых ситуациях необходимо изменение имени хоста Клевера. Для это используйте утилиту `hostnamectl`:
```bash
sudo hostnamectl set-hostname newname
```
Где `newname` новое имя машины. Утилита `hostnamectl` поменяет имя в файле `/etc/hostname`.
Также необходимо прописывание нового имени в файл `/etc/hosts`:
```txt
127.0.1.1 newname newname.local
```
Прописывание `newname.local` необходимо, чтобы ROS смог разрешить это имя в ситуациях, когда все сетевые интерфейсы неактивны (отключение/разрыв связи Wi-Fi).
> **Note** Изменение имени хоста не повлечёт за собой изменений SSID точки доступа Wi-Fi (и наоборот, изменение SSID точки доступа не поменяет имя хоста).