Skip to content

Instantly share code, notes, and snippets.

@nonodev96
Last active March 24, 2025 14:24
Show Gist options
  • Select an option

  • Save nonodev96/cf61118f6999054ac8321c7d6a36db4f to your computer and use it in GitHub Desktop.

Select an option

Save nonodev96/cf61118f6999054ac8321c7d6a36db4f to your computer and use it in GitHub Desktop.
ubuntu-install.md

Set time

timedatectl set-timezone Europe/Madrid

WSL

# wslu - A collection of utilities for WSL https://github.com/wslutilities/wslu
sudo apt install wslu

Update

sudo apt update
sudo apt full-upgrade
sudo apt install ubuntu-restricted-extras

Lang

sudo dpkg-reconfigure locales

sudo locale-gen es_ES.UTF-8
export LANG=es_ES.UTF-8
echo "export LANG=es_ES.UTF-8" >> .zshrc
man -Les man
man man

Install utils

sudo apt install -y tmux git unzip curl wget fail2ban
sudo apt install -y ncdu

sudo apt install -y software-properties-common apt-transport-https
sudo apt install -y ssh 
sudo apt install -y pssh 

# htop, nvtop, ctop
sudo apt install -y atop 
sudo apt install -y htop
sudo apt install -y nvtop
sudo apt install -y bashtop
sudo apt install -y glances

sudo wget https://github.com/bcicen/ctop/releases/download/v0.7.7/ctop-0.7.7-linux-amd64 -O /usr/local/bin/ctop
sudo chmod +x /usr/local/bin/ctop

# sudo apt install -y ctop

# Mouse in ubuntu server (General Purpose Mouse interface)
sudo apt install -y gpm

# hardware
sudo apt install hwinfo

# iostat 

sudo apt install -y nmon sysstat 
# nmon documentation https://www.ibm.com/docs/en/aix/7.2?topic=n-nmon-command
sudo apt install net-tools network-manager

ACLS y permisos

sudo apt install -y acl

# Guardar los permisos en un archivo
getfacl -R /ruta/del/directorio > permisos_backup.acl

# Restaurar los permisos más tarde
setfacl --restore=permisos_backup.acl

AuditD

sudo apt install -y auditd

# Gestionar demonio
sudo systemctl start auditd
sudo systemctl enable auditd
sudo systemctl status auditd

# Comprobar soporte para del kernel, puede no tener soporte y no poder auditar
cat /proc/cmdline
# Si ves audit=0, significa que la auditoría está deshabilitada. Para habilitarla, agrega audit=1 a los parámetros del kernel en /etc/default/grub y actualiza GRUB:

# Crear un logger asociado a un programa
sudo auditctl -w /usr/bin/docker -p x -k docker_run_exec

# Busqueda por el logger
sudo ausearch -k docker_run_exec

# Mostrar logs
grep "docker run" /var/log/auth.log   # Debian/Ubuntu

# Mostrar los usuarios en ejecutar docker recientemente
grep "docker" /var/log/auth.log | awk '{print $1, $2, $3, $NF}'

Install and use SCREEN

sudo apt install -y screen
How to use screen command

Iniciar una sesión con screen en una máquina remota

screen -S nombre_sesion

Desconectarse de la sesión iniciada y de la máquina remota

nonodev96@maquina_remota:~$ foo
SALIDA COMANDO foo
CTRL+a d
[detached from nombre_sesion]
nonodev96@maquina_remota:~$ exit
logout
Connection to maquina_remota closed.
nonodev96@maquina_local:~$

Volver a conectarse a una sesión iniciada en la máquina remota

screen -r nombre_sesion

Cerrar una sesión de screen

nonodev96@maquina_remota:~$ bar
SALIDA bar
La ejecución finalizó sin errores.
nonodev96@maquina_remota:~$
CTRL+a k
[screen is terminating]
nonodev96@maquina_remota:~$ exit
logout
Connection to maquina_remota closed.
nonodev96@maquina_local:~$

Install Chrome

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb

Install essential

sudo apt install build-essential gdb

Install security

sudo apt install -y needrestart apt-listchanges apt-listbugs apt-show-versions

sudo apt install -y lynis
sudo lynis audit system

sudo apt install -y chkrootkit
sudo chkrootkit

sudo apt install -y libpam-tmpdir debsums

sudo ufw enable

sudo apt-get install clamav clamav-daemon
sudo systemctl stop clamav-freshclam
sudo freshclam
sudo systemctl start clamav-freshclam
sudo systemctl enable clamav-freshclam

Install sdkman (Java SDK Manager)

curl -s "https://get.sdkman.io" | bash

Install miniconda (Python Manager)

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /opt/miniconda-installer.sh
bash /opt/miniconda-installer.sh

Install pyenv (Python Manager)

curl https://pyenv.run | bash
Dependencies and configuration

Dependencies

sudo apt install python3-pip
# dependencies
sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

Configuration

Add to ~/.bashrc or ~/.zshrc

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
Install Anaconda (Optional)
sudo apt install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6

Anaconda


Install nvm (Node Manager)

Manual installing and updating

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

Install ZSH

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
plugins=(git zsh-syntax-highlighting zsh-autosuggestions zsh-completions)

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
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-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions

Install Spotify

curl -sS https://download.spotify.com/debian/pubkey_0D811D58.gpg | sudo apt-key add - 
echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt update && sudo apt install spotify-client

Install Media

sudo snap install vlc

Install Docker

sudo apt-get install apt-transport-https ca-certificates curl gnupg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.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

Install LANDO

wget https://files.devwithlando.io/lando-stable.deb
sudo dpkg -i lando-stable.deb

Install dotnet

wget https://packages.microsoft.com/config/ubuntu/22.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-7.0
  
sudo apt-get update && \
  sudo apt-get install -y aspnetcore-runtime-7.0

Install RUST

sudo apt update
sudo apt upgrade
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
rustc --version

Installs others

# gparted
sudo apt install gparted
# evolution
sudo apt install evolution
# clamav
sudo apt install clamav
# ulauncher
sudo add-apt-repository ppa:agornostal/ulauncher && sudo apt update && sudo apt install ulauncher
# typora
wget -qO - https://typora.io/linux/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/typora.asc
sudo add-apt-repository 'deb https://typora.io/linux ./' && sudo apt-get update && sudo apt-get install typora

Install

sudo dpkg -i DEB_PACKAGE

ALias

function cd() {
  builtin cd "$@"

  if [[ -z "$VIRTUAL_ENV" ]] ; then
    ## If env folder is found then activate the vitualenv
      if [[ -d ./.env ]] ; then
        source ./.env/bin/activate
      fi
      if [[ -d ./venv ]] ; then
        source ./venv/bin/activate
      fi
  else
    ## check the current folder belong to earlier VIRTUAL_ENV folder
    # if yes then do nothing
    # else deactivate
      parentdir="$(dirname "$VIRTUAL_ENV")"
      if [[ "$PWD"/ != "$parentdir"/* ]] ; then
        deactivate
      fi
  fi
}

References

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