前言
为了环境统一,把自己的 linux 和 mac 的电脑都装上统一的 zsh。
安装 zsh
1 2 3 4 5 6 7 8 9 10 11 12 13 $ echo $SHELL /bin/bash $ cat /etc/shells /bin/sh /bin/bash /bin/rbash /bin/dash /bin/zsh /usr/bin/zsh
安装 zsh:
1 2 sudo apt-get update sudo apt-get -y install zsh git curl
切换到 zsh:
修改 hosts
修改 .ssh/config
1 2 3 Host github.com Hostname github.com IdentityFile ~/.ssh/key/github
修改 gitconfig
1 2 [url "git@github.com:"] insteadOf = https://github.com/
安装 neovim
1 2 3 curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz sudo rm -rf /opt/nvim-linux64 sudo tar -C /opt -xzf nvim-linux64.tar.gz
修改环境变量:
1 export PATH="$PATH:/opt/nvim-linux64/bin"
安装依赖:
1 2 sudo apt-get install ripgrep fzf -y sudo apt-get install python-pynvim -y
加载 neovim 配置
1 git clone git@github.com:onns/nvim-config.git ~/.config/nvim
安装 ohmyzsh
1 sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh) "
安装 zsh-syntax-highlighting
1 git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom} /plugins/zsh-syntax-highlighting
1 2 vi ~/.zshrc plugins=(git zsh-syntax-highlighting)
安装 zsh-autosuggestions
1 git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom} /plugins/zsh-autosuggestions
1 2 vi ~/.zshrc plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
安装 wakatime
前置安装 wakatime-cli
1 python3 -c "$(wget -q -O - https://raw.githubusercontent.com/wakatime/vim-wakatime/master/scripts/install_cli.py) "
1 git clone https://github.com/sobolevn/wakatime-zsh-plugin.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom} /plugins/wakatime
1 2 vi ~/.zshrc plugins=(git zsh-autosuggestions zsh-syntax-highlighting wakatime)
绑定 shell 快捷键
1 2 3 $ vi ~/.zshrc bindkey \^U backward-kill-line
作用是和 bash 的快捷键同步,ctrl u
删除整行。
创建新用户
1 2 sudo adduser onns sudo usermod -aG sudo onns
修改主机名
关闭密码登录
1 2 sudo /etc/init.d/ssh restart
安装 golang
1 2 3 4 sudo tar -C /usr/local -xzf go1.22.3.linux-amd64.tar.gz export GOROOT="/usr/local/go/go1.22.3" export GOPATH="/home/onns/go" export PATH="$PATH :/opt/nvim-linux64/bin:$GOPATH /bin"
1 2 go env -w GOPROXY=https://goproxy.io,direct go install golang.org/x/tools/gopls@latest
安装 rsync
1 sudo apt-get install rsync -y
安装 tmux
1 2 3 sudo mv tmux.appimage /usr/local /bin/tmux sudo chmod +x /usr/local /bin/tmux
如果 mount 报错:
1 sudo apt-get install fuse
配置在:https://onns.xyz/blog/2024/02/22/doing-list-2024-07/#tmux
git 配置
1 2 3 4 git config --global init.defaultBranch main git config --global core.editor "nvim" git config --global user.email "onns@onns.xyz" git config --global user.name "Onns"
1 2 [url "git@github.com:"] insteadOf = https://github.com/
参考链接
安装 Redis
1 2 3 4 5 wget https://download.redis.io/redis-stable.tar.gz tar -xzvf redis-stable.tar.gz cd redis-stablemake sudo make install
brew 换源
安装 node
1 2 3 4 5 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash nvm install 20 nvm alias default v12.13.0
如果安装不了,可以手动下载然后上传到服务器
brew 安装
1 brew install gawk grep gnu-sed jsonpp gnutls ffmpeg jq ripgrep fzf
安装 gvm
https://github.com/moovweb/gvm
1 2 3 sudo apt-get install bison bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
golang 相关包
1 2 3 4 5 go install mvdan.cc/gofumpt@latest go install github.com/jmhodges/jsonpp@latest go install golang.org/x/tools/gopls@latest go install github.com/cweill/gotests/gotests@latest go install github.com/go-delve/delve/cmd/dlv@latest
命令行词典:https://github.com/Karmenzind/kd
archlinux
1 2 3 sudo pacman -S keychain sudo pacman -S cronie
信任证书
1 sudo trust anchor --store ca.crt
yazi
一个命令行文件管理器