mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
translated
This commit is contained in:
parent
a6c58bf530
commit
ba2232d9e2
@ -1,92 +0,0 @@
|
|||||||
translating---geekpi
|
|
||||||
|
|
||||||
How To Install Ncurses Library In Linux
|
|
||||||
======
|
|
||||||
![](https://www.ostechnix.com/wp-content/uploads/2018/05/install-ncurses-720x340.png)
|
|
||||||
|
|
||||||
**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**][1], 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**][2]. 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
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
That’s 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][a]
|
|
||||||
选题:[lujun9972](https://github.com/lujun9972)
|
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]:https://www.ostechnix.com/author/sk/
|
|
||||||
[1]:https://www.ostechnix.com/pacvim-a-cli-game-to-learn-vim-commands/
|
|
||||||
[2]:https://ftp.gnu.org/pub/gnu/ncurses/
|
|
@ -0,0 +1,90 @@
|
|||||||
|
如何在 Linux 中安装 Ncurses 库
|
||||||
|
======
|
||||||
|
![](https://www.ostechnix.com/wp-content/uploads/2018/05/install-ncurses-720x340.png)
|
||||||
|
|
||||||
|
**GNU Ncurses** 是一个允许用户编写基于文本的用户界面(TUI)的编程库。许多基于文本的游戏都是使用这个库创建的。一个受欢迎的例子是 [**PacVim**][1],这是一款学习 VIM 命令的 CLI 游戏。在这篇简要的指南中,我将解释如何在类 Unix 操作系统中安装 Ncurses 库。
|
||||||
|
|
||||||
|
### 在 Linux 中安装 Ncurses 库
|
||||||
|
|
||||||
|
Ncurses 在大多数 Linux 发行版的默认仓库中都有。例如,你可以使用以下命令将其安装在基于 Arch 的系统上:
|
||||||
|
```
|
||||||
|
$ sudo pacman -S ncurses
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
在RHEL、CentOS 上:
|
||||||
|
```
|
||||||
|
$ sudo yum install ncurses-devel
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
在 Fedora 22 和更新版本上:
|
||||||
|
```
|
||||||
|
$ sudo dnf install ncurses-devel
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
在 Debian、Ubuntu、Linux Mint 上:
|
||||||
|
```
|
||||||
|
$ sudo apt-get install libncurses5-dev libncursesw5-dev
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
默认仓库中的 GNU ncureses 可能有点老了。如果你想要最新的稳定版本,可以从源代码进行编译和安装,如下所示。
|
||||||
|
|
||||||
|
从[**这里**][2]下载最新的 ncurses 版本。在写这篇文章时,最新版本是 6.1。
|
||||||
|
```
|
||||||
|
$ wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
解压 tar 文件:
|
||||||
|
```
|
||||||
|
$ tar xzf ncurses-6.1.tar.gz
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
这将在当前目录中创建一个名为 ncurses-6.1 的文件夹。cd 到该目录:
|
||||||
|
```
|
||||||
|
$ cd ncurses-6.1
|
||||||
|
|
||||||
|
$ ./configure --prefix=/opt/ncurses
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
最后,使用以下命令进行编译和安装:
|
||||||
|
```
|
||||||
|
$ make
|
||||||
|
|
||||||
|
$ sudo make install
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
使用命令验证安装:
|
||||||
|
```
|
||||||
|
$ ls -la /opt/ncurses
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
就是这样。Ncurses 已经安装在 Linux 发行版上。继续使用 Ncurses 创建漂亮的 TUI。
|
||||||
|
|
||||||
|
还会有更多的好东西。敬请关注!
|
||||||
|
|
||||||
|
干杯!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://www.ostechnix.com/how-to-install-ncurses-library-in-linux/
|
||||||
|
|
||||||
|
作者:[SK][a]
|
||||||
|
选题:[lujun9972](https://github.com/lujun9972)
|
||||||
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://www.ostechnix.com/author/sk/
|
||||||
|
[1]:https://www.ostechnix.com/pacvim-a-cli-game-to-learn-vim-commands/
|
||||||
|
[2]:https://ftp.gnu.org/pub/gnu/ncurses/
|
Loading…
Reference in New Issue
Block a user