服务器新用户配置
账户配置文件¶
配置~/.bashrc¶
| .bashrc | |
|---|---|
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
配置~/.vimrc¶
| Bash | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
安装miniconda¶
安装¶
Bash
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm -rf ~/miniconda3/miniconda.sh
初始化¶
Bash
~/miniconda3/bin/conda init bash
配置清华源¶
Bash
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
GitHub同步配置文件¶
配置GitHub账号¶
Bash
git config --global user.name "guoyingwei_aliyun"
git config --global user.email "guoyingwei6@outlook.com"
ssh-keygen -t ed25519 -C "guoyingwei6@outlook.com"
# 复制显示的内容
cat ~/.ssh/id_ed25519.pub
# 把公钥添加到GitHub > Setting > SSH and GPG keys
远程和本地配置文件同步¶
Bash
git clone git@github.com:guoyingwei6/dotfiles.git
cd dotfiles
/usr/bin/cp -f ~/.bashrc .bashrc
/usr/bin/cp -f ~/.vimrc .vimrc
git add ./
git commit -m "syn dotfiles"
git push
利用cron每天自动备份配置文件¶
Bash
vi syn.sh
# syn.sh写入下列命令:
/usr/bin/cp -f ~/.bashrc /home/guoyingwei/dotfiles/.bashrc
/usr/bin/cp -f ~/.vimrc /home/guoyingwei/dotfiles/.vimrc
git -C /home/guoyingwei/dotfiles/ add /home/guoyingwei/dotfiles/
git -C /home/guoyingwei/dotfiles/ commit -m "syn dotfiles"
git -C /home/guoyingwei/dotfiles/ push # 非git目录下使用git需要-C参数
vi .gitignore
# 在dotfiles仓库目录下创建.gitignore文件
syn.sh # 忽略syn.sh
# 调用crontab
crontab -e
* 1 * * * bash /home/guoyingwei/dotfiles/syn.sh # 每天凌晨1点自动同步一次
只能往GitHub备份,不能同步。如果其它服务器上的配置文件发生改动并上传,则本地必需手动pull一次。
Last update:
October 7, 2023
Created: September 26, 2023
Created: September 26, 2023