# InfluxDB

## Installing the influx DB

Install the influxDB time series database by following commands, for Ubuntu & Debian

```bash
# influxdata-archive_compat.key GPG fingerprint:
#     9D53 9D90 D332 8DC7 D6C8 D3B9 D8FF 8E1F 7DF8 B07E
wget -q https://repos.influxdata.com/influxdata-archive_compat.key
echo '393e8779c89ac8d958f81f942f9ad7fb82a25e133faddaf92e15b16e6ac9ce4c influxdata-archive_compat.key' | sha256sum -c && cat influxdata-archive_compat.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null
echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list

sudo apt-get update && sudo apt-get install influxdb2
```

## Setup Influx DB

Run the below command to setup the influxDB.

```bash
influx setup
```

&#x20;Provie the inputs for the question prompted for the default configuration. It willprompt like below

```bash
> Welcome to InfluxDB 2.0!
? Please type your primary username admin
? Please type your password ***************
? Please type your password again ***************
? Please type your primary organization name Yavar
? Please type your primary bucket name CPEsyslog
? Please type your retentmybucketion period in hours, or 0 for infinite 336
? Setup with these parameters?
  Username:          admin
  Organization:      Yavar
  Bucket:            CPEsyslog
  Retention Period:  336h0m0s
 Yes
User	Organization	Bucket
admin	Yavar		CPEsyslog

```

Now we have created a default User with name and password, Organization and Bucket with the retention period.

## Creating the authorization token

create the authorization token with write access to write the logs into influx DB by the following command

```bash
influx auth create --write-bucket <bucket-id> -d "<Description for the token>"
```

Replace the bucket-id and description

To view the bucket id run the below command in the terminal

```bash
influx bucket ls 
```

To view token run the below command,

```bash
influx auth ls
```

## Refrences

* [InfluxDB's download web page](https://www.influxdata.com/downloads/)
* [InfluxDB's install web page](https://docs.influxdata.com/influxdb/v2/install/)
