My Linux
记录下每次配环境的操作,减少环境配置时间
- zsh
- ssh
- golang
- neovim/spacevim
-
zsh
安装 git 与 zsh
sudo apt install git zsh安装 oh-my-zsh
curl
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
wget
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
- 安装插件
zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
ssh
配置 ssd_config
PermitRootLogin yes // 别跟我说 Root不安全,炸了重装就完事了😈 PubkeyAuthentication yes上传公钥文件 将公钥文件追加到 authorized_keys中
注意权限 (埋个坑: 为什么权限要这样设置?)
- .ssh 权限应为 700
authorized_keys 应为 600
golang
下载安装包
curl
curl -O https://dl.google.com/go/go1.14.2.linux-amd64.tar.gzwget
wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz
解压
tar -C /usr/local -zxvf go1.14.2.linux-amd64.tar.gz配置go环境变量, 将一下两行追加至
/etc/profile中export GOROOT=/usr/local/go export PATH=$PATH:$GOROOT/bin export GOPATH=$(go env GOPATH) export PATH=$PATH:$GOPATH/bin配置go环境
go env -w GO111MODULE=on go env -w GOPROXY="https://goproxy.cn,direct"
neovim
本来一直在用 vim,neovim 更加友好就决定迁移了 - 一些改变: 1. 默认 encoding: neovim
utf-8, vimlatin12. 配置目录: neovim $XDG_CONFIG_HOME/nvim/init.vim 和$XDG_CONFIG_HOME/nvim, vim 为$HOME/.vimrc 3.:version查看 neovim 版本信息,:checkhealth查看 neovim 健康状态,:help init.vim查看 neovim 配置文件相关信息. 4. Windows 下scooop install neovim,:help init.vim发现目录在~/AppData/Local/nvim/init.vim, 而官网的 install.cmd 会将 SpaceVim clone 到 ~./.SpaceVim 目录下(install.cmd 有创建$HOME\.SpaceVim->$HOME\AppData\Local\nvim的软链接的, 但似乎没创建成功), 所以 neovim 无法正确读取配置. 可以通过手动git clone https://github.com/SpaceVim/SpaceVim.git $HOME/AppData/Local/nvim来解决. - 安装
```bash
sudo apt install neovim
```
- 用SpaceVim配置 SpaceVim中文文档 > 什么? 为什么不自己配? > : 我懒😎
安装
curl -sLf https://spacevim.org/cn/install.sh | bash把 vi 或 vim 转为使用 neovim > 你以为我在用 vim, 实际上我用的是 neovim 😎
vim ~/.zshrc alias vi='nvim' alias vim='nvim' source ~/.zshrc
Mysql
安装
sudo apt install mysql-server配置文件修改
vim /etc/mysql/mysql.conf.d/mysqld.cnf # 修改如下 # bind-address = 127.0.0.1用户配置
use mysql; # 修改密码 alter user `root`@`localhost` identified with mysql_native_password by 'zjygogogo'; # 设置远程访问 update user set host=`%` where user=`root`; #刷新权限 flush privileges;