Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Usually, I run aptitude -y install locales then dpkg-reconfigure locales to set up locale.

Now I want to put it into a shell script, how can I reliably do the following, automatically / non-interactively?

  • Choose en_US.UTF-8 and set it as system default
  • Disable all other locales
  • (Optional) Verify if /etc/default/locale contains one-and-only entry of LANG=en_US.UTF-8 as expected
share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

See locale-gen:

 locale-gen --purge en_US.UTF-8

and

 echo -e 'LANG="en_US.UTF-8"\nLANGUAGE="en_US:en"\n' > /etc/default/locale
share|improve this answer
1  
Thanks, but I'm getting File "/usr/share/apt-listchanges/ALChacks.py", line 32, in <module> sys.stderr.write(_("Can't set locale; make sure $LC_* and $LANG are correct!\n"))... –  kenn Feb 23 '12 at 8:02
    
Try LANG=en_US.UTF-8 locale-gen --purge en_US.UTF-8 –  Stone Feb 23 '12 at 9:36
    
This morning, with a clean state of VM, it worked! Thanks! –  kenn Feb 23 '12 at 19:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.