Nucleus .Net Core CMS

Setting up Self-Managed Elastic Search on a Azure Virtual Machine running Ubuntu Linux.

How to set up a self-managed Elastic Search instance in Ubuntu Linux.

In order to provide a search service on, we needed to set up an Elastic Search instance.  Our web site is hosted as an Azure App Service, so we decided to use an Azure Virtual Machine.  The original source for most of the Elastic Search installation steps is from the Elasticsearch documentation.

Azure Virtual Machine

We don't need a high capacity service, and search is used infrequently, so our Azure Virtual machine is a Standard B1ms virtual machine (1 vCpu, 2gb RAM), running Ubuntu Linux.  The Azure Portal wizard is fairly easy to use, so we're not going to run through how to set up a virtual machine in Azure.

Connecting to our Azure Virtual Machine

Once the virtual machine is set up, select it in the Azure Portal and choose "Connect" from the "Settings" menu at the left-hand side of the page, then choose the "SSH" tab.  If you don't already have your SSH key, you may need to click the "replace/reset your SSH private key" link to generate a new key, then download it to your computer.

The "connect" page displays the ssh command which you can use to connect to your virtual machine.  You can run this from a Windows command prompt.

Installing Elastic Search

Import the Elastic Search PGP key

The PGP key is used to verify the installation package.

wget -qO - | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg

Set up the APT repository

The apt-transport-package is used to download the install package.  It will generally already be installed, this step ensures that it is installed, and won't do anything if it is already installed. 

sudo apt-get install apt-transport-https

This step saves the repository definition:

echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list

Install Elastic Search

sudo apt-get update && sudo apt-get install elasticsearch

Configure Elastic Search to start automatically

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

Install the Elastic Search ingest-attachment plugin

The Elasticsearch ingest-attachment plugin is used to index file contents, and is required by the Nucleus Elastic Search extension.

sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment

During installation, a security warning is displayed.  Enter "y" to allow the installation to proceed.

Reset and Save the 'elastic' user password

sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic

Record the password, which is displayed on-screen after being reset.  The default elastic search user name is 'elastic'.  You will need the password for the Nucleus Elastic Search extension settings page.

Display and Save the Elasticsearch service certificate thumbprint

sudo openssl x509 -fingerprint -sha256 -in /etc/elasticsearch/certs/http_ca.crt

You will need the certificate thumbprint for the Nucleus Elastic Search extension settings page.

Edit Elastic Search Settings

sudo nano /etc/elasticsearch/elasticsearch.yml

Un-comment and set the (name it whatever you want), and set the value to  The other default settings will work.  Press CTRL-X to exit, and press Y to save your settings.

Start the Elastic Search Service

sudo systemctl start elasticsearch.service


Elastic search is ready for use, and you can go ahead and install/configure the Nucleus Search module and Elastic Search extension.

The steps above set up a simple single-node server, with no backup or redundancy.  The setup is suitable for our search requirements, because we can re-build the index at any time.  Other use cases may require more server resources, or a cluster.