I need your expertise, I am trying to learn rpms. I am following an instructional video from pluralsight. Where he download zsh via “yumdownloader --source” in the root directory. As per his instruction I ran the following
- rpm -i zsh-5.0.2-34.el7_8.2.src.rpm
- went into /root/rpmbuild/SOURCES/ and extracted zsh-5.0.2.tar.bz2 and went into zsh-5.0.2 directory
- ran ./configure
- ran make
- ran make install
All run successfully, as shown in the tutorial video. The question is when he ran zsh anywhere it changed to zshell but in my case I ran zsh in my current directory and it said bash: zsh: command not found.
Can you help me figure what I have overlooked, this system is lab machine so I can provide any logs and configuration file you needed to help me fix this issue I am encountering.
Did you ‘sudo make install’ or without sudo? Might be in a user’s /bin somewhere.
Search around, see where the binary went on your step 5: ‘sudo find / -type f -iname zsh’
I was login as root when I was doing it.
I have ran find / -type f -iname zsh and here is the result:
[root@server1 zsh-5.0.2]# find / -type f -iname zsh
Is that directory in your PATH?
Ah, got it. I’m paranoid, so I don’t allow root logins on any of my machines, and forget that others use it.
So, it looks like it built and installed, so it must be either 1)
/usr/local/bin is not on your path, or 2) the zsh on the path does not have executable permissions.
echo $PATH and see if it looks correct. The path is usually built at login time, so log out and back in might fix it. But, #2 might affect #1, if there aren’t any executables in a directory (or it doesn’t exit), then it’s not included in $PATH, so…
ls -laF /usr/local/bin/zsh and see if it has the ‘x’ bits set for you. This is more or less what I’d expect to see for your executable.
$ ls -laF /usr/bin/zsh
-rwxr-xr-x 1 root root 878288 2020-02-23 20:35 /usr/bin/zsh
My zsh is in
/usr/bin (as confirmed by
which zsh), since I didn’t build from source…
If you don’t have executable bits set, just
chmod 755 /usr/local/bin/zsh, then see if it runs.
Thank you for your help. I have checked my echo $PATH as a root and this what I got:
[root@server1 tux]# echo $PATH
But ironically when I login as my regular user and show my path it has more:
tux@server1 ~]$ echo $PATH
and if run zsh as the regular account it works:
[tux@server1 ~]$ zsh
server1% which zsh
Because the way I login as root is using “sudo su” so I logged off and login back as root using “su” only and this time it works.
[tux@server1 ~]$ su -
Last login: Wed Feb 9 06:02:40 ACDT 2022 on pts/1
Last failed login: Wed Feb 9 06:07:21 ACDT 2022 on pts/1
There was 1 failed login attempt since the last successful login.
[root@server1 ~]# echo $PATH
[root@server1 ~]# zsh
Thank you so much for your help. This helped me a lot in my journey to learn linux
Yeah, the limited path options in root are a semi-security feature, I think. Makes root less dangerous by limiting the command scope to only those binaries that are part of the base system, not something in /usr/local that a random user plopped in and shadowed the “real” command.
For example, try this:
$ echo 'echo Hello' > /usr/local/bin/cp
$ chmod 755 /usr/local/bin/cp
$ cp .bashrc xxx
Congratulations! You are now a hacker and have put in a trojan copy of the ‘cp’ command. (Don’t forget to