
perl: warning: Setting locale failed. – Fixed in CentOS 8


Getting warning about “setting locale failed” while executing Perl on CentOS 8?
I was trying to run Nikto and got this error.
[[email protected] program]# ./nikto.pl -h $IPADDRESS
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
[[email protected] program]#
It was on DO server which I used SSH terminal to connect from macOS. If you are encountering this error, here is how you can fix.
Solution
Export the following locale on your terminal and run the program.
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
It ran smoothly to me and hope it helps you too.
This is fine if you just need to do one time. However, if you need to run it periodically then you may want to set this in profile so it loads during logon.
- Go to the user’s home directory
- Modify
.bash_profile
(assuming you are using bash) usingvi
- Add the following and save the file
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
That’s all!
Now, I can run Perl 😊
- Tagged in:
- Linux
More great readings on Sysadmin
-
Looking For Traceroute on RHEL 8? Try TracepathAbhishek Nair on June 14, 2022
-
6 Best Switch Port Monitoring ToolsDurga Prasad Acharya on June 12, 2022
-
Windows 10/11 Random Shutdown: How to Find the CauseHitesh Sant on May 30, 2022
-
7 Best Server Configuration Monitoring and Auditing ToolsTalha Khalid on May 28, 2022
-
8 Best FTP Server Software for Windows for Secure TransferSatish Shethi on May 24, 2022
-
OSI Model Layers: An Introduction GuideAmrita Pathak on May 13, 2022
Join Geekflare Newsletter
Every week we share trending articles and tools in our newsletter. More than 10,000 people enjoy reading, and you will love it too.