Getting started with Ubuntu

From EIK wiki

Ubuntu is an Linux distribution based on Debian package management system. Ubuntu is widely used on servers and in the cloud. Ubuntu is composed of thousands of software packages distributed under mostly free and open-source licenses. Before you continue make sure you're comfortable with basic command-line usage, if that's not the case take a look at CodeAcademy track for learning command line.

Downloading Long-Term Support version

The Long-Term Support versions tagged as LTS are recommended for production environments where stability is a must. For 64-bit machines with 4GB+ of memory pick the amd64 release, otherwise stick to i386.

For high-end PC-s and laptops the original Ubuntu with Unity desktop environment is recommended:

wget ftp://ftp.estpak.ee/pub/ubuntu-releases/16.04/ubuntu-16.04.1-desktop-amd64.iso
wget ftp://ftp.estpak.ee/pub/ubuntu-releases/16.04/ubuntu-16.04.1-desktop-i386.iso

For low-end PC-s, laptops and virtual machines Ubuntu with MATE desktop environment is recommended:

wget ftp://ftp.estpak.ee/pub/ubuntu-cdimage/ubuntu-mate/releases/16.04.1/release/ubuntu-mate-16.04.1-desktop-amd64.iso
wget ftp://ftp.estpak.ee/pub/ubuntu-cdimage/ubuntu-mate/releases/16.04.1/release/ubuntu-mate-16.04.1-desktop-i386.iso

There is also a dedicated version available for servers, it contains exactly the same packages sans graphical user interface:

wget ftp://ftp.estpak.ee/pub/ubuntu-releases/16.04/ubuntu-16.04.1-server-amd64.iso
wget ftp://ftp.estpak.ee/pub/ubuntu-releases/16.04/ubuntu-16.04.1-server-i386.iso

Writing the LiveCD image to memory stick

All of the ISO images listed above contain hybrid bootloader, which means that same image can be written to CD-R or USB memory stick both.

For Linux there is no need to fetch extra tools to write the image to a USB memory stick, simply use dd:

 sudo dd if=ubuntu-16.04.1-desktop-amd64.iso of=/dev/sdx # Substitute sdx with your memory stick

Or if you're already root, you can simply use cat:

 cat ubuntu-16.04.3-desktop-amd64.iso > /dev/sdx # Again substitute sdx with your memory stick

If you're running on Windows, you can use Win32 Disk Imager to write the ISO image to the USB memory stick.

After this you're left with a memory stick with pretty funky partition table (eg 59MB storage), but don't worry -- we can fix that! Once you've successfully booted to Ubuntu you can write zeroes to the USB memory stick like this:

dd if=/dev/zero of=/dev/sdx # Substitute sdx with your memory stick block device

Booting LiveCD

Reboot your machine and identify the keystroke for temporarily booting from external storage such as USB memory stick. If the machine fails to boot check that Secure Boot is disabled in BIOS.

Once the Ubuntu desktop appears check that all necessary hardware is properly detected:

 iwconfig
 lspci -t -v -nn
 lsusb -t
 dmidecode

For checking smartcard support for Estonian ID-card you have to install some extra packages:

 sudo apt-get update
 sudo apt-get install opensc pcscd
 opensc-tool -l

If you identify Broadcom 43xxx wireless chip in your laptop you have to install extra package to have a snowballs chance in hell, note that you need wired network for this:

 sudo apt-get update
 sudo apt-get install bcmwl-kernel-source
 sudo modprobe wl

Also check that:

  • Suspend and resume work as expected.
  • Audio playback/recording works.
  • Wired/wireless network connectivity works.
  • Your Bluetooth devices work.


Checking EFI support

If you want to keep your Windows installation alongside with your new Linux installation you should identify whether EFI or legacy boot mode is used by Windows. Linux should use the same method. Note that Windows 8 mandates the use of EFI, for Windows 7 it's optional. Latest x86 based Mac-s also use EFI. In some BIOS-es you can also check whether EFI, Legacy or mixed mode is used for booting. Some motherboards boot LiveCD using legacy method even though the Windows might have been installed using EFI method, in that case you'll end up with non-bootable machine because LiveCD is unable to manipulate EFI boot entries.

The easiest way to check whether LiveCD is booted in EFI mode is using efibootmgr:

 sudo modprobe efivars
 sudo apt-get update
 sudo apt-get install efibootmgr
 sudo efibootmgr

If you see a list of boot targets then the LiveCD has access to EFI boot entries. If you see efibootmgr: EFI variables are not supported on this system. this means the LiveCD has been booted in Legacy mode.

To check whether Windows is installed in EFI mode you should see whether GPT partition table is used and EFI boot partition exists:

 sudo apt-get update
 sudo apt-get install gdisk
 echo p | sudo gdisk /dev/sda

If no GPT partition table is present it's surely a Legacy boot installation.

Installing on permanent storage

While you can do a lot of stuff directly off the memory stick, it's not suitable for daily use. If you're confident you want Linux installation of your machine and you've backed up all important data proceed with this chapter, otherwise check below how to run Linux safely in a virtual machine.

Before continuing make sure you have backed up all important data! Partition resizing is not as dangerous as it was back in 2009, but accidents happen. You've been warned!

Double click on the Install Ubuntu 16.04 on the LiveCD desktop and follow instructions on the screen up to the harddisk partitioning. To make upgrades as easy as possible make sure you use separate mountpoints for / and /home.

Hence for Legacy dual-boot installations the partition table would look like this:

 sda1: Windows 7, NTFS, mounted at /mnt/windows
 sda2: Windows recovery, NTFS, not mounted
 sda4: Extended partition
 sda5: Linux root filesystem, 20GB, ext4, mounted at /
 sda6: Linux swap, 4GB
 sda7: Linux home filesystem, ext4, mounted at /home

And for EFI dual-boot installations:

 sda1: EFI boot partition (ef00), mounted at /boot/efi
 sda2: Windows 8, NTFS, mounted at /mnt/windows
 sda3: Windows recovery, NTFS, not mounted
 sda4: Linux root filesystem, 20GB, ext4, mounted at /
 sda5: Linux swap, 4GB
 sda6: Linux home filesystem, ext4, mounted at /home

For Linux-only legacy installations:

 sda1: Linux root filesystem, 20GB, ext4, mounted at /
 sda2: Linux swap, 4GB
 sda3: Linux home filesystem, ext4, mounted at /home

For Linux-only EFI installations, you may take advantage of the BIOS boot partition to avoid adding EFI entries which may get lost with BIOS reset:

 sda1: BIOS Boot Partition (ef02), 1MB
 sda2: Linux root filesystem, 20GB, ext4, mounted at /
 sda3: Linux swap, 4GB
 sda4: Linux home filesystem, ext4, mounted at /home


Beyond installation

Check what kind of hardware your machine has.

Enable additional software repositories in /etc/apt/sources.list:

deb      http://ee.archive.ubuntu.com/ubuntu/ trusty            main restricted universe multiverse
deb-src  http://ee.archive.ubuntu.com/ubuntu/ trusty            main restricted universe multiverse
deb      http://ee.archive.ubuntu.com/ubuntu/ trusty-updates    main restricted universe multiverse
deb-src  http://ee.archive.ubuntu.com/ubuntu/ trusty-updates    main restricted universe multiverse
deb      http://ee.archive.ubuntu.com/ubuntu/ trusty-backports  main restricted universe multiverse
deb-src  http://ee.archive.ubuntu.com/ubuntu/ trusty-backports  main restricted universe multiverse
deb      http://security.ubuntu.com/ubuntu/   trusty-security   main restricted universe multiverse
deb      http://archive.canonical.com/ubuntu/ trusty            partner

Install Estonian ID-card software stack:

sudo apt-get install apt-transport-https
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 43650273CE9516880D7EB581B339B36D592073D4
echo "deb https://installer.id.ee/media/ubuntu/ trusty main" | sudo tee /etc/apt/sources.list.d/ria-repository.list
sudo apt-get update
sudo apt-get install estonianidcard opensc pcscd libnss3-tools

Generate Digidoc plugin for MATE's file browser if you installed Ubuntu MATE:

sudo sed -e 's/Nautilus/Caja/g' /usr/share/nautilus-python/extensions/nautilus-qdigidoc.py > /usr/share/caja-python/extensions/caja-qdigidoc.py

In most cases you can get software for your Ubuntu installation via either Advanced Packaging Tool or Ubuntu Software Center -- You do not need to surf around the web to fetch software for your Ubuntu machine.

Installing in VirtualBox

Download VirtualBox and install it on your PC. Create a virtual machine for Ubuntu, make sure you allocate at least 1GB of memory and attach 10GB virtual disk image. Download Ubuntu MATE ISO file referenced above and use the newly created virtual machine to boot the ISO. Note that installing original Ubuntu in a virtual machine is troublesome due to laggy 3D virtualization, so you might want to choose in favour of Ubuntu MATE. Use the Linux-only partitioning scheme described above.

Once you have installed Ubuntu in a virtual machine make sure you have X11 drivers for virtualized hardware, this should enable better mouse/keyboard integration and ability to copy-paste between guest and host:

apt-get install virtualbox-guest-x11