2

Installing Ansible on Ubuntu

Ubuntu builds are available in a PPA here.

To configure the PPA on your system and install Ansible run these commands:

$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository --yes --update ppa:ansible/ansible
$ sudo apt install ansible

git@git:~$ ansible ERROR: Ansible requires the locale encoding to be UTF-8; Detected ISO8859-1. git@git:~$ ansible --version ERROR: Ansible requires the locale encoding to be UTF-8; Detected ISO8859-1. git@git:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS" git@git:~$

Rinzwind
  • 299,756
  • 1
    so check your locale (command locale)and it will not show utf-8. Please do explain why your system is not set to utf-8; that should be the default and not latin-1/iso8859-1 – Rinzwind Mar 25 '23 at 16:26

2 Answers2

4

I got the same issue in the latest version of ansible. I solved this by doing the following (my machine was Kali Linux):

sudo echo "LC_ALL=en_US.UTF-8" >> /etc/environment
sudo echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
sudo echo "LANG=en_US.UTF-8" > /etc/locale.conf
sudo apt-get clean && apt-get update -y
sudo apt-get install locales -y
sudo locale-gen en_US.UTF-8
0

step1- sudo nano /etc/default/locale

step2 - update the below line in the file

LANG="en_US.UTF-8"
LC_CTYPE="en.US.UTF-8"

step3

sudo update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8

finally restart the machine

Rinzwind
  • 299,756