For example, on Ubuntu (20.04):
$ sudo apt search "aspell-*" | grep -B 1 Spanish # search for a Spanish dictionary
...
aspell-es/focal 1.11-15 all
Spanish dictionary for aspell
$ sudo apt install aspell-es # install it
...
$ aspell --lang es dump master | aspell --lang es expand | tr ' ' '\n' > es.dic # convert it for JetBrains IDEs
...