diff --git a/2016/01/14/FirstBlog/index.html b/2016/01/14/FirstBlog/index.html deleted file mode 100644 index a9d9ff0..0000000 --- a/2016/01/14/FirstBlog/index.html +++ /dev/null @@ -1,193 +0,0 @@ - - -
- - -Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
-1 | $ hexo new "My New Post" |
More info: Writing
-1 | $ hexo server |
More info: Server
-1 | $ hexo generate |
More info: Generating
-1 | $ hexo deploy |
More info: Deployment
- - -+ + +
+零零碎碎花了几天时间,终于把博客搭建起来了,下面详细记录下过程。
+本机安装Windows10,并安装了VirtualBox创建了一台CentOS7的虚拟机。
Hexo(包括themes)和git等软件在虚拟机上安装,因为:
GitHub作为博客网站的托管,同时作为博客Markdown源文件的远程仓库。
Markdown文件的编辑在Windows上完成,使用SublimeText编辑器,并使用SFTP插件同步到Linux虚机上。
安装过程略。
+注意,虚机网卡要选择桥接网络,这样可以和本机一样DHCP从路由器获取IP地址并上网,同时本机也可以SecureCRT连接
到虚机,默认NAT模式的话本机无法直接ssh到虚机的10.0.2.15地址。
安装epel源
+1 | # yum install epel-release.noarch |
安装git
+1 | # yum install git |
安装npm
+1 | # yum install npm |
略
+1 | # git config --global user.name davyyy |
1 | $ ssh-keygen -t rsa -b 4096 -C "dawei.si@qq.com" |
生成到key在 /home/davy/.ssh 目录中
1 | $ cd ~/.ssh |
登陆GitHub网站,进入 Settings 页面,选择 SSH keys ,点击Add SSH key,
拷贝 id_ras.pub 中的内容,添加到key中.
测试连接GitHub
+1 | $ ssh -T git@github.com |
root用户安装hexo命令行
+# npm install -g hexo-cli
切换到普通用户
+1 | $ cd ~ |
会自动生成一个 blog 目录,进入该目录继续执行:
+1 | $ cd blog |
++注意: 以下
+hexo命令都是在blog目录内执行
编辑hexo的配置文件,位于blog目录下的_config.yml文件,
1 | # Site |
新建一篇博客
+1 | $ hexo new my-first-blog |
生成的.md文件在blog/source/_posts中,随便写点内容。
测试一下:
+1 | $ hexo generate |
浏览器访问http://192.168.1.111:4000/ (虚机的IP)
+在GitHub上新建名为 davyyy.github.io 的repository,其中davyyy是我在GitHub上的用户名。
编辑_config.yml,设置Deployment部分配置1
2
3
4
5
6
7
8$ vim _config.yml
# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
type: git
repo: git@github.com:davyyy/davyyy.github.io.git
branch: master
运行1
$ hexo deploy
++如果前面生成SSH key的时候设置了passphrase,这里会提示输入
+
一切顺利的话,过一会儿访问 http://davyyy.github.io/ 就能看到效果了
+如果页面没有更新,可以去GitHub仓库 https://github.com/davyyy/davyyy.github.io 看看页面是否已经上传。
+在GitHub上新建一个repository,名称和本地目录保持一致,也叫blog。
+创建本地仓库
+1 | $ cd ~/blog |
编辑.gitignore1
2
3
4
5$ vim .gitignore
node_modules/
public/
.deploy_git/
db.json
添加远程仓库1
$ git remote add origin git@github.com:davyyy/blog.git
将所有文件都保存到本地仓库1
2$ git add .
$ git commit -m "add all files"
推送到远程仓库1
$ git push origin master
Hexo官网 上有很多主题推荐,可以预览一遍,选择一个自己喜欢的。
在尝试了 NexT 和 Jacman之后,最(zan)终(shi)选择了Jacman.
这里要 注意 一下主题的安装方式
+文档中写的是:
+1 | $ git clone https://github.com/wuchong/jacman.git themes/jacman |
因为blog目录本身已经是一个git仓库了,这里又clone了一个过来,会造成blog自身库的更新问题.
如果把jacman下的.git目录删掉,blog更新没问题了,但是以后主题版本的更新会比较麻烦。
搜索了一番,使用 git submodule 命令添加即可:1
$ git submodule add https://github.com/wuchong/jacman.git themes/jacman
按照 文档 配置主题.
因为主题文件夹也是git库,所以配置文件有改动后,要把改动commit一下:
1 | $ cd themes/jacman/ |
++这里主题的改动就不用push到GitHub上了
+
| 插件名称 | +说明 | +
|---|---|
| Project Manager | +方便项目管理 | +
| IMESupport | +解决输入法不跟随问题 | +
| SFTP | +通过SSH同步文件 | +
| SideBarEnhancements | +侧边栏功能增强 | +
在Windows中新建文件夹Blog,这里我只想和CentOS同步博客的源文件,即source目录,
+Project -> Project Manager -> Add Project 新建一个项目,方便以后打开SFTP/FTP -> Map to Remote..sftp-config.json文件主要的配置项:
+1 | "host": "192.168.1.111", |
文件编辑完成后,右键选择Upload(当然也可以使用ctrl-shift-p或快捷键)即可同步到远程。
hexo g, hexo s1 | $ git add . |
最后还要将博客页面发布到GitHub上
+1 | $ hexo d |
+ + +
+Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
+1 | $ hexo new "My New Post" |
More info: Writing
+1 | $ hexo server |
More info: Server
+1 | $ hexo generate |
More info: Generating
+1 | $ hexo deploy |
More info: Deployment
+ ++ + +
+记录使用VirtualBox安装OpenStack的过程.
+菜单栏 管理->全局设定->网络,选择 仅主机(Host-Only)网络, 添加两个网络,网络分别设置为:
两个网络都没有启用DHCP服务器.
+为了避免重复操作,先创建一台虚拟机,安装公共的软件后,再制作快照复制.
总共添加3块虚拟网卡, 第一块是选择桥接网络,另外两块分别选择上面创建的网络#2和#3
语言选择English,软件选择最小安装.
+安装完毕后,停以下服务:
+1 | # systemctl disable firewalld.service |
最小安装缺少的常有命令:
+1 | # yum install vim |
其中 net-tools 是为了使用 ifconfig 命令.bash-completion是增强自动补全功能,可以补全子命令
系统的3块网卡名分别是: enp0s3, enp0s8, enp0s9
+桥接网络,dhcp获取的地址是192.168.1.1121
2
3
4
5
6
7
8
9
10
11# cat ifcfg-enp0s3
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
NAME=enp0s3
UUID=3b6d6cd2-8309-438b-98a6-f03025c38c55
DEVICE=enp0s3
ONBOOT=yes
用于管理网络1
2
3
4
5
6
7
8
9
10
11
12# cat ifcfg-enp0s8
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
NAME=enp0s8
DEVICE=enp0s8
ONBOOT=yes
IPADDR=10.0.0.11
PREFIX=24
用于虚机网络1
2
3
4
5
6
7
8
9
10
11
12# cat ifcfg-enp0s9
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
NAME=enp0s9
DEVICE=enp0s9
ONBOOT=yes
IPADDR=172.16.1.100
PREFIX=24
配置hostname为controller,并配置/etc/hosts, 添加如下配置:
1 | # controller |
后面的操作主要就是参照 官方手册 一步步的执行,不再列出完整的过程.
+其中配置文件的编辑部分比较繁琐,参考 陈沙克博客,使用openstack-config命令完成
安装EPEL源1
# yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
安装OpenStack源1
# yum install centos-release-openstack-liberty
安装openstack客户端1
# yum install python-openstackclient
安装selinux工具1
# yum install openstack-selinux
更新系统1
# yum update
++执行到此可以将虚机关机,并制作快照
+
复制虚拟机controller, 新的虚拟机用作计算节点, 名为compute01
+参照文档以下的章节依次安装:
+++其中网络部分选择第一种,Provider networks
+网络安装部分指定的网卡是 enp0s9
+
计算节点虚机启动前可以更改一下配置,多分配一点内存和CPU.
+安装包之前要先修改网络和Hostname配置.
+计算节点的安装比较简单,主要就是nova和neutron的部分,参照文档执行即可.
+供应商网络类型选择Flat, 物理网络是public,网络地址是172.16.1.0/24
+虚机中起虚机,速度感人,只能用cirros尝鲜.
+开始上传镜像时一直报错,日志显示是keystone调用出错,后来发现是自己配置错了,囧.
+虚机创建时报错,”No valid host was found”, 开始以为是虚机的内存分的不够,更改了虚机配置后仍然报错.
查看计算节点的nova-compute日志, “libvirtError: invalid argument: could not find capabilities for domain type=kvm”,
感觉VirtualBox的虚机不支持kvm,按照网上说法,应该是从5.0版本已经开始支持kvm了,而且虚机的设置页面,系统硬件加速显示是支持KVM半虚拟化,但是就是不行. 最终只能使用qemu全虚拟化,更改计算节点的nova.conf:
1 | [libvirt] |
重启服务后生效,虚机创建成功.
+虚机启动后无法获取地址,手动配置地址后,和所在的计算节点可以互通,但是和管理节点不通.
在管理节点抓包,可以抓取到虚机发送的报文.
同时管理节点可以ping通dhcp-port,但是在计算节点上ping不通dhcp-port的地址.
现在不能确定是不是VirtualBox的虚拟网络问题,还是这个地址段的问题
google了一番, 参考这个博客 终于解决了.
主要是这里
++Tip: it is important to enable Promiscuous mode on eth1, the data traffic interfaces on both compute and controller node. Without this setting packets will not reach from OpenStack tenant VMs (that will be started inside the compute node), to the OpenStack controller.
+
把对应的网卡设置,选择高级, 把 混杂模式 原来是”拒绝”改成”全部允许”