When running Perl in Ubuntu 8.10 you might run across the following error message after your server is first installed:
perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = "en_US", LC_CTYPE = "en_US.UTF-8", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory
The reason you receive this error is because the locale packages for Ubuntu were not loaded correctly when the install was performed. Two simple commands will install the correct packages and get you on your way.
To repair the packages, type the following command:
Note: You must be logged in as 'root' to perform these commands.
# aptitude install language-pack-en-base
This will prompt you to install the 'language-pack-en' package. Press 'Y' when it prompts you to install.
Now we need to have Ubuntu reconfigure the languages so that it knows what locale to set for the system. Type the following command to reconfigure:
# dpkg-reconfigure locales
Once that completes you will need to log out of your server and log back in. Once you log back in you should be able to run perl -v to verify that you no longer see the locale errors.
root@ubuntu810:~# perl -v This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi Copyright 1987-2007, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
--Kelly Koehn 12:05, 25 March 2009 (CDT)
© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License