Linux 使用笔记
Linux 使用笔记,以 Ubuntu 为例,部分环境配置支持 WSL。
安装
安装方式:
- 在物理机安装。
- 在 VMware 中安装。
$ neofetch
.-/+oossssoo+/-. feilong@feilong-Lenovo
`:+ssssssssssssssssss+:` ----------------------
-+ssssssssssssssssssyyssss+- OS: Ubuntu 18.04.3 LTS x86_64
.ossssssssssssssssssdMMMNysssso. Host: Lenovo G480 Lenovo G480
/ssssssssssshdmmNNmmyNMMMMhssssss/ Kernel: 5.0.0-37-generic
+ssssssssshmydMMMMMMMNddddyssssssss+ Uptime: 23 hours, 15 mins
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss/ Packages: 1869
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Shell: zsh 5.4.2
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ Resolution: 1366x768, 2048x1080
ossyNMMMNyMMhsssssssssssssshmmmhssssssso DE: GNOME 3.28.4
ossyNMMMNyMMhsssssssssssssshmmmhssssssso WM: GNOME Shell
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ WM Theme: Adwaita
.ssssssssdMMMNhsssssssssshNMMMdssssssss. Theme: Ambiance [GTK2/3]
/sssssssshNMMMyhhyyyyhdNMMMNhssssssss/ Icons: Ubuntu-mono-dark [GTK2/3]
+sssssssssdmydMMMMMMMMddddyssssssss+ Terminal: gnome-terminal
/ssssssssssshdmNNNNmyNMMMMhssssss/ CPU: Intel i3-2370M (4) @ 2.400GHz
.ossssssssssssssssssdMMMNysssso. GPU: Intel 2nd Generation Core Processor Family
-+sssssssssssssssssyyyssss+- GPU: NVIDIA GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M
`:+ssssssssssssssssss+:` Memory: 2620MiB / 7873MiB
.-/+oossssoo+/-.
初始化
-
修改镜像源为 “mirrors.aliyun.com”,具体内容请参考阿里巴巴开源镜像站。
-
更新系统并安装软件。
$ sudo -i # apt update -y && apt upgrade -y # apt install vim tmux htop git -y
配置 SSH Server
$ sudo apt install openssh-server
$ systemctl status sshd
安装 oh-my-zsh
WSL 必备
# https://ohmyz.sh/
# 安装 zsh 并配置 oh-my-zsh
$ sudo apt install zsh
$ wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh
$ sh -x install.sh
# 安装 zsh-autosuggestions
# https://github.com/zsh-users/zsh-autosuggestions
$ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# 开启插件,kubectl/docker 等自带插件也很好用
$ vim .zshrc
plugins=(
git
zsh-autosuggestions
ubuntu
kubectl
docker
)
$ source .zshrc
# 发现了一个好用的 zsh 主题,功能很强大
# https://github.com/romkatv/powerlevel10k
配置 Vim
# https://github.com/amix/vimrc
# 安装
$ git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
$ sh ~/.vim_runtime/install_awesome_vimrc.sh
# 更新
$ cd ~/.vim_runtime
$ git pull --rebase
安装 Docker
# 参考 https://docs.docker.com/install/linux/docker-ce/ubuntu/
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
# 配置阿里云镜像加速器,https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
# 登录阿里云控制台之后获取私人加速地址,替换 your-code
# 加速服务免费,https://help.aliyun.com/document_detail/64340.html
# sudo mkdir -p /etc/docker
# sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://your-code.mirror.aliyuncs.com"]
}
EOF
# sudo systemctl daemon-reload
# sudo systemctl restart docker
# 测试
# docker run hello-world
# 非 root 用户使用 Docker,需要注销重新登录
# sudo usermod -aG docker feilong
stunnel4 配置
$ sudo apt-get install stunnel4 -y
$ sudo vim /etc/stunnel/stunnel.conf
$ sudo vim /etc/stunnel/stunnel.pem
$ sudo sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/stunnel4
$ sudo systemctl restart stunnel4.service
$ sudo systemctl status stunnel4.service
$ export https_proxy='127.0.0.1:3080'; curl -vI "https://www.google.com/robots.txt"
istio-official-translation 开发环境配置
# 生成密钥,并将公钥添加至 GitHub SSH Keys
$ ssh-keygen
# clone 源码
$ git clone git@github.com:vflong/istio.io.git
$ cd istio.io/
$ git config user.name 'feilong'
$ git config user.email 'weifeilong2013@gmail.com'
$ git remote add upstream git@github.com:istio/istio.io.git
$ git checkout -b zh-trans-1267
# 对比翻译
$ vim ./content/*/docs/reference/glossary/operator.md -O
$ git diff content/zh/docs/reference/glossary/operator.md
diff --git a/content/zh/docs/reference/glossary/operator.md b/content/zh/docs/reference/glossary/operator.md
index 0d277a53..58ccdff5 100644
--- a/content/zh/docs/reference/glossary/operator.md
+++ b/content/zh/docs/reference/glossary/operator.md
@@ -1,4 +1,4 @@
---
title: Operator
---
-Operators are a method of packaging, deploying and managing a Kubernetes application. For more information, see [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).
+Operator 是打包,部署和管理 Kubernetes 应用程序的一种方法。有关更多信息,请参见 [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/)。
# 若镜像拉取失败,请参考 repo。
$ docker pull gcr.io/istio-testing/build-tools:2019-10-24T14-05-17
$ sudo apt install make
# 本地访问:http://localhost:1313
$ make serve
# 翻译段落的地址:http://localhost:1313/zh/docs/reference/glossary/#operator
# 检查
$ make INTERNAL_ONLY=True lint
Building with the build container: gcr.io/istio-testing/build-tools:2019-10-24T14-05-17.
| EN | ZH
+------------------+-----+-----+
Pages | 546 | 545
Paginator pages | 0 | 0
Non-page files | 164 | 164
Static files | 54 | 54
Processed images | 0 | 0
Aliases | 1 | 0
Sitemaps | 2 | 1
Cleaned | 0 | 0
Total in 241551 ms
>> 430 files are free from spelling errors
>> 429 files are free from spelling errors
Running ["ImageCheck", "ScriptCheck", "HtmlCheck", "LinkCheck", "OpenGraphCheck"] on ["./public"] on *.html...
# 提交并推送
$ git add .
$ git commit -m 'zh-translation:/docs/reference/glossary/operator.md'
$ git push --set-upstream origin zh-trans-1267
# https://github.com/istio/istio.io/compare
# 创建 PR,按照指示填写所需信息
# 更新代码
$ git checkout master
$ git fetch upstream master
$ git pull --rebase upstream master
$ git push origin master
# 继续解决下一个 issue
$ git checkout -b zh-trans-1094
$ vim ./content/*/docs/reference/glossary/adapters.md -o
$ git add .
$ git commit -m 'zh-translation:/docs/reference/glossary/adapters.md'
$ git push --set-upstream origin zh-trans-1094
# 清理已 merge 的分支
$ git branch -d zh-trans-1267
$ git push origin :zh-trans-1267
修改文件中用到的一些 Vim 命令
- 替换:() -> {}
:%s/](#\(.*\))$/]{#\1}/g