创建用户

1
2
useradd -d ${home path} -m ${user name}  // 创建用户并指定home目录,若不存在则创建-m
sudo passwd ${user name} // 给用户设置密码

给用户设置zsh

参考 https://www.haoyep.com/posts/zsh-config-oh-my-zsh/

1
2
3
4
5
6
7
8
9
10
11
12
sudo apt install zsh -y
chsh -s /bin/zsh
sh -c "$(wget -O- https://install.ohmyz.sh/)" // 安装oh-my-zsh
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k // 安装powerlevel10k主题
vim ~/.zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"
source ~/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

vim ~/.zshrc
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

给用户添加sudo组和docker组

1
2
3
sudo gpasswd -a $USER docker
newgrp dockery // 或重新登录用户
sudo usermod -a -G sudo $USER

添加authorized_keys

1
2
ssh-keygen
vim authorized_keys

Python环境

1
2
3
4
5
https://repo.anaconda.com/miniconda  // 选择合适版本的Miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
export PATH="/home/username/miniconda/bin:$PATH" // 写入对应的source文件,不可以用~路径
source ~/.zshrc

JS环境

1
https://github.com/nvm-sh/nvm  // 参考Usage

C++环境

1
apt-get update && apt-get install cmake build-essential -y

Rust环境

1
2
3
4
export RUSTUP_UPDATE_ROOT=https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup
export RUSTUP_DIST_SERVER=https://mirrors.tuna.tsinghua.edu.cn/rustup // 若机器网络环境需要国内源

curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y