# Install Zabbix Agent Ubuntu

### Ubuntu 22.04

```
 wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-2+ubuntu22.04_all.deb
```

```
dpkg -i zabbix-release_5.0-2+ubuntu22.04_all.deb
```

```
apt-get update
```

```
apt-get install zabbix-agent
```

### Ubuntu 20.04

```
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1%2Bfocal_all.deb
```

```
dpkg -i zabbix-release_5.0-1+focal_all.deb
```

```
apt-get update
```

```
apt-get install zabbix-agent
```

### Ubuntu 18.04

```
wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1%2Bbionic_all.deb
```

```
dpkg -i zabbix-release_5.0-1+bionic_all.deb
```

```
sudo apt update
```

```
apt-get install zabbix-agent
```

### Configure Zabbix Agent for Passive Checks

Edit the zabbix configuration file:

```
sudo vi /etc/zabbix/zabbix_agentd.conf
```

Set the following parameter according to your environment:

```
Server=192.168.100.51
```

save the file and close

Restart and enable zabbix agent service

```
sudo systemctl restart zabbix-agent
```

```
sudo systemctl enable zabbix-agent
```

Start/stop/check status of zabbix agent service:

```
sudo systemctl start zabbix-agent
sudo systemctl stop zabbix-agent 
sudo systemctl status zabbix-agent
```

### Configure Zabbix Agent for Active Checks

Edit the zabbix configuration file:

```
sudo vi /etc/zabbix/zabbix_agentd.conf
```

Set the following parameters according to your environment:

```
ServerActive=192.168.100.51
Hostname=zabbix.fosstechnix.local
```

save the file and close

Restart and enable zabbix agent service

```
sudo systemctl restart zabbix-agent
```

```
sudo systemctl enable zabbix-agent
```

Start/stop/check status of zabbix agent service:

```
sudo systemctl start zabbix-agent
sudo systemctl stop zabbix-agent 
sudo systemctl status zabbix-agent
```

### Configure TLS with PSK

Edit the zabbix configuration file:

```
sudo nano /etc/zabbix/zabbix_agentd.conf
```

Set the following parameters where **unique\_psk\_identity** is some unique value for the agent you are configuring. I can be anything as long as it's unique for this host:

```
TLSConnect=psk
TLSAccept=psk
TLSPSKIdentity=unique_psk_identity
TLSPSKFile=/etc/zabbix/zabbix_agentd.psk
```

save the file and close

Run the following command to generate a psk file using the path and name specified in the **TLSPSKFile** parameter from above:

```
openssl rand -hex 32 | sudo tee /etc/zabbix/zabbix_agentd.psk
```

Note the generated random string as you will need it to configure the agent on the Zabbix server under the **Configuration --&gt; Hosts --&gt; Host --&gt;Encryption** tab.

Start/stop/check status of zabbix agent service:

```
sudo systemctl start zabbix-agent
sudo systemctl stop zabbix-agent 
sudo systemctl status zabbix-agent
```