The blog

  • 首页

  • 关于

  • 标签3

  • 分类2

  • 归档2

  • 搜索

Linux下更改时区

发表于 2018-12-12 | 分类于 linux

tzselect

tzselect 该命令可以查询时区并生成配置信息,并不会实际生效。
举例说明需要配置中国北京时间, 则按照步骤一步步选择下去,得到配置信息为TZ='Asia/Shanghai'; export TZ

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
tafan ~ $ tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa
2) Americas
3) Antarctica
4) Asia
5) Atlantic Ocean
6) Australia
7) Europe
8) Indian Ocean
9) Pacific Ocean
10) coord - I want to use geographical coordinates.
11) TZ - I want to specify the time zone using the Posix TZ format.
#? 4
Please select a country whose clocks agree with yours.
1) Afghanistan 18) Israel 35) Palestine
2) Armenia 19) Japan 36) Philippines
3) Azerbaijan 20) Jordan 37) Qatar
4) Bahrain 21) Kazakhstan 38) Russia
5) Bangladesh 22) Korea (North) 39) Saudi Arabia
6) Bhutan 23) Korea (South) 40) Singapore
7) Brunei 24) Kuwait 41) Sri Lanka
8) Cambodia 25) Kyrgyzstan 42) Syria
9) China 26) Laos 43) Taiwan
10) Cyprus 27) Lebanon 44) Tajikistan
11) East Timor 28) Macau 45) Thailand
12) Georgia 29) Malaysia 46) Turkmenistan
13) Hong Kong 30) Mongolia 47) United Arab Emirates
14) India 31) Myanmar (Burma) 48) Uzbekistan
15) Indonesia 32) Nepal 49) Vietnam
16) Iran 33) Oman 50) Yemen
17) Iraq 34) Pakistan
#? 9
Please select one of the following time zone regions.
1) Beijing Time
2) Xinjiang Time
#? 1

The following information has been given:

China
Beijing Time

Therefore TZ='Asia/Shanghai' will be used.
Local time is now: Mon Dec 10 17:46:38 CST 2018.
Universal Time is now: Mon Dec 10 09:46:38 UTC 2018.
Is the above information OK?
1) Yes
2) No
#? 1

You can make this change permanent for yourself by appending the line
TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Shanghai

####.profile修改

  1. 查看当前时区(当前是英国伦敦时间, 时区是UTC±0)

    1
    2
    ~ $ date -R
    Mon, 10 Dec 2018 09:56:19 +0000
  2. 把TZ='Asia/Shanghai'; export TZ 加到~/.profile文件中, 如果有其他的TZ配置需要注释掉, 最后输入命令source ~/.profile使文件立即生效

  3. 确认修改时区是正确的, 北京是UTC+8时区

    1
    2
    ~ $ date -R
    Mon, 10 Dec 2018 18:00:20 +0800
阅读全文 »

Linux下 Hexo + GitHub 搭建个人博客

发表于 2018-12-12 | 分类于 Hexo

Hexo 简介及搭建

Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown解析文章,在几秒内,即可利用靓丽的主题生成静态网页。


安装Hexo

安装 Hexo 相当简单。然而在安装前,您必须检查电脑中是否已安装下列应用程序:

  • Git – 需要把本地的网页和文章等提交到 GitHub 上
  • Node.js – Hexo 博客系统是基于 Node.js 编写的

安装 Git

sudo apt-get install git-core

安装成功

1
2
~ $ git --version
git version 2.7.4


安装 Node.js

安装 Node.js 的最佳方式是使用 nvm。

curl https://raw.github.com/creationix/nvm/v0.33.11/install.sh | sh
wget -qO- https://raw.github.com/creationix/nvm/v0.33.11/install.sh | sh

或者

手动安装: git clone http://github.com/creationix/nvm.git .nvm
cd .nvm
. install.sh

安装nvm完成后,重启终端并执行下列命令即可安装 Node.js
nvm install stable

安装成功

1
2
~ $ node -v
v11.3.0


安装Hexo

使用 npm 安装 Hexo

npm install -g hexo-cli

安装成功

1
2
~ $ hexo --version
hexo-cli: 1.1.0


本地调式 Hexo

执行下列命令,Hexo 将会在指定文件夹中新建所需要的文件

1
2
3
hexo init <folder>
cd <folder>
npm install # install node_modules

运行成功输出信息, 在浏览器中输入http://localhost:4000, 可以看到hexo页面。

1
2
3
4
$ hexo server
INFO Start processing
INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.
^C INFO See you again


Github Pages托管

Github Pages服务可以给我们提供一个静态网页的托管,以便远程浏览我们的博客内容。

首先我们需要在本机生成一个公钥以便跟github建立安全连接,使用下面命令后,
一直enter下去。

$ ssh-keygen -t rsa -C “email@domain.com“

这里的邮箱就是我们github setting 里面的邮箱,随后复制公钥内容:

cat ~/.ssh/id_rsa.pub

复制后,登陆github,进入Settings->SSH and GPG keys->New SSH key->粘贴

随后进入系统测试连接是否成功:

ssh -T git@github.com

根据提示输入yes,如果成功建立连接就可以进行接下来的操作了。

接下来我们使用我们需要在github上创建一个仓库repository,注意仓库名称必须为 [github_user].github.io (github_user 是你github的用户名, 这点非常重要)。


Hexo 与 GitHub Pages关联
  • 配置 Deployment

在_config.yml文件中,找到Deployment文件,然后按照如下修改:(注意冒号后面记得空一格!)

1
2
3
4
5
6
7
8
9
10
11
# Deployment

## Docs: https://hexo.io/docs/deployment.html

deploy:

type: git

repo: git@github.com:github_user/github_user.github.io.git

branch: master

  • 本地文件提交到 GitHub Pages,三个步骤,当然可以在生成静态文件后本地查看(hexo s)。
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    # 删除旧的 public 文件
    hexo clean

    # 生成新的 public 文件
    hexo generate(hexo g)

    # 本地查看
    # hexo s

    # 开始部署
    hexo deploye(hexo d)

在浏览器中输入https://github_user.github.io 就可以看到你的简单博客了。可能需要等待一段时间才能访问的。

期间出现改错误提示: ERROR Deployer not found: git, 需要安装一个扩展

npm install hexo-deployer-git –save

大功告成了 ~~~ ^_\^

阅读全文 »

tafanfly

tafanfly

2 日志
2 分类
3 标签
RSS
GitHub 简书
© 2018 tafanfly
本站总访问量 次 | 有人看过我的博客啦
由 Hexo 强力驱动 v3.8.0
|
主题 – NexT.Gemini v6.6.0