如何快速完成一个电脑的环境安装
背景
新电脑又得配一次环境,每次都比较麻烦,还老是忘这忘那,不如维护好一个文档,后面跟着文档走一次就行了,更好的话可以写个脚本。
softwares
git (安装 homebrew 的前提)
先安装 xcodehomebrew
1
2
3
4
5
6
7
8# https://mirrors.ustc.edu.cn/help/brew.git.html
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"
/bin/bash -c "$(curl -fsSL https://mirrors.ustc.edu.cn/misc/brew-install.sh)"iterm2
下载地址: https://iterm2.com/downloads.htmlzsh && oh-my-zsh
1
2
3
4
5
6
7
8# zsh
chsh -s /bin/zsh
# brew install zsh
# omz 国内源
sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"
# 要怎么玩 omz 根据自己需要sshkey
1
ssh-keygen -C xxxx@xxx.com
gitconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17cat <<eof > ~/.gitconfig
[user]
name = zhangsan
email = zhangsan@xx.com
[alias]
a = add
ps = push
pl = pull
cim = commit -m
b = branch
co = checkout
d = diff
st = status
eofbash alias
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# vscode
alias c=code
alias c.="code ."
# git
# alias g=git
alias gac="git a . && git cim "
alias gpl="git pull"
alias gps="git push"
# golang
alias gt="go mod tidy"
unalias g # for go version tool - g
# docker cli
alias lzd=lazydocker
##########KUBEALIAS##########
export KUBE_EDITOR=vim
alias k=kubectl
alias ke="kubectl edit"
alias ked="kubectl edit deploy"
alias kg="kubectl get"
alias kgp="kubectl get po"
alias wp="watch kubectl get po"
alias kd="kubectl delete"
alias kdp="kubectl delete pod"
alias klf="kubectl logs -f"
alias krrd="kubectl rollout restart deploy "
##########KUBEALIAS##########
alias cdgosrc="cd ~/go/src"
alias cdcode="cd ~/code/"wget & httpie
1
brew install wget && brew install httpie
lazydocker
1
brew install lazydocker
k9s
1
brew install k9s
golang
1
2
3
4
5
6
7
8
9# 安装 g (多版本管理工具)
curl -sSL https://raw.githubusercontent.com/voidint/g/master/install.sh | bash
echo "unalias g" >> ~/.bashrc # 可选。若其他程序(如'git')使用了'g'作为别名。
source "$HOME/.g/env"
g ls-remote
# 安装最新版
g install stablenodejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17# 可以安装 nvm (版本管理)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install stable
# 或者直接下载:https://nodejs.org/en/download/
# 安装 yarn
npm install -g yarn
# 安装 nrm
yarn global add nrm
nrm ls && nrm use taobao
yarn global add pm2pip config
1
2
3
4
5
6
7
8mkdir ~/.pip
cat <<eof > ~/.pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
eof
pip3 install --upgrade pipglances
1
2pip3 install --upgrade pip
pip3 install glancessshw
1
2
3
4
5
6
7
8
9
10
11
12
13
14# 下载地址: https://github.com/iamlongalong/sshw/releases
cat <<eof > ~/.sshw
- name: testgroup
children:
- name: testecs
user: root
host: xx.xx.xx.xx
callback-shells:
- {cmd: 'ls'}
jump:
- host: xxx.xxx.xxx.xx
user: root
eof
办公常用软件
- chrome: 下载地址
- 飞书: 下载地址
- 钉钉: 下载地址
- 微信: 下载地址
- obsidian: 下载地址
- vscode: 下载地址
- docker: 下载地址
- bob: 下载地址
- keka: 下载地址
- vscode: 下载地址
- 罗技 options: 下载地址
- syncthing: 下载地址
- balena-etcher: 下载地址
- wireshark: 下载地址
- picgo: 下载地址
- raycast: 下载地址
其他
- 三指拖动: 启动台 => 设置 => 辅助功能
linux 安装 (debian 10)
linux brew
1 |
|
zsh
1 |
|
代码环境
python
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
31mkdir ~/.pip
# 配置源
cat <<eof > ~/.pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
eof
# 安装pip
apt install python3-venv python3-pip
# 升级
pip3 install --upgrade pip
# 安装 glances
pip3 install glances
# 安装 pyenv (python 版本管理工具)
curl https://pyenv.run | bash
# 加载到 zsh
cat <<eof >> ~/.zshrc
eval "$(pyenv virtualenv-init -)"
eof
# 加载到 bash
cat <<eof >> ~/.bashrc
eval "$(pyenv virtualenv-init -)"
eofdocker
1
2curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
网络环境
- proxy4chain
1 |
|
其他
1 |
|
True happiness arises, in the first place, from the enjoyment of oneself, and in the next, from the friendship and conversation of a few select companions.
— Joseph Addison
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!