[Tuto] Comment installer Oh My Zsh / How to install Oh My Zsh

(French bellow)

English

Introduction

On all my computers I use the Zsh Shell with the Oh My Zsh framework.
I find it much more efficient than Bash or others, especially the ability to add a bunch of plugins!

Installation

1. Zsh installation

  • Log in with the admin user
$ sudo apt-get install zsh
  • Open Zsh for the first time and choose option 2
$ zsh

2. Oh My Zsh installation

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

3. Set Zsh as default shell for LDAP users

  • By default YunoHost create an admin user in LDAP. To modify the LDAP users default shell you have to modify the nslcd.conf config file like this :
$ sudo cp /etc/nslcd.conf /etc/nslcd.conf.bak

# Edit the config file
$ sudo nano /etc/nslcd.conf

# Add at the end of the file
[...]
map passwd loginShell "/usr/bin/zsh"  
[...]

4. Test

  • Logout and login again, normally you will have to fall directly on Oh My Zsh.



Français

Introduction

Sur tous mes ordinateurs j’utilise le Shell Zsh avec le framework Oh My Zsh.
Je le trouve beaucoup plus éfficase que Bash ou autres, surtout la possibilité d’ajouter tout un tas de de plugins !

Installation

1. Installation de Zsh

  • Se connecter en tant qu’utilisateur admin
$ sudo apt-get install zsh
  • Ouvrir Zsh pour la première fois et choisir l’option 2
$ zsh

2. Installation Oh My Zsh

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

3. Avoir Zsh comme Shell par défaut pour les utilisateurs LDAP

  • Par dĂ©faut YunoHost crĂ©Ă© un utilisateur andin dans la LDAP. Pour modifier le Shell par dĂ©faut pour les utilisateurs LDAP il faut modifier le fichier de configuration nslcd.conf comme ceci :
$ sudo cp /etc/nslcd.conf /etc/nslcd.conf.bak

# Edit the config file
$ sudo nano /etc/nslcd.conf

# Add at the end of the file
[...]
map passwd loginShell "/usr/bin/zsh"  
[...]

4. Test

  • Normalement si vous vous dĂ©connectez et re-connectez avec l’utilisateur admin vous devriez tomber sur Zsh !
5 Likes

Hello,
I installed Oh My Zsh on my server some time ago and found this topic explaining how to make it my default shell (chsh does not work as my user is not in passwd file)

Sadly, this does not work :frowning:
(I’m connecting via ssh and I still have to start zsh manually, or start it via .bashrc)

Note : I do not use the admin user to connect via ssh, I only use a created user (created via YunoHost)

Hello,

Hum that strange, just tried again with a LDAP user that I never use for SSH and noticed that this user also automatically start with ZSH.

Did you update your /etc/nslcd.conf file?
Check that your ZSH binary file is in /usr/bin with the which zsh command also? :-/

2 Likes

Alors… c’est bizarre… quand j’ai testé la manip’ il y a 5 jours ça n’a pas marché. Mais là, quand je me connecte en SSH, je suis bien en ZSH.

Et ce qui est encore plus bizarre, c’est que j’avais remis en commentaire la modif’ :crazy_face:

J’ai essayé de re-démarrer le service nslcd.service, mais ça ne change rien. Et même en arrêtant le service, j’arrive encore à me connecter :thinking:


J’ai ré-essayé au bout de 30 minutes et là, ma modif’ est prise en compte…
il doit y avoir un cache quelque part :man_shrugging:

Bonjour,

J’ai suivis le petit tutoriel, mais j’ai l’impression que ce n’est plus d’actualité.

map passwd loginShell n’existe pas dans la config de /etc/nslcd.conf, même en l’ajoutant, je rencontre toujours le même problème.

Pour ma part, ce que j’ai fait, c’est de modifier le fichier ~/.bashrc pour qu’au chargement du shell, ça lance zsh.
Et du coup, ça marche, mais c’est juste une rustine moche, si il y a mieux, ça m’intéresse !

Hello,
Personnellement mon YNH est Ă  jour et cette technique fonctionne toujours pour moi :-/

Pareil pour moi, je suis obligé de démarrer zsh manuellement…

J’ai du démarrer à nouveau mon serveur et là je tombe directement sur zsh, mon problème est résolu, merci pour ce tutoriel.

2 Likes

I had to start my server again and there I fall directly on zsh, my problem is solved, thank you for this tutorial.

This seems to work

1 Like

Thank’s you save me!

I called zsh from .bashrc file but it’s break Remote vscode by SSH