Installing Ubuntu on a RPi

  1. Write Ubuntu to an SD card and boot..Rpi pic
    If you google Ubuntu Rpi you will be taken to the Snappy version of Ubuntu for IoT. This isn’t the one I want, as it doesn’t use the normal Ubuntu method for getting software (apt-get). I used version 14.04 (Supported through early 2019) linked here. Writing the image to SD is explained here.
  2. login with username: ubuntu password: ubuntu
  3. I went and installed SSH, so I can configure it remotely, using these instructions: wiki.ubuntu.com/ARM/RaspberryPi
    This by default allows login using the default credentials
  4. Now I can do everything from my normal desktop PC. With the Pi plugged into my LAN I can find it using Network IP Scanner for Android. I use MobaXTerm to ssh into my Pi.
  5. I went through the usage instructions linked in step 3.
    • Resized partitions
    • installed a SWAP partition
    • Don’t need a wifi dongle nor a gui (graphical user interface) or a serial console so thats it.
  6. Set time zone
    sudo dpkg-reconfigure tzdata
  7. Set the hostname
    hostnamectl set-hostname new-hostname
  8. Edit /etc/hosts and change (well I duplicated) the line which reads:
    127.0.1.1     your-old-hostname
    
  9. Set the ubuntu user password:
    passwd ubuntu
  10. Add public key auth for SSH
    • Generate an SSH key as here (Digital Ocean Ubuntu Guide).
    • Copy that key to an authorized_keys file
      cd "/home/ubuntu/.ssh/"
      
      cat id_rsa.pub >> authorized_keys
    • Follow step 5 from the Digital Ocean Ubuntu Guide.
      sudo nano /etc/ssh/sshd_config

      Find the following lines and set as follows

      PermitRootLogin no
      PubkeyAuthentication yes
      AuthorizedKeysFile      %h/.ssh/authorized_keys
    • Change the port for SSH in sshd_config for internet use.
    • Reboot SSH
      sudo service ssh restart
  11. Add auto security updates.
  12. Add email sending capability.
  13. Using the ‘Additional Recommended Steps for New Ubuntu 14.04 Servers’ instructions:
    • Set a firewall; allow SSH and samba through the firewall for windows file sharing. Samba ports: UDP/137,138 TCP/139,445
      Finish the firewall settings..
    • Configure NTP Synchronisation.
    • Swapfile is already created in step 5.
  14. Perhaps change user home directory permissions..
    sudo chmod 0750 /home/username
  15. Now we can go on to configure Samba if required.

3 thoughts on “Installing Ubuntu on a RPi”

Leave a Reply

Your email address will not be published. Required fields are marked *