Change hostname by editing each of these files:
/etc/hosts
/etc/hostname
/etc/cloud/cloud.cfg
Change IP Address:
vi /etc/network.d/50-cloud-init.cfg
Change IP by editing that file. Still to work out how to change username and password. raspi-config
does not work.
Example of 50-cloud-init.cfg
:
auto eth0
iface eth0 inet static
address <>/<>
gateway <>
domain_name_servers=1.1.1.1, 9.9.9.9
Flash drive using the flash utility with the following parameters:
flash --userdata /home/ricdeez/tmp/user-data hypriotos-rpi-v1.12.3.img
Copy of user-data file:
#cloud-config
# vim: syntax=yaml
#
# Set your hostname here, the manage_etc_hosts will update the hosts file entries as well
hostname: slave-XX
manage_etc_hosts: true
resize_rootfs: true
growpart:
mode: auto
devices: ["/"]
ignore_growroot_disabled: false
# You could modify this for your own user information
users:
- name: pirate
gecos: "Hypriot Pirate"
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
groups: users,docker,video,input
plain_text_passwd: xxxxxx
ssh-authorized-keys:
- ssh-rsa key 1
lock_passwd: false
ssh_pwauth: true
chpasswd: { expire: false }
# # Update apt packages on first boot
# package_update: true
# package_upgrade: true
# package_reboot_if_required: true
package_update: true
package_upgrade: true
package_reboot_if_required: true
# # Install any additional apt packages you need here
packages:
- ntp
# # Set the locale of the system
locale: "en_AU.UTF-8"
# # Set the timezone
# # Value of 'timezone' must exist in /usr/share/zoneinfo
timezone: "Australia/Perth"
# # WiFi connect to HotSpot
# # - use `wpa_passphrase SSID PASSWORD` to encrypt the psk
write_files:
- content: |
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.11.12.245/24
gateway 10.11.12.1
dns-nameservers 8.8.8.8
path: /etc/network/interfaces.d/50-cloud-init.cfg
# - content: |
# country=de
# ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
# update_config=1
# network={
# ssid="YOUR_WIFI_SSID"
# psk="YOUR_WIFI_PASSWORD"
# proto=RSN
# key_mgmt=WPA-PSK
# pairwise=CCMP
# auth_alg=OPEN
# }
# path: /etc/wpa_supplicant/wpa_supplicant.conf
# These commands will be ran once on first boot only
runcmd:
# Pickup the hostname changes
- 'systemctl restart avahi-daemon'
# # Activate WiFi interface
# - 'ifup wlan0'