User Tools

Site Tools


ubuntu:pi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ubuntu:pi [2021-01-23 16:09] – line wrap gabrielubuntu:pi [2021-02-08 16:27] (current) – [Configuring RTC on Ubuntu 20.04 LTS] formatting gabriel
Line 38: Line 38:
 # optional: remove cloud-init completely # optional: remove cloud-init completely
 apt-get purge cloud-init apt-get purge cloud-init
-rm -rf /var/lib/cloud/* 
 # if you do not remove cloud-init be sure not to allow your # if you do not remove cloud-init be sure not to allow your
 # configuration to be overwritten in future updates to the package # configuration to be overwritten in future updates to the package
 </code> </code>
  
-Make sure not to overwrite the cloud-init config if you  +Another option is to create a small 1Mb partition after your root partition to ensure that it can never be grown into the empty space on your SD card.
  
 Next do the following: Next do the following:
  
-  * set hostname +<code> 
-  * Install python for Ansible +# disable the unattended upgrades service (you can re-enable later if you prefer) 
-  * configure /etc/netplan/99-config.yaml +systemctl disable unattended-upgrades
-  * run ubuntu_ansible_control.yml playbook to update to most recent profile+
  
 +# install python for Ansible
 +apt install python
  
-Add the following to Ansible plays in the future:+# set editor to Vim (optional) 
 +update-alternatives --config editor
  
- * disable ipv6 +# set a hostname 
- * timezone +echo "$MYHOSTNAME" > /etc/hostname
- * default editor +
- * prune packages +
- * sshd config +
- * disable ubuntu account or remove +
- * configre motd+
  
 +# don't forget to update /etc/hosts
 +</code>
 +
 +Configure network interface for static use:
 +
 +<code>
 +# /etc/netplan/99-static.yaml
 +network:
 +    version: 2
 +    renderer: networkd
 +    ethernets:
 +        eth0:
 +            addresses:
 +                - 10.1.2.3/24
 +            gateway4: 10.1.2.1
 +            link-local: [ ]
 +            nameservers:
 +                search: [subnet.quay.net, quay.net]
 +                addresses:
 +                    - 10.1.2.53
 +</code>
 +
 +Test netplan configuration:
 +
 +<code>
 +netplan try
 +
 +# if that works, remove any other config files and run:
 +netplay apply
 +
 +# once successfully tested you should also remove the default config from cloud-init
 +# (add to Ansible playbook in future)
 +rm -f /etc/netplan/50-cloud-init.yaml
 +</code>
 +
 +==== Ansible playbooks ====
 +
 +<code>
 +# standard configuration for all Raspberry Pi systems
 +# this playbook does the following:
 +#  - base configurations (raspi_ubuntu)
 +#  - time service config (chrony)
 +#  - firewall config (nftables)
 +ansible-playbook -l raspi.in.quay.net raspi_ubuntu.yml
 +
 +# regenerate SSHD keys on host after build
 +# NOTE: Ubuntu ships with a default set of SSHD keys
 +ansible-playbook -l raspi.in.quay.net regen_sshd_keys.yml
 +</code>
 +
 +Add the following to Ansible plays in the future:
 +
 +  * default editor
 +  * prune packages
 +  * configre motd
 +  * apt install lm-sensors
  
 ===== Hardware notes ===== ===== Hardware notes =====
  
 Quick reference for Raspberry Pi hardware tools on Ubuntu. Quick reference for Raspberry Pi hardware tools on Ubuntu.
 +
 +==== Configuring RTC on Ubuntu 20.04 LTS ====
 +
 +<code>
 +# Install the I2C tools to access the bus and configure your RTC
 +apt install i2c-tools
 +
 +# Enable your RTC in the Pi boot config
 +RTCMODEL=ds3231
 +echo "dtoverlay=i2c-rtc,$RTCMODEL" >> /boot/firmware/usercfg.txt 
 +
 +# show I2C bus config
 +#  - 68 = hardware detected
 +#  - UU = dtoverlay configured correctly and driver is loaded
 +i2cdetect -y 1
 +</code>
 +
 +//Reference: [[https://pimylifeup.com/raspberry-pi-rtc/|Raspberry Pi RTC: Adding a Real Time Clock//
  
 ===== Reference ===== ===== Reference =====
Line 76: Line 145:
   * [[https://elinux.org/RPiconfig|RPiconfig]]   * [[https://elinux.org/RPiconfig|RPiconfig]]
   * [[https://ubuntu.com/download/raspberry-pi|Ubuntu Raspberry Pi Downloads]]   * [[https://ubuntu.com/download/raspberry-pi|Ubuntu Raspberry Pi Downloads]]
 +  * [[https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview|How to install Ubuntu Server on your Raspberry Pi]]
 +  * [[https://netplan.io/examples/|Netplan configuration examples]]
ubuntu/pi.1611436174.txt.gz · Last modified: 2021-01-23 16:09 by gabriel