Getting a web development ready Ubuntu 22.04

Well, «getting a web development ready Ubuntu 20.04» is just the quick title… it should be more like «getting a web development ready Ubuntu 20.04 to have it ready to work in the way I like it»

The first I will do is to install some basic, small and very usefull software:

sudo apt install curl vim gparted synaptic git libgl1-mesa-glx libxcb-xtest0 libxcb-xinerama0 software-properties-common libgdk-pixbuf2.0-0 libpango1.0-0 mesa-utils libegl1-mesa gnome-tweaks chrome-gnome-shell ca-certificates gnupg lsb-release qemu-system-x86 pass uidmap gnome-shell-extension-prefs gnome-shell-extensions libproj22 libzip4 flatpak gnome-software-plugin-flatpak redis-tools plocate gpick

Add flatpack main repo:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Then I would install some snaps

sudo snap install slack redis-desktop-manager robo3t-snap postman && sudo snap install kubectl --classic && sudo snap install helm --classic

And in the meanwhile dowload some .deb packages from Google Chrome, MongoDB Compass, Dropbox, MS teams, Zoom, Insomnia, Nosqlbooster, Mysql Workbench. Install them with apt install:

sudo apt install ./mongodb-compass_*_amd64.deb

Install Docker

sudo install -m 0755 -d /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 \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" 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
sudo usermod -aG docker $USER

Install docker-compose

sudo curl -SL https://github.com/docker/compose/releases/download/v2.7.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod a+x /usr/local/bin/docker-compose

Remember to reboot before running Docker

Download the Jetbrains IDE of your preference unzip the package and create a .desktop shortcut in (or install it using SNAP):

/home/freefri/.local/share/applications/

Next install AWS-cli:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
rm -R ./aws
rm awscliv2.zip
echo "END"

Install OCI cli:

bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
oci --version

Let’s install Tableplus as a mysql client (alternative to mysql workbench)

wget -qO - https://deb.tableplus.com/apt.tableplus.com.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://deb.tableplus.com/debian/21 tableplus main"
sudo apt update

To solve a problem in Ubuntu 22.04:

vim /usr/share/applications/tableplus.desktop
sudo update-desktop-database
sudo gtk-update-icon-cache

Remember to upgrade all packages and snaps.

Install some useful but big software:

sudo apt install gimp inkscape libreoffice

I like to add some user directories inside Dropbox, so Desktop or Downloads get synchronized:

vim ~/.config/user-dirs.dirs

Install NVM:

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.profile

Install NPM

url https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.profile
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install -y nodejs

Install yarn

npm install yarn --global

Add Gmail to «Online accounts» app from ubuntu

Remove unused packages

sudo apt autoremove

Show week numbers on calendar:

gsettings set org.gnome.desktop.calendar show-weekdate true

Install some gnome-shell-extensions like Vertical overview, Custom hot corners extended, Resource monitor,

With Dell Inspiron 16 plus, check how to fix flickering effect.

Photorec file recovery

photorec from testdisk utilities is a great tool available in debian package system to recover files from damaged/deleted disks.

Use Facebook messenger with Pidgin

Facebook said that after some point after April 30 2015, they will shut down Facebook XMPP API — Facebook said API deprecation may take a few weeks — trying to connect to Facebook Chat using an application like Pidgin or Empathy will no longer work and will throw a connection error.

Today was the day when Facebook in Empathy stopped working in my Debian 8 Jessie.

How did I solve it?

I have installed pidgin and https://github.com/jgeboski/purple-facebook and also the gnome extension for Pidgin https://github.com/kagesenshi/gnome-shell-extensions-pidgin

Summarizing the installation of Pidgin, I just had to add a new line to /etc/apt/sources.list

deb http://download.opensuse.org/repositories/home:/jgeboski/Debian_8.0/ /

And then run:

apt-get update
apt-get install pidgin purple-facebook

And for installing the plugin I just run in a command line:

mkdir -p $HOME/.local/share/gnome-shell/extensions
cd $HOME/.local/share/gnome-shell/extensions
git clone git://github.com/muffinmad/pidgin-im-gnome-shell-extension.git pidgin@muffinmad

Then I pressed Alt+F2 and r (to restart gnome shell). Pidgin was then ready to add my new Facebook account under the protocol «Facebook» (don’t use «Facebook XMPP»)

Everything works perfect now (well, at least as good as before with Empathy, but now I’m using Pidgin)

Recover linux from grub rescue

Sometimes something goes wrong with Grub 2 and your Debian, Ubuntu, Mint, etc just does not boot. I’ve got this problem after upgrading Windows 10 (I don’t really get how Windows manages UEFI, it seems a mess, but my Linux boot stopped working)
The only think I could see when trying to boot was grub rescue>

How did I fix it?

I searched online for help and I found some hints.
What I did first was finding out what were my partitions. I wrote the following:

grub rescue > ls

A big list like (hd0) (hd1) (hd1,gpt1) (hd1,gpt2) (hd1,gpt3) (hd1,gpt4) …  (hd1,gpt9) appeared. I knew my linux partition was one of the last ones so I’ve started checking:

grub rescue > ls (hd1,gpt9)/boot
grub rescue > ls (hd1,gpt8)/boot
grub rescue > ls (hd1,gpt7)/boot

After checking the number 7 it returned something like:

./ ../ efi/ vmlinux-3.16-3-amd64 config-3.16-3-amd64 ... etc...

So this was the partition I was looking for.

After that I’ve just run:

grub rescue> set prefix=(hd1,gpt7)/boot/grub
grub rescue> set root=hd1,gpt7
grub rescue> insmod normal
grub rescue> normal

And my linux booted normally to the login screen.

Finally, I opened a root terminal and I reinstall grub (in my case grub-efi because I’am using EFI and not the legacy BIOS boot)

apt-get install --reinstall grub-efi
grub-install /dev/sda
update-grub

A nice link:

https://wiki.debian.org/GrubEFIReinstall

Recuperar Grub 2 desde un live-CD

Consiste en usar una distribución en modo LiveCD para instalar nuevamente el GRUB. Usaremos el LiveCD de Ubuntu 9.10 o superior (debe ser la versión Live o Desktop), aunque puede ser cualquier otra distribución que use GRUB2 como gestor de arranque y no LILO ni Grub 1.

Lo primero que debemos hacer es arrancar el live-cd y abrir una terminal. Despues escribimos los siguiente para ver las particiones de los distintos discos duros:

$ sudo fdisk -l 

Después vemos cual es la partición donde tenemos Ubuntu y la montamos en /mnt (en la mayoría de los casos esta partición será sda1, el ejemplo lo haré con esa partición pero mira cual es tu partición con el comando fdisk):

$ sudo mount /dev/sda1 /mnt 

Ahora, monta el resto de los dispositivos:

$ sudo mount --bind /dev /mnt/dev
$ sudo mount --bind /dev/pts /mnt/dev/pts
$ sudo mount --bind /proc /mnt/proc
$ sudo mount --bind /sys /mnt/sys

Y ejecuta el comando chroot de forma que accedemos como root al sistema de archivos de nuestro antiguo Ubuntu:

$ sudo chroot /mnt

Por último cargamos el Grub en el MBR ejecutando el siguiente comando:

grub-install --boot-directory=/boot/ --recheck /dev/sda

(sda lo debemos substituir por el disco duro que utilizamos para arrancar los sistemas operativos, casi siempre es sda. Ojo!! no poner el número de partición, solo sda).

Reiniciamos y cuando vuelva a arrancar ubuntu (no el del LiveCD), podemos ajustar en el menú del GRUB manualmente para que aparezca en el menú de arranque el nuevo sistema operativo que nos borró el MBR, o dejar que lo haga el automáticamente con el siguiente comando:

$ sudo update-grub2

Si el comando no te funciona, quizás necesites instalar el paquete grub2:

$ sudo apt-get install grub2

Si tienes la /boot en partición independiente, después de montar el sistema de archivos en /mnt (con el comando sudo mount /dev/sda1 /mnt), debes montar también la partición boot con el siguiente comando:

$ sudo mount /dev/sda2 /mnt/boot

Enlaces interesantes

https://www.linux.com/learn/tutorials/776643-how-to-rescue-a-non-booting-grub-2-on-linux/

Cursos (promocionado)

Cursos de castellano al mejor precio. CourseTicket es el lider del mercado austríaco ofreciendo cursos y seminarios de todo tipo, desde cursos de cocina, clases de fitness o cursos de idiomas. Tras varios años en Austria y Alemania, Courseticket busca entrar en el mercado español ofreciendo cursos de castellano para extranjeros. Tanto si quieres comprar un curso como vender tus propios cursos, entra en courseticket.com

También disponibles cursos técnicos como medicina y ecografía doppler.

How to enable fan control in Debian Wheezy for Asus p8z77

Download this patch and compile it with make and make install https://github.com/groeck/nct6775

Add nct6775 into /etc/modules

Follow this answer http://askubuntu.com/questions/22108/how-to-control-fan-speed#answer-46135
In the step 3 you can use /etc/init.d/kmod start To load the modules without rebooting the system

My color prompt in Debian Wheezy

This is my new full color prompt for my user.

Just edit ~/.bashrc where PS1 is defined and add this:

PS1='${debian_chroot:+($debian_chroot)}\[33[01;32m\]\u@\[33[01;33m\]\h\[33[0;32m\]<\[33[0;31m\]${?#0}\[33[32m\]>\[33[0;36m\]\w \$\[33[00m\] '

GNU Screen

Full screen window manager that multiplexes a physical terminal between several processes (typically interactive shells).

Debian package: screen

Info: http://www.debian-administration.org/articles/34

Quick command list:

screen
Run a new screen session
screen -DRA Reattach to a previously detatched session adapting the size of the windows
screen -ls List sessions
screen -wipe <session> Delete a session
Ctrl-a c Create a new window.
Ctrl-a k Kill the current window – after confirmation
Ctrl-a Ctrl-a Switch to the other window
Ctrl-a S Split the current window in two.
Ctrl-a TAB Move between split sections of the screen.
Ctrl-a A Give the the current window a name.
Ctrl-a » List all windows – move around to change the window with the arrow keys