如何在 Ubuntu 和其他 Linux 上安装 Netbeans
Netbeans

> 
> 在本教程中，你将学习在 Ubuntu 和其他 Linux 发行版上安装 Netbeans IDE 的各种方法。
> 
> 
> 


[NetBeans](https://netbeans.org/) 是一个开源集成开发环境，具有良好的跨平台支持。此工具已被 Java 和 C/C++ 开发社区广泛认可。


![](/data/attachment/album/202003/20/122113lzjww4ac68764acj.jpg)


开发环境相当灵活。你可以配置它以支持各种开发。实际上，你可以用它来开发 Web、桌面和移动应用，而无需离开此平台。这太神奇了，不是吗？除此之外，用户可以添加许多已知语言，如 [PHP](https://www.php.net/)、C、C++、HTML、[Ajax](https://en.wikipedia.org/wiki/Ajax_(programming))、JavaScript、JSP、Ruby on Rails 等。


如果你正在了解如何在 Linux 上安装 Netbeans，那么有几种方法可以做到。我编写本教程主要是为了 Ubuntu，但一些安装方法也适用于其他发行版。


* [使用 apt 在 Ubuntu 上安装 Netbeans](tmp.ZNFNEC210y#apt)：适用于 Ubuntu 和基于 Ubuntu 的发行版，但通常**它是旧版的 Netbeans**
* [使用 Snap 在 Ubuntu 上安装 Netbeans](tmp.ZNFNEC210y#snap)：适用于已启用 Snap 包支持的任何 Linux 发行版
* [使用 Flatpak 安装 Netbeans](tmp.ZNFNEC210y#flatpak)：适用于所有支持 Flatpak 包的 Linux 发行版


### 使用 Apt 包管理器在 Ubuntu 上安装 Netbeans IDE


如果在 Ubuntu 软件中心搜索 Netbeans，你将找到两个版本的 Netbeans。Apache Netbeans 是 snap 版本，大小较大，但提供了最新的 Netbeans。


只需单击一下即可安装它。无需打开终端。是最简单的方法。


![Apache Netbeans in Ubuntu Software Center](/data/attachment/album/202003/20/122118glsshhznekqh7m74.jpg)


你也可以选择使用 `apt` 命令，但使用 `apt` 时，你无法获得最新的 Netbeans。例如，在编写本教程时，Ubuntu 18.04 中 Apt 提供 Netbeans 10，而 Snap 有最新的 Netbeans 11。


如果你是 [apt 或 apt-get](https://itsfoss.com/apt-vs-apt-get-difference/) 的粉丝，那么可以[启用 universe 仓库](https://itsfoss.com/ubuntu-repositories/)，并在终端中使用此命令安装 Netbeans：



```
sudo apt install netbeans
```

### 使用 Snap 在任何 Linux 发行版上安装 Netbeans IDE


Snap 是一个通用包管理器，如果[发行版上启用了 Snap](https://itsfoss.com/install-snap-linux/)，那么可以使用以下命令安装它：



```
sudo snap install netbeans --classic
```

此过程可能需要一些时间才能完成，因为总下载大小约为 1 GB。完成后，你将在应用程序启动器中看到它。


你不仅可以通过 Snap 获取最新的 Netbeans，已安装的版本将自动更新到较新版本。


### 使用 Flatpak 安装 Netbeans


[Flatpak](https://flatpak.org/) 是另一个类似 Snap 的包安装器。默认情况下，某些发行版支持 Flatpak，在其他发行版上你可以[启用 Flatpak 支持](https://itsfoss.com/flatpak-guide/)。


发行版支持 Flatpak 后，你可以使用以下命令安装 Netbeans：



```
flatpak install flathub org.apache.netbeans
```

另外，你可以下载源码并自己编译。


* [下载 Netbeans](https://netbeans.apache.org/download/index.html)


希望你使用了上面其中一个方法在你的 Ubuntu 上安装了 Netbeans。但你使用的是哪个方法？有遇到问题么？让我们知道。




---


via: <https://itsfoss.com/install-netbeans-ubuntu/>


作者：[Srimanta Koley](https://itsfoss.com/author/itsfoss/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
*In this tutorial, you’ll learn various ways to install Netbeans IDE on Ubuntu and other Linux distributions.*

[NetBeans](https://netbeans.org/) is an open source integrated development environment that comes with good cross-platform support. This tool has been recognized by the Java and C/C++ development community widely.

The development environment is quite flexible. You can configure this tool to support a wide array of development objectives. Practically, you can develop Web, Desktop and Mobile Applications without leaving this platform. It’s amazing, isn’t it? Besides this, the user can add a wide array of known languages such as [PHP](https://www.php.net/), C, C++, HTML, [Ajax](https://en.wikipedia.org/wiki/Ajax_(programming)), JavaScript, JSP, Ruby on Rails and the list goes on and on!

If you are looking to install Netbeans on Linux, you have several ways to do that. I have written this tutorial primarily for Ubuntu but some installation methods are applicable to other distributions as well.

[Installing Netbeans on Ubuntu using apt](#apt): for Ubuntu and Ubuntu-based distributions but usually**it has older version of Netbeans**[Installing Netbeans on Ubuntu using Snap](#snap): for any Linux distribution that has Snap packaging support enabled[Installing Netbeans using Flatpak](#flatpak): for any Linux distribution with Flatpak package support

## Installing Netbeans IDE on Ubuntu using Apt package manager

If you search for Netbeans in Ubuntu Software Center, you’ll find two Netbeans available. The Apache Netbeans is the snap version which is bigger in download size but gives you the latest Netbeans.

You can install it in one click. No need to open terminal. Easiest way.

![Apache Netbeans Ubuntu Software Center](https://itsfoss.com/content/images/wordpress/2020/03/apache-netbeans-ubuntu-software-center.jpg)

You may also opt for using the apt command but with apt version, you won’t get the latest Netbeans. For example, at the time of writing this tutorial, Ubuntu 18.04 has Netbeans version 10 available via Apt while Snap has the latest Netbeans 11.

If you are a fan of [apt or apt-get](https://itsfoss.com/apt-vs-apt-get-difference/), you can [enable the universe repository](https://itsfoss.com/ubuntu-repositories/) and install Netbeans using this command in the terminal:

`sudo apt install netbeans`


## Installing Netbeans IDE on any Linux distribution using Snap

![Install Netbeans Linux](https://itsfoss.com/content/images/wordpress/2020/03/Install_Netbeans_Linux.jpg)

Snap is a universal package manager and if [you have enabled Snap on your distribution](https://itsfoss.com/install-snap-linux/), you can install it using the following command:

`sudo snap install netbeans --classic`


The process might take some time to complete because the total download size is around 1 GB. Once done, you will see the app in the application launcher.

Not only you’ll get the latest Netbeans with Snap, the installed version will be automatically updated to the newer version.

## Installing Netbeans using Flatpak

[Flatpak](https://flatpak.org/) is another universal packaging like Snap. Some distributions support Flatpak by default while you can [enable Flatpak support](https://itsfoss.com/flatpak-guide/) on others.

Once you have the Flatpak support on your distribution, you can use the following command to install Netbeans:

`flatpak install flathub org.apache.netbeans`


Alernatively, you can always download the source code of this open source software and compile it yourself.

Hopefully, you selected one of the above methods to install Netbeans on your Ubuntu Linux system. But which one did you use? Did you face any issues? Do let us know.

![Srimanta](https://itsfoss.com/content/images/wordpress/2020/03/srimanta.jpg)

## Srimanta Koley

Srimanta is a passionate writer, a distrohopper & open source enthusiast. He is extremely fond of everything related to technology. He loves to read books and has an unhealthy addiction to the 90s!