How to Install OpenSearch on Ubuntu 24.04

OpenSearch, the open-source fork of Elasticsearch, has become a critical tool for log analytics, real-time application monitoring, and full-text search capabilities. With its distributed architecture and REST API, it's ideal for developers and enterprises needing scalable search solutions. In this guide, we'll walk through a secure installation on Ubuntu 24.04 while highlighting enterprise-ready configurations.

Prerequisites

  • Ubuntu 24.04 server with 4GB+ RAM (8GB recommended for production)
  • sudo privileges
  • Java JDK 11 or later

Installation Steps

1. Update System and Install Dependencies

sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget gnupg2

2. Install Java Runtime

sudo apt install -y openjdk-17-jdk
java -version  # Verify installation

3. Download OpenSearch

wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.11.0/opensearch-2.11.0-linux-x64.tar.gz
tar -xzf opensearch-*.tar.gz
cd opensearch-2.11.0/

4. Configure OpenSearch

Edit config/opensearch.yml:

cluster.name: production-search
node.name: ${HOSTNAME}
network.host: 0.0.0.0
discovery.type: single-node

5. Adjust Memory Limits

echo "OPENSEARCH_JAVA_OPTS="-Xms2g -Xmx2g"" | sudo tee -a config/jvm.options.d/heap.options

6. Start OpenSearch Service

./bin/opensearch -d

Security Hardening

Enable TLS Encryption

./bin/opensearch-security/tls.sh \
  --generate \
  --ca-dn "CN=CA for Your Domain" \
  --dn "CN=your-domain.com" \
  --san DNS:localhost,IP:127.0.0.1

Configure Firewall Rules

sudo ufw allow 9200/tcp  # REST API
sudo ufw allow 9300/tcp  # Cluster communication

Troubleshooting Common Issues

  • Service Not Starting: Check logs/opensearch.log for JVM errors
  • Connection Refused: Verify firewall rules and network.host settings
  • Certificate Errors: Regenerate TLS certs with proper SAN entries

Production Best Practices

  • Use separate nodes for master/data roles in cluster deployments
  • Implement snapshot backups to S3-compatible storage
  • Monitor performance with OpenSearch Dashboards
  • Set up index lifecycle management (ILM) for time-series data

Automation & Monitoring

Systemd Service File:

[Unit]
Description=OpenSearch
After=network.target

[Service]
User=opensearch
Group=opensearch
ExecStart=/path/to/opensearch-2.11.0/bin/opensearch

[Install]
WantedBy=multi-user.target

Next Steps

After successful installation, consider:

  • Integrating OpenSearch Dashboards for visualization
  • Configuring index templates for consistent data handling
  • Implementing role-based access control (RBAC)

Conclusion

You've now installed OpenSearch with enterprise-grade security on Ubuntu 24.04. Remember to regularly update components and monitor cluster health through the REST API (curl -XGET https://localhost:9200/_cluster/health). For advanced configurations, consult the official documentation.