cd /etc/apt/
cp sources.list sources.list.backup
# 中科大的软件源绝对比拟全
sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
# 检查一下源信息是不是来自 ustc.mirror
apt update
apt upgrade
apt install git
apt install curl
apt install wget
mkdir Config Projects Scripts Settings
apt install zsh
rm .bashrc
# 网络不佳或者梯子倒了,能够抉择 gitee 的国内镜像
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
(wget "https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh")
# 755 权限示意:rwx r-x r-x
chmod 755 install.sh
./install.sh
# 装置必要的 zsh 插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# 配置.zshrc
touoch .zshenv
vim .zshrc
# Path to oh-my-zsh
export ZSH=$HOME/.oh-my-zsh
# Global variables
ZSH_THEME='ys'
# Load plugins
plugins=(z git sudo extract zsh-autosuggestions zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
# Alias for commands
alias lsa='ls -a'
alias cls='clear'
alias src='source'
alias cg='cargo'
alias py='python'
alias dk='docker'
# Load environments
source ~/.zshenv
apt install language-pack-zh-hans
# Set the environment varibale
touch .zshenv
cat "export LANG="zh_CN.UTF-8"" >> .zshenv
source .zshenv
# Rustup install script
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Replace third-party crate source
touch .cargo/config
vim .cargo/config
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
# 换成国内镜像
replace-with = 'ustc'
# 肥科
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"
# 上交
[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"
# 清华
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
[net]
git-fetch-with-cli = true
source .zshenv
mkdir Projects
cargo new hello
cd hello
cargo run
# 这时候会报错,因为 Rustup 不会查看编译器的工具链
------------------------------------------------------
error: linker `cc` not found
|
= note: No such file or directory (os error 2)
error: could not compile `hello` due to previous error
------------------------------------------------------
# 通过 ubuntu 上装置必要的工具链解决
apt install build-essential
cargo run
------------------------------------------------------
Compiling hello v0.1.0 (/root/Projects/hello)
Finished dev [unoptimized + debuginfo] target(s) in 0.33s
Running `target/debug/hello`
Hello, world!
------------------------------------------------------