Filipin.eu

Željko Filipin's blog.
Home Blog Tags Now License

View on GitHub
27 February 2023

Setting up a new Ubuntu machine

by Željko Filipin

I recently wrote about setting up a new macOS machine. This time I’m setting up a new Ubuntu machine, so I’ve decided to move my private notes to a blog post. Setting up macOS and Ubuntu is surprisingly similar, but there is still enough difference that I have separate notes.

Ubuntu

Update Ubuntu and check Settings. A few tweaks are usually required.

Firefox

Ubuntu comes with my favorite browser Firefox already installed. Install the Bitwarden password manager add-on. Sign in to Firefox Account. That installs my favorite Firefox additions:

I prefer that browsers download to Desktop instead of Downloads folder.

Bitwarden

I use Bitwarden password manager, but Bitwarden Snap application doesn’t work on Ubuntu 22.04, so I use the Firefox extension.

1Password

Install 1Password password manager that we use at work. It’s available in the Ubuntu Software app.

Git

Install git.

sudo apt install git

Dotfiles

I don’t have such a huge investment in my dotfiles repository as some people I know, but I still find that repository very valuable. It makes copying configuration from one machine to another trivial.

mkdir -p ~/Documents/github/zeljkofilipin/
git clone git@github.com:zeljkofilipin/dotfiles.git ~/Documents/github/zeljkofilipin/dotfiles

cp ~/Documents/github/zeljkofilipin/dotfiles/.gitconfig ~
cp ~/Documents/github/zeljkofilipin/dotfiles/.mrconfig.ubuntu ~/.mrconfig
cp ~/Documents/github/zeljkofilipin/dotfiles/.ssh/config.ubuntu ~/.ssh/config

SSH

I mostly follow GitHub’s Generating a new SSH key and adding it to the ssh-agent page.

ssh-keygen -t ed25519 -C "computer-name"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
ssh-add -l

Upload the public key to Gerrit, GitHub and GitLab.

Add Gerrit’s, GitHub’s and GitLab’s fingerprints to the known_hosts file.

cp ~/Documents/github/zeljkofilipin/dotfiles/.ssh/known_hosts ~/.ssh/known_hosts

mr

I use mr to automatically update more than 90 repositories every day. On a clean machine, the tool will clone all repositories.

sudo apt install git myrepos
mr u

Docker Engine

MediaWiki-Docker and Fresh (the next two sections) need Docker. I’ve tried Docker Desktop on Linux recently. Unfortunately, MediaWiki-Docker doesn’t work with it. Install Docker Engine instead.

sudo apt-get update

sudo apt-get install \
  ca-certificates \
  curl \
  gnupg \
  lsb-release

sudo mkdir -m 0755 -p /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

DO NOT (!!!) run the last command from the documentation, because it will cause trouble later.

sudo docker run hello-world

Manage Docker as a non-root user

The first command from the documentation is not needed on Ubuntu.

sudo groupadd docker

sudo usermod -aG docker $USER
newgrp docker

Visual Studio Code

Install Visual Studio Code, start it (to create the settings.json file) and copy the configuration file from dotfiles.

sudo snap install code --classic
cp ~/Documents/github/zeljkofilipin/dotfiles/.config/Code/User/settings.json ~/.config/Code/User/settings.json

Install extensions:

Neovim

Install Neovim and VSCode Neovim extension.

sudo apt-get install neovim

The above line will install Neovim v0.7. You will get this error message.

The extension requires neovim 0.8 or greater

Install a newer version of Neovim (v0.9).

sudo add-apt-repository ppa:neovim-ppa/unstable
sudo apt-get update
sudo apt-get install neovim

For more information see Visual Studio Code + Neovim.

MediaWiki-Docker

Install MediaWiki-Docker for the local MediaWiki development environment.

Fresh

I was getting Docker error messages when I tried to install Fresh. Everything worked after a reboot.

Install Fresh for running MediaWiki tests.

Copy the .bashrc file from dotfiles and install the tool.

cp ~/Documents/github/zeljkofilipin/dotfiles/.bashrc ~/.

When the tool is installed, download the container.

fresh-node -env -net

Applications

Install other applications:

7-zip

sudo apt install p7zip

ack

sudo apt-get install ack

Chromium

sudo snap install chromium

ffmpeg

sudo snap install ffmpeg

git-review

sudo apt-get install git-review

Node.js

sudo snap install node --channel=16/stable --classic

Ruby

sudo apt install build-essential ruby ruby-bundler ruby-dev

VLC

sudo snap install vlc

Reviewers

I would like to thank Tyler Cipriani for reviewing the article and for advice on how to make it better.

tags: featured - linux