This commit is contained in:
pi
2017-11-23 16:42:56 +08:00
commit 31b5f4412d
459 changed files with 46898 additions and 0 deletions

View File

@@ -0,0 +1,235 @@
---
title: github+hexo 搭建博客
date: 2017-10-15 23:04:53
tags: [new,hexo,github pages,教程,配置]
categories: github + hexo
copyright: true
---
<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=439915614&auto=0&height=66"></iframe>
# 前言
本文章讲述如何利用 [github pages](https://github.com/) 和 [hexo](https://hexo.io/) 建博客
<!--more-->
## 准备环境
* 有一个github账号没有的话去 github https://github.com/ 注册一个;
* 安装node.js、npm
* 安装git
* 安装hexo
本文所使用的环境:
* ubuntu 16.04
* node.js 8.6.0
* git 2.7.4
* hexo 3.3.9
# 搭建github博客
## 创建仓库
在注册完github帐号后新建一个名为`用户名.github.io`的仓库比如说如果你的github用户名是test那么你就新建`test.github.io`的仓库(必须是你的用户名,其它名称无效),将来你的网站访问地址就是 http://test.github.io 。
![](/photo/注册1.png)
由此可见每一个github账户最多只能创建一个这样可以直接使用域名访问的仓库。
几个注意的地方:
1. 注册的邮箱一定要验证,否则不会成功;
2. 仓库名字必须是:`username.github.io`,其中`username`是你的用户名;
创建成功后,默认会在你这个仓库里生成一些示例页面,以后你的网站所有代码都是放在这个仓库里啦。
## node.js&&npm 安装
* node官网 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <v> https://nodejs.org/en/
* npm官网 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<v> https://www.npmjs.com
ubuntu下安装
``` bash
sudo apt-get install nodejs && npm
```
## git 安装
* git官网下载 &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<v> https://git-scm.com/downloads/
Windows: <v>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; https://windows.github.com/
Mac: <v>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; https://mac.github.com
其实ubuntu下直接安装就好:
``` bash
sudo apt-get install git
```
# 配置SSH key
为什么要配置这个呢因为你提交代码肯定要拥有你的github权限才可以但是直接使用用户名和密码太不安全了所以我们使用ssh key来解决本地和服务器的连接问题。
用git bash执行如下命令
``` bash
$ cd ~/. ssh #检查本机已存在的ssh密钥
```
如果提示No such file or directory 说明你是第一次使用git。
``` bash
ssh-keygen -t rsa -C "邮件地址"
```
然后连续3次回车最终会生成一个文件在用户目录下打开用户目录找到`.ssh\id_rsa.pub`文件记事本打开并复制里面的内容打开你的github主页进入个人设置 -> SSH and GPG keys -> New SSH key
![](http://image.liuxianan.com/201608/20160818_143914_495_9084.png)
将刚复制的内容粘贴到key那里title随便填保存。
## 测试是否成功
$ ssh -T git@github.com # 注意邮箱地址不改
如果提示`Are you sure you want to continue connecting (yes/no)?`输入yes然后会看到
> Hi liuxianan! You've successfully authenticated, but GitHub does not provide shell access.
看到这个信息说明SSH已配置成功
此时你还需要配置:
```bash
$ git config --global user.name "liuxianan"// 你的github用户名非昵称
$ git config --global user.email "xxx@qq.com"// 填写你的github注册邮箱
```
配置完之后输入:
```bash
$ git config --list #查看已设配置
```
查看usernameemail是否正确
# 使用hexo写博客
## hexo简介
Hexo是一个简单、快速、强大的基于 Github Pages 的博客发布工具支持Markdown格式有众多优秀插件和主题。
官网: http://hexo.io
github: https://github.com/hexojs/hexo
## 原理
由于github pages存放的都是静态文件博客存放的不只是文章内容还有文章列表、分类、标签、翻页等动态内容假如每次写完一篇文章都要手动更新博文目录和相关链接信息相信谁都会疯掉所以hexo所做的就是将这些md文件都放在本地每次写完文章后调用写好的命令来批量完成相关页面的生成然后再将有改动的页面提交到github。
## 安装
```bash
$ npm install -g hexo
```
## 初始化
在电脑的某个地方新建一个名为hexo的文件夹名字可以随便取
```bash
$ cd ~/hexo/
$ hexo init #初始化文件夹
$ npm install #安装包
```
hexo安装成功后hexo文件夹目录为
```javascript{.line-numbers}
.
├── _config.yml // 网站的配置信息,你可以在此配置大部分的参数。
├── package.json
├── scaffolds // 模板文件夹。当你新建文章时Hexo会根据scaffold来建立文件。
├── source // 存放用户资源的地方
| ├── _drafts
| └── _posts
└── themes // 存放网站的主题。Hexo会根据主题来生成静态页面
```
具体内容可见[hexo建站](https://hexo.io/zh-cn/docs/setup.html)
然后输入下面:
```bash
$ hexo g # 生成public文件夹浏览器访问资源
$ hexo s # 启动服务
```
执行以上命令之后hexo就会在public文件夹生成相关html文件这些文件将来都是要提交到github去的
`hexo s`是开启本地预览服务,打开浏览器访问 http://localhost:4000 即可看到内容很多人会碰到浏览器一直在转圈但是就是加载不出来的问题一般情况下是因为端口占用的缘故因为4000这个端口太常见了解决端口冲突问题请参考这篇文章
http://blog.liuxianan.com/windows-port-bind.html
第一次初始化的时候hexo已经帮我们写了一篇名为 Hello World 的文章,默认的主题比较丑,打开时就是这个样子:
![](/photo/2017.10.15.22.1.png)
## 配对ssr
打开`~\Hexo` 文件夹中的`_config.yml`文件,填写内容
```bash
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repository: git@github.com:WarlockFish/WarlockFish.github.io.git #填入你的github链接我填的是我的
branch: master
```
## 修改主题
默认主题很丑,可以来替换一个好看点的主题。这是 [官方主题](https://hexo.io/themes/) 链接
我使用的是 [next](https://github.com/iissnan/hexo-theme-next) .
喜欢使用可以安装:
```bash
$ git clone https://github.com/iissnan/hexo-theme-next themes/next
```
记住要在hexo目录中执行上面指令。
修改`hexo`目录中的`_config.yml`中的`theme: landscape`改为`theme: next`,保存退出,
然后执行`hexo g`来重新生成文件。
```bash
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next
```
## 写博客
在`hexo`下
```bash
hexo n "name of the new post"
```
在`~/hexo/source/_posts`下会生成一份博客Hexo使用MarkDown写作语法。写完后可以使用
```bash
hexo g
hexo s
```
然后可以在本地访问 http://localhost:4000 查看效果,便于更改
## 更新Github
进入目录
```bash
$ cd ./hexo
$ hexo g #编译本地内容
$ hexo d #上传到github上
```
这样就发布成功了,可以在网络上访问了。
谢谢阅读!!

View File

@@ -0,0 +1,41 @@
---
title: Hello World
date: 2017-10-07 10:00:00
tags: [hello world]
---
Welcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues).
## Quick Start
### Create a new post
``` bash
$ hexo new "My New Post"
```
More info: [Writing](https://hexo.io/docs/writing.html)
### Run server
``` bash
$ hexo server
```
More info: [Server](https://hexo.io/docs/server.html)
### Generate static files
``` bash
$ hexo generate
```
More info: [Generating](https://hexo.io/docs/generating.html)
### Deploy to remote sites
``` bash
$ hexo deploy
```
More info: [Deployment](https://hexo.io/docs/deployment.html)

View File

@@ -0,0 +1,30 @@
---
title: my-first-blog
date: 2017-10-07 22:03:57
tags: [new,github pages,静态网站]
categories: github pages
---
<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/
player?type=2&id=28138493&auto=0&height=66"></iframe>
# 前言
使用github pages服务搭建博客的好处有
1. 全是静态文件,访问速度快;
2. 免费方便,不用花一分钱就可以搭建一个自由的个人博客,不需要服务器不需要后台;
<!--more-->
3. 可以随意绑定自己的域名不仔细看的话根本看不出来你的网站是基于github的
4. 数据绝对安全基于github的版本管理想恢复到哪个历史版本都行
5. 博客内容可以轻松打包、转移、发布到其它平台;
6. 等等;
![](/photo/train.jpg)

View File

@@ -0,0 +1,25 @@
---
title: ubuntu强制清除垃圾回收站
copyright: true
date: 2017-11-22 20:38:23
tags: [unbuntu,linux垃圾站]
categories: linux
---
# 强制清除垃圾回收站
<!--more-->
## 问题
我遇到了无法在Ubuntu 16.04中清空回收站的问题。我右键回收站图标并选择清空回收站,就像我一直做的那样。我看到进度条显示删除文件中过了一段时间。但是它停止了,垃圾站中有些文件删除了,但有些文件还是没有删除。在看了文件夹后原来没有权限。
## 方案
Ubuntu 16.04的回收站路径为
```bash
$HOME/.local/share/Trash/
```
然后用以下命令即可清空回收站
```bash
sudo rm -fr $HOME/.local/share/Trash/files/*
```

View File

@@ -0,0 +1,239 @@
---
title: ubuntu配置
copyright: true
date: 2017-10-29 21:55:50
tags: [ubuntu, 教程]
categories: ubuntu 安装
---
# ubuntu16.04安装后配置
<!--more-->
## 0.更新源
更换阿里云的源
``` bash
# deb cdrom:[Ubuntu 16.04.3 LTS _Xenial Xerus_ - Release amd64 (20170801)]/ xenial main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
```
list文件在`/etc/apt/sources.list`下
然后更新源和软件
```bash
sudo apt-get update
sudo apt-get dist-upgrade
```
## 1.更换显卡驱动
![显卡更换](/photo/驱动01.png)
ubuntu上有nvidia的驱动
## 2.同步时间
使用双系统时间不同,故要使用
```bash
sudo timedatectl set-local-rtc 1
```
## 3.安装软件
### 3.1 删除亚马逊链接
```bash
sudo apt-get remove unity-webapps-common
```
### 3.2 安装vim
sudo apt-get install vim
### 3.3 安装git和vpnc
sudo apt-get install vpnc git
### 3.4 安装ExFat文件系统驱动
Ubuntu默认不支持exFat文件系统的挂载需要手动安装exfat的支持
sudo apt-get install exfat-fuse
### 3.5 修复分区
sudo ntfsfix /dev/sda8
### 3.6安装atom
官网下载最新版本 [atom](https://atom.io/)
### 3.7 uget+aria2下载工具
安装uget和aria2
```bash
sudo apt-get install uget aria2
```
配置
a.打开uget。
b.打开界面的编辑—>设置—>插件插件匹配顺序aria2 。
c.打开界面的分类—>默认一般设置。调整最大连接数建议在5)。设置一下下载文件夹。
在火狐中使用Flashgot扩展就可以。
### 3.8 安装shadowsocks-qt5
* 添加源安装
```bash
sudo add-apt-repository ppa:hzwhuang/ss-qt5
sudo apt-get update
sudo apt-get install shadowsocks-qt5
```
### 3.9 安装wine/TIM
使用 wine staging 开发版本的 wine )安装详细教程 https://wine-staging.com/installation.html
```bash
sudo dpkg --add-architecture i386
#add the repository:
wget -nc https://dl.winehq.org/wine-builds/Release.key
sudo apt-key add Release.key
sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
#install
sudo apt-get update
sudo apt-get install --install-recommends winehq-staging
```
去qq官网下载[TIM](http://office.qq.com/) 我使用的是TIM1.2。
安装wine后 ,命令执行`winecfg`然后会安装一些插件选择安装它们。然后拷贝windows字体不安装字体会使一些字无法查看
windows字体在c\windows\fonts
把这个目录下字体全部复制到wine下的设置目录下
~/.wine/drive_c/windows/Fonts/
重载所有wine的配置`wineboot`
再次打开wine `winecfg`配置如图
![wine 设置](/photo/wine设置.png)
然后重启一下wine `wineboot` 。安装tim时使用Wine Windows Program Loader 打开TIM。然后就是windows下安装程序——点点点。
备注此方法有个bug 当TIM打开讨论组时会是TIM崩溃。
建立桌面快捷方式
```bash
[Desktop Entry]
Encoding=UTF-8
Version=1.2
Name[en_US]=TIM
Name[zh_CN]=腾讯TIM
Exec=env LC_ALL=zh_CN.utf8 wine /home/h/.wine/drive_c/Program\ Files\ \(x86\)/Tencent/TIM/Bin/TIM.exe
Icon=/home/h/we/electronic-wechat-linux-x64/photo/TIM.ico
Terminal=false
NoDisplay=false
StartupNotify=true
Type=Application
Categories=Network;InstantMessaging;
```
### 3.10 安装electronic-wechat
项目在 [github](https://github.com/geeeeeeeeek/electronic-wechat) 上 。
我使用源码安装失败了npm总是出错不知为什么。如果你使用源码安装成功请求教最后使用安装版见此 https://github.com/geeeeeeeeek/electronic-wechat/releases
在桌面上建立图标
```bash
[Desktop Entry]
Encoding=UTF-8
Name=微信
Comment=electronic-wechat
Exec=/home/h/we/electronic-wechat-linux-x64/electronic-wechat
Icon=/home/h/we/electronic-wechat-linux-x64/photo/icon.png
Terminal=false
StartupNotify=true
Type=Application
Categories=Application
```
### 3.11 安装最新的python3
首先下载最新的python版本这个在python官网上下载[python官网](https://www.python.org/downloads/)
解压 进入其目录
```bash
./configure
make
make install
```
安装完后检查二进制文件的位置
```ruby
which python3
python3 -V #V是大写的
```
### 3.12安装最新版本的npm 和 nodejs
首先安装npm和 nodejs
```ruby
sudo apt-get install nodejs-legacy
suao apt-get install npm
```
ubuntu上安装时npm和nodejs都是低版本。
- 升级npm
```bash
sudo npm install npm -g
```
- 升级node.js
```bash
sudo npm install -g n
sudo n stable
```
## 4.gnome3的安装和配置
- 安装gnome
```bash
sudo apt-get install gnome
```
- arc主题
在github上的项目 [horst3180/arc-theme](https://github.com/horst3180/arc-theme)
- Papirus图标
github上项目[PapirusDevelopmentTeam/papirus-icon-theme](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme)
```bash
sudo add-apt-repository ppa:papirus/papirus
sudo apt-get update
sudo apt-get install papirus-icon-theme
```