我的 2019 年

网址:2019
https://mixlabpro.github.io

服务器配置

服务器:https://bandwagonhost.com
系统:ubuntu 18.04

ssh 远程登录

1
2
3
4
5
6
7
8
9
iosgouiMac:~ iosdevlog$ ssh -p xxxx root@xxx.xxx.xxx.xxx
root@ Server's password:
Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-20-generic x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage

Last login: Thu Feb 28 22:24:41 2019 from 119.137.55.244

上传下载文件

1
2
3
4
$ scp -P xxxx local username@xxx.xxx.xxx.xxx:/home/username/xxx
$ scp -P xxxx username@xxx.xxx.xxx.xxx:/home/username/xxx local
$ sftp -P xxxx username@xxxx.xxx.xxx.xxx
> get xxx.tar.gz

用户

添加用户

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
root@ubuntu:~# adduser iosdevlog
Adding user `iosdevlog' ...
Adding new group `iosdevlog' (1000) ...
Adding new user `iosdevlog' (1000) with group `iosdevlog' ...
Creating home directory `/home/iosdevlog' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for iosdevlog
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]

分配 sudo 权限

1
root@ubuntu:~# usermod -aG sudo iosdevlog

测试 sudo 权限

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
root@ubuntu:~# echo $USER
root
root@ubuntu:~# su - iosdevlog
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
iosdevlog@ubuntu:~$ echo $USER
iosdevlog
iosdevlog@ubuntu:~$ sudo ls -la /root
total 24
drwx------ 4 root root 4096 Apr 30 2018 .
drwxr-xr-x 22 root root 4096 Feb 28 22:39 ..
-rw-r--r-- 1 root root 3106 Apr 9 2018 .bashrc
drwx------ 2 root root 4096 Apr 30 2018 .cache
drwxr-xr-x 3 root root 4096 Apr 30 2018 .local
-rw-r--r-- 1 root root 148 Aug 17 2015 .profile

更新

更新源

1
2
3
4
5
6
7
8
9
iosdevlog@ubuntu:~$ sudo apt update
[sudo] password for iosdevlog:
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
...
Fetched 4,040 kB in 2s (1,660 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
103 packages can be upgraded. Run 'apt list --upgradable' to see them.

更新软件

1
2
3
4
5
6
7
8
9
10
11
$ sudo apt upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
...
Found initrd image: /boot/initrd.img-4.15.0-20-generic
done
Processing triggers for initramfs-tools (0.130ubuntu3.6) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-45-generic

软件

命令行终端切换 GNU Screen

1
$ sudo apt install screen -y

创建一个名为 “download” 的窗口

1
2
3
4
5
$ screen -S download
$ screen -list
There is a screen on:
26633.download (03/01/2019 12:48:02 AM) (Attached)
1 Socket in /run/screen/S-iosdevlog.

脱离当前窗口: C-a d

1
2
3
4
5
[detached from 26633.download]
$ screen -list
There is a screen on:
26633.download (03/01/2019 12:48:03 AM) (Detached)
1 Socket in /run/screen/S-iosdevlog.

恢复 “download” 窗口

1
2
3
4
5
$ screen -r download
$ screen -list
There is a screen on:
26633.download (03/01/2019 12:48:02 AM) (Attached)
1 Socket in /run/screen/S-iosdevlog.

版本控制 git

1
$ sudo apt install git -y

文本编辑 vim

1
2
3
4
$ sudo apt install vim -y
$ git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
$ sh ~/.vim_runtime/install_awesome_vimrc.sh
Installed the Ultimate Vim configuration successfully! Enjoy :-)

翻越万里长城 shadowsocks

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
$ mkdir .bin
$ cd .bin
$ git clone https://github.com/teddysun/shadowsocks_install
$ cd shadowsocks_install/
$ sudo bash shadowsocks-all.sh
...
2019-02-28 23:00:45 INFO loading libcrypto from libcrypto.so.1.1
started
Starting Shadowsocks success

Congratulations, Shadowsocks-Python server install completed!
Your Server IP : xxx.xxx.xxx.xxx
Your Server Port : xxxx
Your Password : xxxxxxxx
Your Encryption Method: rc4-md5

Your QR Code: (For Shadowsocks Windows, OSX, Android and iOS clients)
ss://cmM0LW1kNTpwYXNzd29yZEA2Ny4yMTguMTMyLjUwOjEwMDAx
Your QR Code has been saved as a PNG file path:
/home/iosdevlog/.bin/shadowsocks_install/shadowsocks_python_qr.png

Welcome to visit: https://teddysun.com/486.html
Enjoy it!
$ sudo apt install w3m -y
$ w3m https://www.google.com

Node Version Manager nvm

1
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

Node.js®

1
2
3
4
5
6
7
8
$ nvm install stable
Downloading and installing node v11.10.1...
Downloading https://nodejs.org/dist/v11.10.1/node-v11.10.1-linux-x64.tar.xz...
############################################################################################################################################################################ 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v11.10.1 (npm v6.7.0)
Creating default alias: default -> stable (-> v11.10.1)

搭建网站 hexo

1
2
3
4
5
$ npm install hexo-cli -g
$ hexo init blog
$ cd blog
$ npm install
$ hexo server

主题 NexT

1
2
$ mkdir themes/next
$ curl -s https://api.github.com/repos/iissnan/hexo-theme-next/releases/latest | grep tarball_url | cut -d '"' -f 4 | wget -i - -O- | tar -zx -C themes/next --strip-components=1

管理插件 Hexo Admin

1
2
$ npm install --save hexo-admin
$ hexo server -d

打开浏览器: http://localhost:4000/admin/

发布到 GitHub Page

参考:http://theme-next.iissnan.com

创建仓库:MixLabPro.github.io

1
2
3
4
5
6
7
$ npm install -g hexo-cli
$ hexo init MixLabPro
$ cd MixLabPro/
$ npm install
$ mkdir themes/next
$ curl -s https://api.github.com/repos/iissnan/hexo-theme-next/releases/latest | grep tarball_url | cut -d '"' -f 4 | wget -i - -O- | tar -zx -C themes/next --strip-components=1
$ npm install hexo-deployer-git --save

搜索

安装搜索插件: hexo-generator-searchdb

1
$ npm install hexo-generator-searchdb --save

配置博客

安装完成,编辑博客配置文件:_config.yml

1
2
3
4
5
search:
path: search.xml
field: post
format: html
limit: 10000

配置主题

Next 主题自带搜索设置,编辑主题配置文件:_config.yml

找到文件中 Local search 的相关配置,设为 true

1
2
3
4
5
6
7
8
9
# Local search
# Dependencies: https://github.com/flashlab/hexo-generator-search
local_search:
enable: true
# if auto, trigger search by changing input
# if manual, trigger search by pressing enter key or search button
trigger: auto
# show top n results per article, show all results by setting to -1
top_n_per_article: 1

数学公式

1
2
$ npm un hexo-renderer-marked --save
$ npm i hexo-renderer-kramed --save

创建脚本一键发布deploy.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ cat deploy.sh
#!/bin/sh

hexo clean
hexo g # hexo generate
hexo d # hexo deploy
$ chmod +x deploy.sh
$ ./deploy.sh
...
Counting objects: 153, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (136/136), done.
Writing objects: 100% (153/153), 1.21 MiB | 541.00 KiB/s, done.
Total 153 (delta 21), reused 0 (delta 0)
remote: Resolving deltas: 100% (21/21), completed with 1 local object.
To https://github.com/MixLabPro/MixLabPro.github.io
f5de7d7..c94e3e9 HEAD -> master
Branch 'master' set up to track remote branch 'master' from 'https://github.com/MixLabPro/MixLabPro.github.io'.
INFO Deploy done: git
iOSDevLog wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!