Linux laptop setup
The basic steps to getting a Linux laptop running Ubuntu setup for developers are:
- Ensure the laptop meets the required specification.
- Configure the BIOS.
- Install Ubuntu.
- Adjust the disk partitions.
- Install software needed for development.
Laptop specification
We generally buy Dell XPS 15 for developers, but any laptop with Linux support (which is most laptops these days) and that meets the spec will do.
For development the laptop should have a reasonably fast processor, 32 GB of memory and at least 512 GB SSD of storage (1 TB recommended). The monitor size is dependant on user preference, but larger screens are often better for development.
BIOS setup
To get into the BIOS setup, hit the key the setup key while the laptop is booting. For Dell laptops this is F12. If this doesn't work try the delete key.
Secure boot
While Ubuntu claims to work with secure boot, there are often issues with this. It's often easiest to turn this off.
Storage mode
Set the disk storage mode to AHCI.
Many laptops come with the storage mode set to RAID. Ubuntu doesn't support the Intel RAID controller and as it's not proper RAID there's no reason to use it.
Virtualization support
This should be on by default, but worth checking that virtualization is enabled as this is required for running Docker and virtual machines.
Touch screen
Touch screens can be problematic with Linux. If it's not required it can be disabled in the BIOS.
Install Ubuntu Linux
We recommend installing the latest LTS release of Ubuntu. At the time of writing this is Ubuntu 22.04.
To install Ubuntu you'll need a memory stick that has been formatted as a bootable Ubuntu installer. For help with this see:
- Create a bootable USB stick on Ubuntu.
- Create a bootable USB stick on macOS.
- Create a bootable USB stick with Rufus on Windows.
Insert the USB into the laptop, restart it, hit the setup key until the laptop enters the start up options screen. Select the USB disk from the boot device options and once it starts select 'Try or install Ubuntu'.
Once Ubuntu starts, select 'Install Ubuntu'. Go through the install process selecting the appropriate options for you. This would generally include a normal installation with third-party software.
When you're asked for the installation type, select 'Erase disk and install Ubuntu'. Under 'Advanced features...' select 'Use LVM' and 'Encrypt the new Ubuntu installation'. Choose a secure password to encrypt the disk with. This will be required every time you start the laptop.
When the laptop is installing you'll be asked to create a user account. This should also have a secure password as it will be an admin account and you'll need this to install software.
Adjust the disk partitions
Issues with the default partitions
When installing Ubuntu with LVM and full disk encryption you're not able to set the partition layout. The install is setup with a small swap partition and everything else is put in a single partition. This can be problematic as reinstalling Ubuntu will wipe out your files, so if you ever need to reinstall the operating system you'll need to copy all your files off first. Also, hibernation won't work because the swap partition is too small to store everything in memory.
Recommended partition layout
I currently recommend the following LVM disk partitions:
- 32 GB swap (for hibernation)
- 80 GB / (for root system files)
- 100GB /var/lib/docker (for Docker files)
- Rest of the free space /home (for user files)
Modifying the partitions
To change the partitions you'll need to boot the laptop from the USB installer, but this time select 'Try Ubuntu'. This will take you to a Ubuntu desktop environment.
1. Mount encrypted LUKS partition
First need to decrypt the disk. You'll be asked for the disk encryption password.
sudo cryptsetup luksOpen /dev/nvme0n1p3 vgubuntu
2. Resize root partition
Now resize the root partition to 80GB.
sudo e2fsck -f /dev/mapper/vgubuntu-root
sudo resize2fs /dev/mapper/vgubuntu-root 70G
sudo lvreduce -L 80G /dev/mapper/vgubuntu-root
sudo resize2fs /dev/mapper/vgubuntu-root
3.Resize swap partition
This is only required if you want to use hibernation. If you don't plan on hibernating the laptop you can skip this and use the default swap size.
lvresize -L 32G /dev/mapper/vgubuntu-swap_1
sudo mkswap /dev/mapper/vgubuntu-swap_1
4. Create a LVM partition for Docker
The partition hosting Docker storage will fill up as Docker caches everything. As the root partition is quite small, Docker will fill this up quite quickly. This will cause problems and can force you to have to fix the installation by deleting files from a recovery console.
One option to fix this is to create a partition specifically for Docker stuff. An alternative is to skip this step and move Docker storage to another location once you've installed Docker; which should be somewhere on the /home
partition.
To create new Docker partition of 100GB run:
sudo lvcreate -n docker -L 100G vgubuntu
sudo mkfs.ext4 /dev/mapper/vgubuntu-docker
5. Create a home LVM partition
Now create a new home partition using all the remaining free disk space
sudo lvcreate -n home -l 100%FREE vgubuntu
sudo mkfs.ext4 /dev/mapper/vgubuntu-home
6. Move home to new the partition
Copy everything off the home directory on the root partition into the new home partition.
mkdir root
sudo mount /dev/mapper/vgubuntu-root root
mkdir home
sudo mount /dev/mapper/vgubuntu-home home
rsync -av root/home/ home/
7. Ensure the new partitions are mounted at boot time
Edit the etc/fstab
file in the mounted root partition and add the following:
/dev/mapper/vgubuntu-home /home ext4 defaults 0 2
/dev/mapper/vgubuntu-docker /var/lib/docker ext4 defaults 0 2
8. Unmount the drives and reboot
sudo umount root
sudo umount home
sudo reboot
If all went well the laptop will reboot cleanly and the partitions will have been resized (check with df -h
).
Install software
For development you'll need the following:
We also recommend:
Last updated: