Ubuntu Environment Setup Memo

Account

Create a regular user with root privileges

BASH
# Operate with root account
adduser <username>
usermod -aG sudo <username>  # Add user to sudo group
# Configure passwordless sudo
visudo
# Append to end of file
<username> ALL=(ALL) NOPASSWD:ALL
Click to expand and view more

zsh

Install fonts first

BASH
# Mac comes with it, no installation needed
sudo apt install zsh
sudo chsh -s /usr/bin/zsh $USER

# No initial configuration needed, configure later with Powerlevel10k

# oh-my-zsh, a zsh configuration framework
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

# Powerlevel10k, an oh-my-zsh theme
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

echo 'source ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc

# Restart shell to enter configuration
Click to expand and view more

Plugins

BASH
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# Enable plugins in ~/.zshrc
plugins=(git sudo z zsh-autosuggestions zsh-syntax-highlighting)
Click to expand and view more

Vim

Install nvim

MacOS

BASH
brew install neovim
# vim ~/.zshrc
alias vim="nvim"
Click to expand and view more

Ubuntu

BASH
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz
# Raspberry Pi is Arm
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-arm64.tar.gz

sudo rm -rf /opt/nvim
sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz

# vim ~/.zshrc
export PATH="$PATH:/opt/nvim-linux-x86_64/bin"
alias vim="nvim"

# sudo nvim
sudo ln -s /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/nvim
Click to expand and view more

LazyVim

BASH
# required
mv ~/.config/nvim{,.bak}

git clone https://github.com/LazyVim/starter ~/.config/nvim
rm -rf ~/.config/nvim/.git
vim  # Will automatically download and install after startup
Click to expand and view more

Other Command Line Tools

bat: Enhanced cat

BASH
# macOS
brew install bat
alias cat="bat -pp"

# Linux
sudo apt install bat
alias cat='batcat -pp'
alias bat='batcat'
Click to expand and view more

eza: Enhanced ls

BASH
# macOS
brew install eza
# Linux
sudo apt install eza

alias ls='eza --color=always --icons'
alias ll='eza -la --color=always --icons --git'
alias la='eza -la --color=always --icons --git'
alias lt='eza --tree --color=always --icons'
alias tree='eza --tree --color=always --icons --level=3'
alias ltree='eza -Tla --color=always --icons --git --level=2 --git-repos'
alias bigtree='eza -Tla --total-size --sort=size --color=always --icons --level=2'
Click to expand and view more

ncdu: Interactive disk usage analyzer, enhanced du

BASH
# macOS
brew install ncdu
# Linux
sudo apt install ncdu

cd /path/to/dir
ncdu  # Use arrow keys to browse, press d to delete selected item
Click to expand and view more

duf: Beautiful df

BASH
# macOS
brew install duf
duf
Click to expand and view more

btop: Enhanced top

BASH
brew install btop
Click to expand and view more

tldr: Skip lengthy man documentation

BASH
brew install tldr
# example
tldr tar
Click to expand and view more

SSH Key

Generate SSH Key on client

BASH
# Windows PowerShell
ssh-keygen -t ed25519 -C "razer-wsl" -f $env:USERPROFILE\.ssh\id_ed25519_razer_wsl

# Ubuntu & MacOS
ssh-keygen -t ed25519 -C "razer-wsl" -f ~/.ssh/id_ed25519_razer_wsl

cat ~/.ssh/id_ed25519_razer_wsl.pub
Click to expand and view more

Python

Just install uv and you’re done

BASH
curl -LsSf https://astral.sh/uv/install.sh | sh
Click to expand and view more

Python Environment Management with UV

If you want to start a python interactive window (REPL) anytime, use uv run python

Samba

Raspberry Pi PLEX server & SMB configuration

Install plex server, download Arm64 installation package from official website

BASH
sudo dpkg -i plexmediaserver_1.41.7.9823-59f304c16_arm64.deb
Click to expand and view more

Install and configure SMB

BASH
sudo apt install samba samba-common-bin

sudo mkdir -p /media/plex
sudo chown isumi:isumi /media/plex
sudo vim /etc/samba/smb.conf
Click to expand and view more

Append to end of SMB configuration file, can additionally set up home sharing

PLAINTEXT
[homes]
   comment = Home Directories
   browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = no

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
   create mask = 0775

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
   directory mask = 0775

# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# The following parameter makes sure that only "username" can connect
# to \\server\username
# This might need tweaking when using external authentication schemes
   valid users = %S

[plex]
    comment = Plex Media
    path = /media/plex
    browseable = yes
    writeable = yes
    only guest = no
    create mask = 0777
    directory mask = 0777
    public = no
    valid users = isumi
Click to expand and view more

Create SMB account and start SMB service

BASH
# isumi is an existing Linux username
sudo smbpasswd -a isumi
sudo systemctl restart smbd
sudo systemctl enable smbd
Click to expand and view more

Access \\IP\plex

Copyright Notice

Author: Aspi-Rin

Link: https://blog.aspi-rin.top/en/posts/ubuntu-environment-setup-memo/

License: CC BY 4.0

This work is licensed under a Creative Commons Attribution 4.0 International License. Please attribute the source.

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut