install the apt-transport-https package on Debian before proceeding.
1 2 3 4 5 6
vagrant@cli:~/npm_analyzer$ sudo apt-get install apt-transport-https Reading package lists... Done Building dependency tree Reading state information... Done apt-transport-https is already the newest version (1.8.2). 0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
Save the repository definition to /etc/apt/sources.list.d/elastic-7.x.list
1 2
vagrant@cli:~/npm_analyzer$ echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list deb https://artifacts.elastic.co/packages/7.x/apt stable main
check source list
1 2 3 4 5 6 7 8
vagrant@cli:/etc/apt/sources.list.d$ ls -al total 24 drwxr-xr-x 2 root root 4096 Nov 6 18:05 . drwxr-xr-x 7 root root 4096 Nov 6 18:02 .. -rw-r--r-- 1 root root 419 Nov 2 06:19 bintray.rabbitmq.list -rw-r--r-- 1 root root 62 Nov 6 18:05 elastic-7.x.list -rw-r--r-- 1 root root 189 Oct 17 04:04 google-chrome.list -rw-r--r-- 1 root root 55 Oct 17 04:01 google-chrome.list.save
vagrant@cli:~/npm_analyzer$ sudo apt-get update && sudo apt-get install elasticsearch Get:1 http://security.debian.org/debian-security buster/updates InRelease [39.1 kB] Hit:2 http://deb.debian.org/debian buster InRelease Get:3 https://download.docker.com/linux/debian buster InRelease [44.4 kB] Get:4 https://artifacts.elastic.co/packages/7.x/apt stable InRelease [7,124 B] Ign:5 http://dl.google.com/linux/chrome/deb stable InRelease Hit:6 https://deb.nodesource.com/node_10.x buster InRelease Hit:7 http://dl.google.com/linux/chrome/deb stable Release Ign:8 https://dl.bintray.com/rabbitmq-erlang/debian bionic InRelease Get:9 http://ftp.de.debian.org/debian buster-backports InRelease [46.7 kB] Ign:10 https://dl.bintray.com/rabbitmq/debian bionic InRelease Get:11 https://dl.bintray.com/rabbitmq-erlang/debian bionic Release [12.6 kB] Get:12 https://dl.bintray.com/rabbitmq/debian bionic Release [74.5 kB] Get:13 http://security.debian.org/debian-security buster/updates/main Sources [84.1 kB] Get:14 http://security.debian.org/debian-security buster/updates/main amd64 Packages [112 kB] Get:15 https://artifacts.elastic.co/packages/7.x/apt stable/main amd64 Packages [21.9 kB] Get:19 http://ftp.de.debian.org/debian buster-backports/main amd64 Packages.diff/Index [27.8 kB] Get:20 http://ftp.de.debian.org/debian buster-backports/main amd64 Packages 2019-11-02-1415.02.pdiff [178 B] Get:21 http://ftp.de.debian.org/debian buster-backports/main amd64 Packages 2019-11-03-0215.42.pdiff [276 B] Get:22 http://ftp.de.debian.org/debian buster-backports/main amd64 Packages 2019-11-03-0818.43.pdiff [15.7 kB] Get:23 http://ftp.de.debian.org/debian buster-backports/main amd64 Packages 2019-11-03-2017.32.pdiff [501 B] Get:24 http://ftp.de.debian.org/debian buster-backports/main amd64 Packages 2019-11-05-1414.24.pdiff [5,640 B] Get:25 http://ftp.de.debian.org/debian buster-backports/main amd64 Packages 2019-11-06-1414.27.pdiff [237 B] Get:25 http://ftp.de.debian.org/debian buster-backports/main amd64 Packages 2019-11-06-1414.27.pdiff [237 B] Fetched 493 kB in 7s (72.2 kB/s) Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: elasticsearch 0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded. Need to get 289 MB of archives. After this operation, 488 MB of additional disk space will be used. Get:1 https://artifacts.elastic.co/packages/7.x/apt stable/main amd64 elasticsearch amd64 7.4.2 [289 MB] Fetched 289 MB in 29s (10.0 MB/s) Selecting previously unselected package elasticsearch. (Reading database ... 57026 files and directories currently installed.) Preparing to unpack .../elasticsearch_7.4.2_amd64.deb ... Creating elasticsearch group... OK Creating elasticsearch user... OK Unpacking elasticsearch (7.4.2) ... Setting up elasticsearch (7.4.2) ... Created elasticsearch keystore in /etc/elasticsearch Processing triggers for systemd (241-7~deb10u1) ...
running elasticsearch with systemd
1 2 3 4 5
vagrant@cli:~/npm_analyzer$ sudo /bin/systemctl daemon-reload vagrant@cli:~/npm_analyzer$ sudo /bin/systemctl enable elasticsearch.service Synchronizing state of elasticsearch.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable elasticsearch Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service → /lib/systemd/system/elasticsearch.service.
By default the Elasticsearch service doesn’t log information in the systemd journal. To enable journalctl logging, the –quiet option must be removed from the ExecStart command line in the elasticsearch.service file.
1 2
vagrant@cli:/lib/systemd/system$ vim elasticsearch.service ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet
Note: do not forget to deamon-reload and restart elasticserch.service
check the journal
1 2 3
vagrant@cli:/lib/systemd/system$ sudo journalctl --unit elasticsearch -- Logs begin at Tue 2019-11-05 07:29:08 GMT, end at Wed 2019-11-06 18:25:17 GMT. -- -- No entries --
check elasticsearch is running
You can test that your Elasticsearch node is running by sending an HTTP request to port 9200 on localhost:
root@cli:/etc/elasticsearch# ls elasticsearch.keystore elasticsearch.yml jvm.options log4j2.properties role_mapping.yml roles.yml users users_roles root@cli:/etc/elasticsearch# cat elasticsearch.yml # ======================== Elasticsearch Configuration ========================= # # NOTE: Elasticsearch comes with reasonable defaults for most settings. # Before you set out to tweak and tune the configuration, make sure you # understand what are you trying to accomplish and the consequences. # # The primary way of configuring a node is via this file. This template lists # the most important settings you may want to configure for a production cluster. # # Please consult the documentation for further information on configuration options: # https://www.elastic.co/guide/en/elasticsearch/reference/index.html # # ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # #cluster.name: my-application # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # #node.name: node-1 # # Add custom attributes to the node: # #node.attr.rack: r1 # # ----------------------------------- Paths ------------------------------------ # # Path to directory where to store the data (separate multiple locations by comma): # path.data: /var/lib/elasticsearch # # Path to log files: # path.logs: /var/log/elasticsearch # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # #bootstrap.memory_lock: true # # Make sure that the heap size is set to about half the memory available # on the system and that the owner of the process is allowed to use this # limit. # # Elasticsearch performs poorly when the system is swapping the memory. # # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # #network.host: 192.168.0.1 # # Set a custom port for HTTP: # #http.port: 9200 # # For more information, consult the network module documentation. # # --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when this node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # #discovery.seed_hosts: ["host1", "host2"] # # Bootstrap the cluster using an initial set of master-eligible nodes: # #cluster.initial_master_nodes: ["node-1", "node-2"] # # For more information, consult the discovery and cluster formation module documentation. # # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: # #gateway.recover_after_nodes: 3 # # For more information, consult the gateway module documentation. # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructive_requires_name: true action.auto_create_index: -npms-current,-npms-new,+*
Install the head to perform various manual operations in a web GUI
elasticsearch-head is a web front end for an Elasticsearch cluster
root@cli:/home/vagrant/npm_analyzer# cd elasticsearch-head/ root@cli:/home/vagrant/npm_analyzer/elasticsearch-head# npm install npm WARN deprecated coffee-script@1.10.0: CoffeeScript on NPM has moved to "coffeescript" (no hyphen) npm WARN deprecated http2@3.3.7: Use the built-in module in node 9.0.0 or newer, instead npm WARN deprecated phantomjs-prebuilt@2.1.16: this package is now deprecated npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3 npm WARN deprecated json3@3.2.6: Please use the native JSON object instead of JSON 3
PhantomJS not found on PATH Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2 Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 Receiving... [======================================--] 96% Received 22866K total. Extracting tar contents (via spawned process) Removing /home/vagrant/npm_analyzer/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1573068758515/phantomjs-2.1.1-linux-x86_64 -> /home/vagrant/npm_analyzer/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom Writing location.js file Done. Phantomjs binary available at /home/vagrant/npm_analyzer/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: > https://opencollective.com/core-js > https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 512 packages from 620 contributors and audited 1768 packages in 115.069s found 40 vulnerabilities (19 low, 2 moderate, 19 high) run `npm audit fix` to fix them, or `npm audit` for details
╭────────────────────────────────────────────────────────────────╮ │ │ │ New minor version of npm available! 6.9.0 → 6.12.1 │ │ Changelog: https://github.com/npm/cli/releases/tag/v6.12.1 │ │ Run npm install -g npm to update! │ │ │ ╰────────────────────────────────────────────────────────────────╯
start a local webserver running on port 9100 serving elasticsearch-head