A fresh Ubuntu install is magnificently empty. A blank slate. For about five minutes.
Then you clone a repository, type ./configure, make or cmake and discover it expects a compiler, build tools, headers, pkg-config and a few other things that haven’t simply materialised.
Here are some scripts that will install a useful baseline to handle most basic development tasks. If I have left out your favourite tool please don’t take offence. Let me know about my omission and I’ll update.
Baseline
Install the essential tools for building C or C++ code, running Python and Node, managing processes, sending HTTP requests and working with archives.
#!/usr/bin/env bash
# Stop on first error.
set -euo pipefail
# Update the APT catalog.
sudo apt update
# Development tools.
sudo apt install -y \
build-essential \
cmake \
ninja-build \
pkg-config \
git \
curl \
wget \
ca-certificates \
gnupg \
unzip \
zip \
tar \
file \
jq \
ripgrep \
tree \
shellcheck \
gdb \
strace \
lsof \
htop
# Python.
sudo apt install -y python3 python3-dev python3-pip python3-venv
# Node.
sudo apt install -y nodejs npm
# Development libraries.
sudo apt install -y \
libbz2-dev \
libcurl4-openssl-dev \
libffi-dev \
liblzma-dev \
libncurses-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
zlib1g-devThe build-essential package is Ubuntu’s convenient bundle for the ordinary C and C++ toolchain, bringing in gcc, g++, make, the standard C library headers and packaging tools. Then cmake and ninja-build because new C and C++ projects tend to expect one or both. Throw in some common libraries, using the development packages which include the headers that are generally needed by compilers.
The remaining packages are small tools and utilities:
git,curl,wget,ca-certificatesandgnupgfor web requests and verifying package repositories;unzip,zip,tar,file,jq,ripgrepandtreefor handling the usual assortment of archives, JSON and unfamiliar directories;gdb,strace,lsof,htopandshellcheckfor investigating when things break; and- Python and Node.
The selected packages are intentionally generic, and so will install the latest available version rather than a specific version. If you need a particular version of one of these then you will need to dig deeper. The script is also intentionally hardware agnostic, so I have not included things like CUDA, which assumes the presence of an NVIDIA GPU.
Many of the tools support a --version parameter, which can be used as a simple test. For example:
gcc --versiongcc (Ubuntu 15.2.0-16ubuntu1) 15.2.0
Scientific Computing
The following script adds a Fortran compiler, OpenBLAS and LAPACK for linear algebra, FFTW for Fourier transforms, HDF5 and NetCDF for scientific file formats, MPI for multi-process work and the usual GDAL/GEOS/PROJ geospatial headers. It also includes R, which is my preferred tool for any serious statistics or data analysis.
#!/usr/bin/env bash
set -euo pipefail
sudo apt update
# Core tools.
sudo apt install -y \
gfortran \
openmpi-bin \
r-base \
r-base-dev
# Development libraries.
sudo apt install -y \
libopenblas-dev \
liblapack-dev \
libfftw3-dev \
libgdal-dev \
libgeos-dev \
libhdf5-dev \
libnetcdf-dev \
libopenmpi-dev \
libproj-dev \
libudunits2-dev \
libcurl4-openssl-dev \
libfontconfig1-dev \
libharfbuzz-dev \
libssl-dev \
libxml2-devDocker and other language toolchains
Docker, Rust, Go and Java are useful, but they don’t need to be part of every basic machine. This script installs Ubuntu’s Docker engine and Compose packages, the Rust compiler and Cargo package manager, Go and the default Java Development Kit.
#!/usr/bin/env bash
set -euo pipefail
sudo apt update
sudo apt install -y \
docker.io \
docker-compose \
rustc \
cargo \
golang-go \
default-jdkAfter installing Docker, either run Docker commands with sudo or add your user to the docker group.