Imagine this: your boss walks in and says, “We need real-time search and analytics. Yesterday.” You’ve got a CentOS 7 box, and you need Elasticsearch and Kibana running—fast, stable, and secure. Sound familiar? Good. Let’s get straight to business.
Step 1: Prerequisites—Don’t Skip These!
Before you touch Elasticsearch, make sure your server is ready. These steps aren’t optional; skipping them will cost you hours later.
-
Set a static IP:
sudo vi /etc/sysconfig/network-scripts/ifcfg-ens3Tip: Double-check your network config. A changing IP will break your cluster.
-
Set a hostname:
sudo vi /etc/hostnameOpinion: Use meaningful hostnames. “node1” is better than “localhost”.
-
(Optional) Disable the firewall:
sudo systemctl disable firewalld --nowGotcha: Only do this in a trusted environment. Otherwise, configure your firewall properly.
-
Install Java (Elasticsearch needs it):
sudo yum install java-1.8.0-openjdk.x86_64 -yTip: Elasticsearch 8.x bundles its own JVM, but installing Java never hurts for troubleshooting.
Step 2: Install Elasticsearch 8.x
Ready for the main event? Let’s get Elasticsearch installed and configured.
-
Import the Elasticsearch GPG key:
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch -
Add the Elasticsearch repo:
sudo vi /etc/yum.repos.d/elasticsearch.repo[elasticsearch] name=Elasticsearch repository for 8.x packages baseurl=https://artifacts.elastic.co/packages/8.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-mdTip: Set
enabled=0so you only use this repo when you want to. Avoid accidental upgrades. -
Install Elasticsearch:
sudo yum install --enablerepo=elasticsearch elasticsearch -y -
Configure Elasticsearch:
sudo vi /etc/elasticsearch/elasticsearch.ymlnode.name: "es1" cluster.name: cluster1 script.allowed_types: noneOpinion: Always set
node.nameandcluster.name. Defaults are for amateurs. -
Set JVM heap size (optional, but recommended for tuning):
sudo vi /etc/elasticsearch/jvm.options-Xms4g -Xmx4gTip: Set heap to half your available RAM, max 32GB. Too much heap = slow GC.
-
Enable and start Elasticsearch:
sudo systemctl enable elasticsearch.service sudo systemctl start elasticsearch.service -
Test your installation:
curl -X GET 'http://localhost:9200'Gotcha: If you get a permission error, check SELinux or your firewall.
Step 3: Install and Configure Kibana
Kibana is your window into Elasticsearch. Let’s get it running.
-
Add the Kibana repo:
sudo vi /etc/yum.repos.d/kibana.repo[kibana-8.x] name=Kibana repository for 8.x packages baseurl=https://artifacts.elastic.co/packages/8.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-mdTip: Keep
enabled=1for Kibana. You’ll want updates. -
Install Kibana:
sudo yum install kibana -y -
Generate the enrollment token (for secure setup):
bin/elasticsearch-create-enrollment-token -s kibanaGotcha: Save this token! You’ll need it when you first access Kibana.
-
Reload systemd and start Kibana:
sudo systemctl daemon-reload sudo systemctl enable kibana.service sudo systemctl restart kibana.serviceTip: Use
restartinstead ofstartto pick up config changes.
Final Thoughts: Don’t Get Burned
- Security: Elasticsearch 8.x is secure by default. Don’t disable TLS unless you know exactly what you’re doing.
- Memory: Monitor your heap usage. Elasticsearch loves RAM, but hates swap.
- Upgrades: Always test upgrades in a staging environment. Elasticsearch upgrades can be breaking.
If you followed these steps, you’re ready to build powerful search and analytics solutions. Don’t settle for defaults—tune, secure, and monitor your stack. Any questions? I’m Max L, and I don’t believe in half-measures.