TranslateProject/sources/tech/20180518 How To Install Ncurses Library In Linux.md
2018-05-24 08:52:58 +08:00

2.4 KiB
Raw Blame History

translating---geekpi

How To Install Ncurses Library In Linux

GNU Ncurses is a programming library that allows the users to write text-based user interfaces(TUI). Many text-based games are created using this library. One popular example is PacVim, a CLI game to learn VIM commands. In this brief guide, I will be explaining how to install Ncurses library in Unix-like operating systems.

Install Ncurses Library In Linux

Ncurses is available in the default repositories of most Linux distributions. For instance, you can install it on Arch-based systems using the following command:

$ sudo pacman -S ncurses

On RHEL, CentOS:

$ sudo yum install ncurses-devel

On Fedora 22 and newer versions:

$ sudo dnf install ncurses-devel

On Debian, Ubuntu, Linux Mint:

$ sudo apt-get install libncurses5-dev libncursesw5-dev

The GNU ncureses might be bit old in the default repositories. If you want a most recent stable version, you can compile and install from the source as shown below.

Download the latest ncurses version from here. As of writing this guide, the latest version was 6.1.

$ wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz

Extract the tar file:

$ tar xzf ncurses-6.1.tar.gz

This will create a folder named ncurses-6.1 in the current directory. Cd to the directory:

$ cd ncurses-6.1

$ ./configure --prefix=/opt/ncurses

Finally, compile and install using the following commands:

$ make

$ sudo make install

Verify the installation using command:

$ ls -la /opt/ncurses

Thats it. Ncurses have been installed on the Linux distribution. Go ahead and create your nice looking TUIs using Ncurses.

More good stuffs to come. Stay tuned!

Cheers!


via: https://www.ostechnix.com/how-to-install-ncurses-library-in-linux/

作者:SK 选题:lujun9972 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出