# Installing the Elasticsearch and Kibana on Rocky Linux (part-01)

Kibana is a powerful visualization tool that integrates with Elasticsearch, offering insights into your data. This guide will help you install the latest versions of Elasticsearch and Kibana on Rocky Linux from scratch.

### Step 1: Update Your System

Start by updating your system to ensure all packages are up-to-date. Open a terminal and run the following command:

```bash
sudo dnf update -y
```

### Step 2: Install Java (OpenJDK)

Elasticsearch requires Java to run. Install OpenJDK using the following command:

```bash
sudo dnf install java-11-openjdk-devel -y
```

Verify the Java installation:

```bash
java -version
```

You should see output confirming Java 11 is installed.

### Step 3: Add the Elasticsearch Repository

To install Elasticsearch, you need to add its official repository. First, import the Elasticsearch GPG key:

```bash
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
```

Then, create a repository file for Elasticsearch:

```bash
sudo tee /etc/yum.repos.d/elasticsearch.repo <<EOF
[elasticsearch-8.x]
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=1
autorefresh=1
type=rpm-md
EOF
```

### Step 4: Install Elasticsearch

Now that the repository is configured, install the latest Elasticsearch:

```bash
sudo dnf install elasticsearch -y
```

### Step 5: Start and Enable Elasticsearch

Enable and start the Elasticsearch service:

```bash
sudo systemctl enable --now elasticsearch
```

Verify that Elasticsearch is running:

```bash
sudo systemctl status elasticsearch
```

### Step 6: Install Kibana

Next, install Kibana using the following command:

```bash
sudo dnf install kibana -y
```

### Step 7: Configure Kibana

Once Kibana is installed, configure it by editing the `kibana.yml` configuration file:

```bash
sudo nano /etc/kibana/kibana.yml
```

Update the following lines:

```yaml
server.port: 5601
server.host: "localhost"
elasticsearch.hosts: ["http://localhost:9200"]
```

This configuration sets Kibana to run on port 5601 and connects it to Elasticsearch.

### Step 8: Start and Enable Kibana

Start and enable the Kibana service:

```bash
sudo systemctl enable --now kibana
```

Verify that Kibana is running:

```bash
sudo systemctl status kibana
```

### Step 9: Access Kibana

Kibana should now be accessible at [`http://localhost:5601`](http://localhost:5601). If you are running Kibana on a remote server, replace [`localhost`](http://localhost) with your server’s IP address.

### Firewall Configuration (Optional)

If you want to access Kibana from other machines, you need to open port 5601 in the firewall:

```bash
sudo firewall-cmd --add-port=5601/tcp --permanent
sudo firewall-cmd --reload
```

### Conclusion

You’ve successfully installed the latest versions of Elasticsearch and Kibana on Rocky Linux. Kibana is now ready for use, allowing you to visualize your Elasticsearch data. Be sure to secure your setup if your instances are accessible over a network, especially for production environments.
