PERSONAL UBUNTU SET-UP


1. SYSTEM SET-UP

  • sudo apt update
  • sudo apt install xfce4
  • sudo apt install lightdm

1.1. Accented Characters

  1. sudo apt install gnome-tweaks
  2. Applications → Paramètres → Gestionnaire de paramètres → Clavier → Layout → compose key → Right Ctrl
  3. Reboot

1.2. Customizing the Touch Pad

To avoid clicking on everything each time one uses the touch pad:

  1. Settings manager → mouse and touchpad → touchpad
  2. Unselect "Tap touchpad to click"
  3. Unselect "Reverse scroll direction"

1.3. Terminal

I make Tilix my default terminal:

  1. sudo apt install tilix
  2. exo-preferred-applications → utilities → choose tilix
  3. C-M-t → open tilix
  4. Click on the preference icon:
    1. Global → Automatically copy text to clipboard when selecting
    2. Appearance → window style → disable CSD / hide toolbar
    3. Appearance → Theme variant → Dark
    4. Appearance → Default session name → Terminal
    5. Appearance → Terminal title style → None
    6. Appearance → Application title → \({hostname}:\){directory} [\({columns}x\){rows}]
    7. Default → General → Terminal size → 100 60
    8. Default → General → Custom font : Monospace 10
    9. Default → Command → Run command as a login shell

1.4. Windows

Applications → Window manager

  1. Style → Greybird-dark-accessibility
  2. Keyboard → maximize window Alt-Fn-F10
  3. Keyboard → move window Alt-Fn-F7
  4. Keyboard → resize window Alt-Fn-F8
  5. Keyboard → show desktop → Alt-F9
  6. Keyboard → Move window to left workspace → Shift-Ctrl-Alt-Left
  7. Keyboard → Move window to right workspace → Shift-Ctrl-Alt-Right

1.5. Drivers Nvidia

  1. sudo apt install nvidia-driver-455
  2. Reboot

1.6. Background Image

Applications → Desktop → select an image

1.7. GPG Keys

sudo apt install gnupg2

1.8. OwnCloud

  1. sudo apt install gnome-keyring
  2. sudo apt install python3-keyring
  3. Follow the instructions on: https://download.owncloud.com/desktop/ownCloud/stable/latest/linux/download/ and make sure that the owncloud files in /etc/apt/sources.list.d/ and in /etc/apt/trusted.gpg.d/ have -r--r--r-- permissions:

    sudo chmod go+r /etc/apt/sources.list.d/owncloud.list
    sudo chmod go+r /etc/apt/trusted.list.d/owncloud.gpg
    
  4. Launch /opt/ownCloud/ownCloud/bin/owncloud
  5. Connection server: https://mycore.core-cloud.net
  6. User: xxxxxxxx.xxxxxxxx@cea.fr
  7. Password: specific.

1.9. Eduroam

  1. Launch ~/ownCloud/Ordinateurs/Eduroam/eduroam-linux-eduroam.py
  2. Configure the WIFI:
    Sécurité:
    WPA et WPA2 d'entreprise
    Authentification:
    TLS avec tunnel (TTLS)
    Identitié masquée:
    anonymous@eduroam.cnrs.fr
    Certificat CA:
    ~/.cat_installer/ca.pem
    Authetification interne:
    PAP
    Nom d'utilisateur:
    ae78hm@eduroam.cnrs.fr
    Mot de passe:
    secret sentence (see in ~/ownCloud/Ordinateurs/Eduroam/eduroam.org)

1.10. Forticlient

  1. sudo apt remove forticlientsslvpn-cea
  2. sudo dpkg -i ~/ownCloud/AIM_Dap/forticlientsslvpn-cea_4.4.2342_amd64.deb
  3. Accept the license
  4. Close the graphical interface without filling the form
  5. Launch the VPN with the command fortisslvpn_cli --server mobietendu-ea.cea.fr:443 --vpnuser xxxxxxxx@extra.cea.fr (alias vpncea)
  6. Password is the extra password
  7. C-c to quit

1.11. Disks

1.11.1. Partition of the primary disk

  1. sudo fdisk -l
  2. sudo lvresize -r -L 80G /dev/mapper/crypt-root
  3. sudo lvresize -r -L 10G /dev/mapper/crypt-var
  4. sudo lversize -r -L 800G /dev/mapper/crypt-home

1.11.2. Formatting and mounting the secondary disk

  1. sudo fdisk /dev/nvme1n1
    • g
    • w
  2. sudo fdisk /dev/nvme1n1
    • n
    • default sectors
    • w

1.11.3. Crypting partitions

  1. Create the crypted partition: sudo cryptsetup --cipher aes-xts-plain --key-size 512 --hash sha512 -v luksFormat /dev/nvme1n1
  2. Type a password sentence

1.11.4. Putting everything together

Open the crypted partition:
sudo cryptsetup -v luksOpen /dev/nvme1n1 Disk2.
Type:
password sentence
Create a filesystem:
sudo mkfs -t ext4 -L LuksPartition /dev/mapper/Disk2.
Mount the partition
sudo mount /dev/mapper/Disk2 /mnt/data
Create a backup
sudo cryptsetup -v luksHeaderBackup /dev/nvme1n1 --header-backup-file LuksHeaderBackup_data.bin

1.11.5. Automatically mount a crypted partition

  1. Create a random key
    1. Create the directory /etc/luks-keys if it does not exist
    2. sudo chmod go-rwx /etc/luks-keys
    3. sudo dd if=/dev/urandom of=/etc/luks-keys/Disk2_key bs=512 count=8
  2. Add the random key
    1. sudo cryptsetup -v luksAddKey /dev/nvme1n1 /etc/luks-keys/Disk2_key
    2. Change the rights of Disk2_key to have -r--------
    3. Test the key: sudo cryptsetup -v luksOpen /dev/nvme1n1 Disk2 --key-file=/etc/luks-keys/Disk2_key
    4. Close the partition: sudo cryptsetup -v luksClose Disk2
  3. Automatically open the volume
    Print the UIID volume:
    sudo cryptsetup luksDump /dev/nvme1n1 | grep "UUID"
    Edit /etc/crypttab:
    add the line Disk2 UUID=d98a244a-1aac-4ab7-965d-936aa0c61eeb /etc/luks-keys/Disk2_key luks
    Check everything is OK:
    sudo cryptdisks_start Disk2.
  4. Automatically mount the disk

    Add in /etc/fstab: /dev/mapper/Disk2 /mnt/data ext4 defaults 0 2

1.12. Swap

  • sudo swapoff -a
  • sudo dd if=/dev/zero of=/swapfile bs=1G count=10
  • sudo chmod 0600 /swapfile
  • sudo mkswap /swapfile
  • sudo swapon /swapfile
  • grep Swap /proc/meminfo
  • Add /swapfile swap swap sw 00 at the end of /etc/fstab

1.13. Sleep issue on CEA laptops

  1. sudo apt install pm-utils
  2. Use pm-suspend in place of systemctl suspend

1.14. Printing with CUPS

  1. sudo vi ~/.cups/client.conf (a priori, the file does not exist)
  2. Write in the file: servername sapprint.extra.cea.fr

1.15. Sync Google calendars

  1. crontab -e (without sudo)
  2. Add the line 0 0,12 * * * ~/ownCloud/Organisation/sync_gcal.sh

1.16. Date format

  1. sudo vi /etc/default/locale
  2. Edit:
LANG="=fr_FR.UTF-8="
LANGUAGE="=fr_FR:en_US="
LC_ALL="=fr_FR.UTF-8="
  1. Reboot
  2. When restarting, the system asks if we want to keep the directory names (Desktop/, Pictures/, etc.) in English ⇒ answer yes

1.17. BIOS Update & Firmware

  1. sudo service fwupd start
  2. sudo fwupdmgr refresh
  3. sudo fwupdmgr update

2. SOFTWARE

2.1. Web Browser

2.1.1. Firefox

  • Installed by default
  • Sync the keywords and bookmarks

2.1.2. Brave

  • sudo apt install apt-transport-https curl
  • sudo curl -sS https://brave-browser-apt-release.s3.brave.com/brave-core.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/brave-browser-release.gpg
  • echo "deb [signed-by=/etc/apt/trusted.gpg.d/brave-browser-release.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
  • Make sure that the brave files in /etc/apt/sources.list.d/ and in /etc/apt/trusted.gpg.d/ have -r--r--r-- permissions:

    sudo chmod go+r /etc/apt/sources.list.d/brave-browser-release.list
    sudo chmod go+r /etc/apt/trusted.list.d/brave-browser-release.gpg
    
  • sudo apt update
  • sudo apt install brave-browser
  • Sync the keywords and bookmarks
  • Make Brave the default browser: xdg-settings set default-web-browser brave-browser.desktop

2.1.3. Chrome

  • sudo sh -c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list'
  • wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
  • sudo apt update
  • sudo apt install google-chrome-stable

2.2. Emacs

  • sudo apt install emacs works well, but some packages downloaded with melpa might be more recent and cause bugs. For the February 2024 installation I made, apt was giving me emacs 27.1, while I needed version 28 to make auctex work. I thus installed emacs from the repo:
  • sudo apt remove --autoremove emacs emacs-common
  • sudo add-apt-repository ppa:kelleyk/emacs
  • sudo apt update
  • sudo apt emacs28
  • Remove everything within ~/.emacs.d/, except lisp and init.el.

2.2.1. Packages installed with MELPA (in ~/.emacs.d/elpa/)

Install with M-x list-packages.

  • auctex
  • auctex-latexmk
  • auctex-lua
  • calfw
  • calfw-ical
  • calfw-org
  • elpy
  • fortpy
  • guide-key
  • helm-bibtex
  • htmlize
  • hydra
  • neotree
  • org
  • org-bullets
  • org-super-agenda
  • pdf-tools
  • rainbow-mode
  • symon
  • use-package
  • guess-language
  • gnus (built-in)
  • recentf (built-in)
  • saveplace (not found anymore)
  • paren (not found anymore)
  • printing (built-in)
  • org-msg
  • smtpmail (not found anymore)
  • dired-subtree
  • dired-rainbow
  • rainbow-delimiters
  • php-mode
  • tablist (dependency)
  • let-alist (built-in)
  • gnu-elpa-keyring-update
  • highlight-indent-guides

2.2.2. Packages installed by hand (in ~/.emacs.d/lisp/)

  • template
  • org-msg
  • org-faces
  • grammalecte-cache

For each .el in the directory, do M-x byte-compile <file>. If the file .el is not available, download it from GitHub.

2.2.3. Dictionnaries for spell-checking

  1. sudo apt install ispell.
  2. hunspell -D → lists the dictionnaries already installed and their location (/usr/share/hunspell/).
  3. Download dictionnaries from the LibreOffice extension repository.
  4. Extract the .aff and .dic files from the .oxt archives:

    unzip lo-oo-ressources-linguistiques-fr-v5-7.oxt -d dict-fr
    sudo cp dict-fr/*/*.aff dict-fr/*/*.dic /usr/share/hunspell/
    rm -r dict-fr
    
  5. Since we use the default local variables fr_FR, our main French dictionnary should be renamed:

    sudo cp /usr/share/hunspell/fr-classique.aff /usr/share/hunspell/fr_FR.aff
    sudo cp /usr/share/hunspell/fr-classique.dic /usr/share/hunspell/fr_FR.dic
    

2.2.4. For emails

  • sudo apt instal isync (for mbsync, the software retrieving the mails from the server)
  • sudo apt install altermime (with default settings in the dialog)
  • sudo apt install html2text
  1. Mu (powerful email search tool)
    1. New mu install (works in 22.04)
      • sudo apt install xapian-tool
      • sudo apt install maildir-tools
      • sudo apt install mu4e
    2. Old mu install
      • Prior to that, you need to install meson and other libraries (look at the Github page). However, do not do that using the --user option in pip3. Do it as sudo, otherwise it won't work when you will do sudo make install.
      • sudo apt install libssl-dev
      • Install cmake from the repo (not using apt; the version is not high enough)
      • sudo apt install guile-3.0
      • sudo apt install graphviz
      • sudo apt install doxygen
      • sudo apt install help2man
      • sudo apt install python3-docutils
      • sudo apt install libmagic-dev
      • sudo apt install bison
      • sudo apt install libcld2
      • Download xapian-core from Github and install it.
      • Download tarball from https://github.com/djcb/mu
      • Follow the instruction to manually install mu
    3. Setting-up mu
      • mkdir ~/mail
      • mkdir ~/mail/CNRS
      • mu init --maildir=~/mail --my-address=xxxxxxxx.xxxxxxxx@cea.fr --my-address=xxxxxxxx.xxxxxxxx@cnrs.fr
      • mu index

      It can be used on the command line to search emails, e.g. mu find coucou. To list the contacts: mu cfind.

  2. Create a certificate
    1. mkdir -p ~/.cert
    2. openssl s_client -connect imap.cnrs.fr:993 -showcerts 2>&1 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sed -ne '1,/-END CERTIFICATE-/p' > ~/.cert/imap.cnrs.fr.pem
  3. Configuration of mbsync
    1. Create the ~/.mbsyncrc file (always the same)
    2. Create a crypted password file with gpg2:
      1. Create ~/tmp file with:

        machine imap.cnrs.fr login xxxxxxxx.xxxxxxxx@ods.services password XXX
        machine smtp.cnrs.fr login xxxxxxxx.xxxxxxxx@ods.services password XXX
        machine imap.extra.cea.fr login xxxxxxxx password XXX
        machine mx.extra.cea.fr login xxxxxxxx password XXX
        machine imap.sfr.fr login xxxxxxxx.xxxxxxxx@neuf.fr password XXX
        machine smtp.sfr.fr login xxxxxxxx.xxxxxxxx@neuf.fr password XXX
        
      2. gpg2 --output .authinfo.gpg --symmetric tmp
      3. rm ~/tmp
    3. It can be used on the command line, without going through emacs: mbsync -aV ⇒ sync all mailboxes. This is what emacs spawns.
  4. Trouble shooting

    If the certificate changes, run:

    openssl s_client -connect imap.cnrs.fr:993 -showcerts 2>&1 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sed -ne '1,/-END CERTIFICATE-/p' > ~/.cert/imap.cnrs.fr.pem
    

2.3. LaTeX et MusiXTeX

sudo apt install texlive-full

2.3.1. Extra fonts

  • sudo apt install texlive-latex-extra fonts-arabeyes fonts-kacst
  • sudo apt install fontforge
  • sudo apt install cabextract
  • wget https://gist.github.com/maxwelleite/10774746/raw/ttf-vista-fonts-installer.sh -q -O - | sudo bash
  • fc-list | grep Calibri

2.4. Git

sudo apt install git-all

2.5. Fortran

sudo apt install gfortran

2.5.1. HDF5

  1. Required libraries
    1. sudo apt-get install debhelper
    2. sudo apt-get install sharutils
    3. sudo apt-get install chrpath
    4. sudo apt-get install php-cli
    5. sudo apt-get install libaec-dev
  2. Install from source code
    1. Download the archive from: https://www.hdfgroup.org/downloads/hdf5/source-code/
    2. cd ~/Downloads
    3. gunzip < hdf5-X.Y.Z.tar.gz | tar xf -
    4. cd hdf5-X.Y.Z
    5. sudo ./configure --prefix=/usr/local/hdf5 --enable-fortran
    6. sudo make
    7. sudo make check
    8. sudo make install
    9. sudo make check-install
    10. rm -r hdf5-XXX*

2.6. Python

2.6.1. Standard

  1. sudo apt install ipython3
  2. sudo apt install python3-pip
  3. Modules (without sudo):
    1. pip install numpy
    2. pip install scipy
    3. apt install tk-dev (for matplotlib)
    4. pip install matplotlib
    5. pip install astropy
    6. pip install h5py
    7. pip install drawSvg
    8. pip install csv
    9. pip install PyPDF2
    10. pip install datetime
    11. pip install pandas
    12. pip install reproject
    13. pip install photutils
    14. pip install scikit-learn

2.6.2. Anaconda

  1. Download anaconda from https://www.anaconda.com/products/individual
  2. sha256 Anaconda-2021.11-Linux-x86_64.sh
  3. bash Anaconda-2021.11-Linux-x86_64.sh
  4. Don't care about the PYTHONPATH warning
  5. Once the installation is finished, a paragraph has been added in ~/.bashrc:
    1. Add conda config --set auto_activate_base false after it
    2. If it is not there, add the call to bashrc.sh (aliases) after that.
  6. To install a package: conda install matplootlib
  7. To turn off the annoying prompt: conda deactivate

2.6.3. Nerd-dictation

  • pip3 install vosk
  • sudo apt install xdotool
  • git clone https://github.com/ideasman42/nerd-dictation.git
  • cd nerd-dictation
  • wget https://alphacephei.com/kaldi/models/vosk-model-small-en-us-0.15.zip
  • unzip vosk-model-small-en-us-0.15.zip
  • mv vosk-model-small-en-us-0.15 model
  • mv ~/nerd-dictation ~/bin/
  • mkdir -p ~/.config/nerd-dictation
  • mv ./model ~/.config/nerd-dictation
  • Then also download larger models from https://alphacephei.com/vosk/models

2.6.4. Extra fonts

  • sudo apt install font-manager
  • sudo apt install fonts-comic-neue
  • sudo apt install fonts-humor-sans
  • sudo apt install ttf-mscorefonts-installer
  • Download the xkcd fonts (https://github.com/ipython/xkcd-font/tree/master)
  • Install them:

    sudo mkdir /usr/share/fonts/truetype/xkcd
    sudo cp ~/Downloads/xkcd.otf /usr/share/fonts/truetype/xkcd/
    sudo cp ~/Downloads/xkcd-script.ttf /usr/share/fonts/truetype/xkcd/
    sudo cp ~/Downloads/xkcd-Regular.otf /usr/share/fonts/truetype/xkcd/
    sudo fc-cache -f -v
    
  • Eventually clean the matplotlib cache: rm -r ~/.cache/matplotlib

2.7. IDL

  1. cd $idlib ;
  2. tar -xzvf idl70pluslicense.tar.gz
  3. sudo mkdir /usr/local/itt
  4. sudo chmod a+rx /usr/local/itt
  5. cd /usr/local/itt
  6. sudo tar -xzvf $idlib/idl70linux.x86.tar.gz
  7. sudo ./install (no DICOM)
  8. Copy the directory license in /usr/local/itt/license: sudo cp -r $idlib/license/ /usr/local/itt/
  9. Install the following 32 bit librarires:
    • sudo apt install libxmu6:i386
    • sudo apt install libxpm4:i386
    • sudo apt install libgtk2.0-0:i386
    • wget http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/multiarch-support_2.27-3ubuntu1.2_amd64.deb (not available anymore, instead sudo apt install binutils-multiarch)
    • sudo dpkg -i multiarch-support_2.27-3ubuntu1.2_amd64.deb
    • sudo dpkg -i $idlib/libxp6_1.0.2-1ubuntu1_amd64.deb
    • sudo apt install libxft2:i386
    • sudo apt install libstdc++5:i386
    • sudo apt install libc6-i386
    • sudo apt install libxtst6:i386
    • sudo apt install lib32z1
  10. To install libxp6, you need to install multiarch-support:
    • wget http://archive.ubuntu.com/ubuntu/pool/main/g/glibc/multiarch-support_2.27-3ubuntu1_amd64.deb
    • sudo apt install ./multiarch-support_2.27-3ubuntu1_amd64.deb
  11. To use the 64 bit version, install libxp6 (Debian package included in the directory $idlib): sudo dpkg -i libxp6_1.0.2-1ubuntu1_amd64.deb
  12. Add in the .bashrc:
    • only if LD_LIBRARY_PATH is empty: LD_LIBRARY_PATH=/usr/local/lib
    • then: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/itt/idl/bin/bin.linux.x86_64
    • and: export LD_LIBRARY_PATH
  13. Open IDL launching /usr/local/itt/idl/bin.linux.x86_64/idl

2.8. PDF

2.8.1. Readers

  1. sudo apt install okular
  2. sudo apt install qpdfview
  3. sudo apt install qpdf
  4. sudo apt install pdfsam
  1. XPDF
    • sudo apt install qt5-default
    • Download and compile xpdf from the repo

2.8.2. Have hyperlinks open with Brave

  1. sudo kcmshell5 filetypes
  2. Select text > html
  3. Put Brave on top of the list

2.8.3. PDF Presenter Console

sudo apt install pdfpc

2.8.4. Converting HTML to PDF

sudo apt install wkhtmltopdf

2.8.5. Universal converter

sudo apt install pandoc

2.8.6. PDFArranger

To rearrange the pages of a PDF:

  1. sudo add-apt-repository ppa:linuxuprising/apps
  2. sudo apt update
  3. sudo apt install pdfarranger

2.9. Zoom

  1. Download the package from https://zoom.us/download?os=linux
  2. sudo dpkg -i zoom_amd64.deb
  3. Launch Zoom
  4. Identification: SSO
  5. Domaine: u-paris.zoom.us
  6. We are then redirected toward the authentification page from the University

2.10. Dropbox

  • cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
  • ~/.dropbox-dist/dropboxd

2.11. Images

2.11.1. ImageMagick

It is installed by default (instruction convert on the command line). However, it does not work on PS and PDF, by default. To fix this issue, edit /etc/ImageMagick-6/policy.xml and replace the rights none by read|write for PS, PDF, and EPS.

2.11.2. PNG compression

sudo apt install pngquant

2.11.3. Webp conversion

sudo apt install webp

2.11.4. FITS files

sudo apt install saods9

2.11.5. Diaporama

sudo apt install gwenview

2.11.6. Drawing

sudo apt install inkscape

2.11.7. Webcam

sudo apt update cheese

2.12. Music

  • sudo apt install audacity
  • sudo apt install gtick
  • sudo apt install musescore3
  • sudo apt install lilypond
  • sudo apt install evince
  • sudo apt install timidity
  • sudo apt install hydrogen
  • sudo apt install jack
  • sudo apt install timidity timidity-interfaces-extra

2.13. Miscellaneous

  • sudo apt install gcal
  • sudo apt install vlc
  • sudo apt install ffmpeg
  • sudo apt install arp-scan
  • sudo apt install nmap

3. SETTING FILES TO IMPORT

3.1. Bashrc

Once the ~/ownCloud/ directory is synchronised, add in ~/.bashrc:

export bashalias=$HOME/ownCloud/Settings/bashrc.sh
if [ -f $bashalias ]; then
    . $bashalias
fi

3.2. Emacs

  • Import ~/.emacs.d/ (mainly init.el and lisp/)
  • Import ~/.saves/
  • Import ~/.templates/

3.3. Rest

  • Import .bashrc
  • Import .mbsyncrc
  • Import .vimrc

3.4. Release Upgrade at CEA

  1. sudo apt update
  2. sudo systemctl stop puppet
  3. sudo systemctl disable puppet
  4. sudo rm -r /etc/apt/sources.list.d/
  5. sudo do-release upgrade
  6. Accept the default variables at each prompt.
  7. Once it is done reboot and ask the computer people to check everything
  8. sudo systemctl start puppet
  9. sudo systemctl enable puppet

4. TROUBLE SHOOTING

4.1. Snap

In general avoid snap. It is always better to install the deb from the repository if there is a problem with apt.


BACK

Author: F. Galliano
Last update: 23 févr. 2024