简体   繁体   English

使用 Amazon Linux AMI 启动 EC2 时文件丢失

[英]File missing upon launching EC2 using Amazon Linux AMI

I've just launched an t2.micro free tier EC2 instance and SSH into it from my local machine.我刚刚启动了一个t2.micro免费层EC2实例,并从我的本地机器通过 SSH 连接到它。 And I was welcomed by an error message as below:我受到如下错误消息的欢迎:

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

This instance was launch using the console and every option has been by default and nothing special being configured.此实例是使用控制台启动的,默认情况下每个选项都已设置,没有任何特殊配置。 What could be the reason for it?原因可能是什么?

Below is the Locale of this instance:以下是此实例的Locale

[root@ip-xxx .aws]# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

in my case it was required to add following lines to /etc/environment在我的情况下,需要将以下几行添加到/etc/environment

LANG=en_US.utf-8
LC_ALL=en_US.utf-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Also for later use add the same two commands to ~/.bash_profile也为以后使用添加相同的两个命令~/.bash_profile

Based on @ardit comment基于@ardit 评论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 CLI 的带空格的 AWS EC2 和 AMI 标签 - AWS EC2 and AMI tags with spaces using CLI 在 EC2 Amazon Linux 2 上执行 Classic-Resource-Finder.sh - Executing Classic-Resource-Finder.sh on EC2 Amazon Linux 2 Bash文件在本地计算机上工作,但在Amazon EC2实例上不工作 - Bash file working on local computer but not working on Amazon EC2 instance Makefile 中的 ONESHELL 不适用于 Amazon Linux 2 ami 上的 bash - ONESHELL in Makefile not working with bash on Amazon Linux 2 ami 通过 Amazon EC2 用户数据脚本创建文件并保留环境变量 - Create file and persist environment variable via Amazon EC2 User Data script 如何使用jenkins将spring boot jar文件部署到EC2? - How to deploy spring boot jar file to EC2 using jenkins? 在Linux EC2实例启动上未运行的命令 - Commands not running on Linux EC2 instance launch 如何从命令行在Linux(ec2 / ubuntu)上运行/执行adobe AIR文件(没有gui) - How to run/execute an adobe AIR file on Linux (ec2/ubuntu) from command line only (no gui) Shell脚本从标签设置Amazon EC2主机名 - shell script to set amazon ec2 hostname from tags Amazon EC2 微型实例对“which python”命令没有响应 - Amazon EC2 micro instance not responsive to 'which python' command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM