Menu
|
Installing Yarn on Ubuntu. Note, this instruction mentioned to install yarn is applicable to all version or Ubuntu as valid for Debian and other Debian based Distributions. The first step is to enable the Yarn repository. Start by importing the repository’s GPG key using the following curl command.
last updated
Elasticsearch is an open source distributed full-text search and analytics engine. It supports RESTful operations and allows you to store, search, and analyze big volumes of data in real time.
Elasticsearch is one of the most popular search engines powering applications that have complex search requirements such as big e-commerce stores and analytic applications.
In this tutorial, we will show you how to install Elasticsearch on Ubuntu 18.04. The same instructions apply for Ubuntu 16.04 and any Ubuntu-based distribution, including Linux Mint, Kubuntu and Elementary OS.
Prerequisites
You’ll need to be logged in as a user with sudo privileges to be able to install packages on your Ubuntu system.
Installing Elasticsearch
The easiest way to install Elasticsearch on Ubuntu 18.04 is by installing the deb package from the official Elasticsearch repository.
At the time of writing this article, the latest version of Elasticsearch is
7.0.0
and requires Java 8 to be installed on the system.Start by updating the packages index and installing the apt-transport-https package that necessary to access a repository over HTTPS:
Install OpenJDK 8:
Verify the Java installation by running the following command which will print the Java version:
The output should look something like this:
Now that Java is installed, the next step is to add the Elasticsearch repository.
Import the repository’s GPG using the following
wget
command:The command above should output
OK
which means that the key has been successfully imported and packages from this repository will be considered trusted.Next, add the Elasticsearch repository to the system by issuing:
If you want to install a previous version of Elasticsearch, change
7.x
in the command above with the version you need.Once the repository is enabled, update the
apt
package list and install the Elasticsearch engine by typing:Elasticsearch service will not start automatically after the installation process is complete. To start the service and enable the service run:
You can verify that Elasticsearch is running by sending an HTTP request to port 9200 on localhost with the following curl command:
You should see something similar to this:
It will take 5-10 seconds for the service to start. If you see
curl: (7) Failed to connect to localhost port 9200: Connection refused
, wait for a few seconds and try again.If you want to see the messages logged by the Elasticsearch service you can use the command below:
Congratulations, at this point you have Elasticsearch installed on your Ubuntu server.
Configuring Elasticsearch
Elasticsearch data is stored in the
/var/lib/elasticsearch
directory, configuration files are located in /etc/elasticsearch
and Java start-up options can be configured in the /etc/default/elasticsearch
file.By default, Elasticsearch is configured to listen on localhost only. If the client connecting to the database is also running on the same host and you are setting up a single node cluster you don’t need to change the default configuration file.
Remote Access
Out of box Elasticsearch, does not implement authentication so it can be accessed by anyone who can access the HTTP API. If you want to allow remote access to your Elasticsearch server, you will need to configure your firewall and allow access to the Elasticsearch port 9200 only from trusted clients.
Ubuntu comes with a firewall configuration tool called UFW. By default, UFW is installed but not enabled. Before enabling the UFW firewall first add a rule that will allow incoming SSH connections:
Allow assess from the remote trusted IP address:
Do not forget to change
192.168.100.20
with your remote IP Address.Enable UFW with by typing:
Finally, check the status of firewall:
The output should look something like this:
Once your firewall is configured the next step is to edit the Elasticsearch configuration and allow Elasticsearch to listen for external connections.
To do so, open the
elasticsearch.yml
configuration file:Search for the line that contains
network.host
, uncomment it, and change the value to 0.0.0.0
:If you have multiple network interfaces on your machine you can specify the interface IP address which will cause Elasticsearch to listen only on the specified interface.
Restart the Elasticsearch service for the changes to take effect:
That’s it. You can now connect to the Elasticsearch server from your remote location.
Conclusion
You have successfully installed Elasticsearch on your Ubuntu 18.04. You can now visit the official Elasticsearch Documentation page and learn how to get started with Elasticsearch.
If you hit a problem or have feedback, leave a comment below.
Have you ever installed new software or updates on Ubuntu and wondered what the four options it prompts are? Well, by default, Ubuntu offers four different software repositories to get the downloads or updates from.These four repositories are as follows:
- Main
- Universe
- Restricted
- Multiverse
Often times people uncheck the rest of the fields and go with Main without understanding what they actually stand for. Today, we will uncover the meaning behind all four and further look into how to enable Universe repository on Ubuntu.
1. Main:
The Main repository, as the name suggests, is the most basic of all, free and open source (FOSS). This repository may be the most basic but is the largest one as well. It contains all the packages and is maintained by Canonical. Since this repository is maintained by the parent company of Ubuntu, all the packages are previously tried and tested before they are added in the latest builds. This also provides the comfort to users that all the packages are foolproof and have a lifetime of critical bug-free updates.
2. Universe
Why is there a need for another free and open source repository when we already have Main? This is because not all the FOSS apps out that can be maintained by Ubuntu itself. To ease the process, Universe is a repository which is maintained by the community and is absolutely free. All the FOSS that are not in Main, are a part of Universe.
The one significant change between Main and Universe is that in the latter, the software are not maintained by Canonical and instead are handled by community experts and Ubuntu enthusiasts.
This change has often created a false image in the users’ heads. Despite Canonical not handling the software, it does not mean that the software in Universe are second class; it only means that Canonical did not want to deal with the updates and fixes of these particular software.
The bugs and fixes are often provided by the community members and if there is some underlying problem with the application, then the author or maintainer of the app steps in to resolve the matter almost immediately.
3. Restricted:
There is a huge misconception that all of Ubuntu is open source while that is most certainly not the case. There are a number of proprietary software that exist for Ubuntu as well. These software provide a premium service which all the FOSS cannot. There can be substitute software but the quality and features may vary.
Currently, the list of these proprietary software includes only the default Ubuntu drivers. These software includes WiFi drivers and so on. There is no denying that these software are an absolute necessity of a normal functionality of an OS, Canonical officially maintains all of them.
The obligation to provide the latest patches, updates and bug fixes for any restricted software ultimately then lies on the shoulders of Canonical.
4. Multiverse:
Last but not the least, Multiverse repository is the place where all the rest of the things lie. Majorly, the types of software included in this list are codecs, Skype plug-ins, and other open source software.
According to some Ubuntu enthusiasts, Multiverse can be labeled as the place where software with legal issues and unknown license problems are found.
These software are completely maintained by the community and no official body takes any responsibility for them. These software are often untested which is why it is essential to have some knowledge about them from beforehand.
In short:
Main – Open Source and Supported by Canonical
Universe – Open Source and Not Supported by Canonical
Restricted – Not Open Source and Supported by Canonical
Multiverse – Can Be Open Source and Not Supported by Canonical
Now that we have a better understanding of all four repositories, we will talk about how to enable the Universe repository in Ubuntu.
Following are some commands that are needed to be executed to achieve the desired result.
If the command mentioned above prompts an error, then it is probably because you are using an older version of Ubuntu. To resolve this issue, you will have to write another command which is as follows:
$ sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe
If you want to use all the four repositories discussed earlier then you may want to add the following command:
$ sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main
universe multiverse restricted”
universe multiverse restricted”
To update the list of packages, you will need to write one last command and that is as following:
Once you have successfully used all the commands mentioned above, you will be able to use the Universe repository and all four repositories, if needed.