Reputation: 2737
I just got the error from the subject of this question, when running a python app on a cloud server (Alibaba Cloud). Any idea how to solve it on Ubuntu?
Upvotes: -2
Views: 6449
Reputation: 1
I once solved this problem in docker
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
Upvotes: 0
Reputation: 617
You could also set the timezone information for the specific user:
edit .bashrc
to add a line like:
export TZ="/usr/share/zoneinfo/America/Chicago"
More details: https://www.cyberciti.biz/faq/howto-linux-set-time-zone-per-user-basis/
Upvotes: 2