Skip to content

Instantly share code, notes, and snippets.

@Sp0ne
Last active October 26, 2023 14:09
Show Gist options
  • Save Sp0ne/8e2a204f3921b9d6dd1b137819dd64c2 to your computer and use it in GitHub Desktop.
Save Sp0ne/8e2a204f3921b9d6dd1b137819dd64c2 to your computer and use it in GitHub Desktop.
Ubuntu set up memo

Quickly setup Ubuntu ·

🚨 Important : This Stack is build for PERSONAL LOCAL development and NOT FOR PRODUCTION USAGE

Global

update list source

sudo apt-get update

Git

# Install
sudo apt-get install git

# Configure
git config --global user.email "progster@gmail.com"
git config --global user.name "Niels Vandekeybus"

# Check
git --version

Tools

sudo apt-get install htop curl zip unzip make rsync

Terminator & ohmyzsh

Terminator & zsh

sudo apt-get install terminator
sudo apt-get install zsh

# check shell install in the computer
cat /etc/shells

# set zsh as your default shell
chsh -s $(which zsh)

ohMyZsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Icons

solve problems termainal icon

sudo apt install fonts-powerline

Plugins

Activate the plugin in ~/.zshrc: plugins=( git zsh-autosuggestions zsh-syntax-highlighting)

Theme

  • Theme Spaceship
    • Activate the plugin in ~/.zshrc:
    • Set ZSH_THEME="spaceship" in your .zshrc.
    • Modify your your ~/.config/terminator/config:
      • Under the [global config] section, set always_split_with_profile = True
      • Add the fragment below in [Profiles] section
# ~/.config/terminator/config
[global_config]
  extra_styling = False
  tab_position = hidden
  title_transmit_bg_color = "#4e9a06"
  suppress_multiple_term_dialog = True
  always_split_with_profile = True
[keybindings]
[profiles]
  [[default]]
    icon_bell = False
    background_color = "#282c34"
    background_darkness = 0.98
    cursor_color = "#bbbbbb"
    foreground_color = "#abb2bf"
    show_titlebar = False
    scrollbar_position = hidden
    palette = "#000000:#eb6e67:#95ee8f:#f8c456:#6eaafb:#d886f3:#6cdcf7:#b2b2b2:#50536b:#eb6e67:#95ee8f:#f8c456:#6eaafb:#d886f3:#6cdcf7:#dfdfdf"
[layouts]
  [[default]]
    [[[child0]]]
      type = Window
      parent = ""
      order = 0
      position = 100:100
      maximised = False
      fullscreen = False
      size = 900, 600
      title = sp0ne@sp0ne: ~
      last_active_term = 3819f1d0-6f1f-4209-8f6a-033fb24e722e
      last_active_window = True
    [[[terminal1]]]
      type = Terminal
      parent = child0
      order = 0
      profile = default
      uuid = 3819f1d0-6f1f-4209-8f6a-033fb24e722e
[plugins]

Other

Symlink /var/www/

sudo ln -s /var/www /home/USER/www

Clean linux

Check size human readable

# display the disk usage of the first-level subdirectories
sudo du -shc /var/*

# print the 5 largest directories within the /var directory
sudo du -h /var/ | sort -rh | head -5

Misc

sudo apt autoremove
sudo apt autoclean

Clear systemd journal logs

# check the log size
journalctl --disk-usage

# clear the logs that are older than certain days
sudo journalctl --vacuum-time=10d

Clear older versions of Snap applications

# check the size of older versions of Snap applications 
du -h /var/lib/snapd/snaps

# check all snap application
echo && snap list --all && echo && df -Th | grep -Ev "tmpfs|squashfs"

and create a new shell script: clean_older_version_snap_app.sh

#!/bin/bash
# Removes old revisions of snaps: https://itsfoss.com/free-up-space-ubuntu-linux/
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
snap list --all | awk '/désactivé|disabled/{print $1, $3}' |
    while read snapname revision; do
        snap remove "$snapname" --revision="$revision"
    done

and run it: sudo bash clean_older_version_snap_app.sh


PHPStorm


Docker

Official install

sudo apt-get update

# follow [Official install](https://docs.docker.com/engine/install/ubuntu/)
# ...
# sudo apt-get install docker-ce docker-ce-cli containerd.io
# ...

# add docker to group:
sudo usermod -aG docker ${USER}

# reload group membership:
su - ${USER}

# check group membership
id -nG

sudo apt install docker-compose

🚨 Docker-Compose can't connect to Docker Daemon

docker info

Surprinsingly, I had the following error :

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http:///var/run/docker.sock/v1.38/info: dial unix /var/run/docker.sock: connect: permission denied

For some reason I did not have enough privileges, the following command solved my problem :

sudo chown $USER /var/run/docker.sock

Kubernetes

Install Kubectl

Official install

or

sudo snap install kubectl --classic

Install K9s (optionnal)

tar xzvf k9s_Linux_amd64.tar.gz && mv k9s /usr/local/bin

Testez pour vous assurer que la version que vous avez installée est à jour

kubectl version --client

Créer un folder pour les configs

mkdir .kube

Et voilà !


🍻 Have Fun ! </> with ❤ by @Sp0ne - Lead Developer - vinces.io


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment