# yum install ncurses-devel
.. will do.
But the other commands, you show : 'make' and 'rpm -qf'
are not supposed to be done as root.
'root' is for administrative tasks only !
It is unsafe to do all user commands as root, not a question
of if, but when you will trash your OS.
Makes you vulnerable to attacks too, if you are connected to
a network / the internet.