Ubuntu配置

1. 终端环境

1.1. 换国内软件源

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.mirrorapt updateapt upgrade

1.2. 装置必要工具

apt install gitapt install curlapt install wget

1.3. 创立罕用文件夹

mkdir Config Projects Scripts Settings

1.4. 装置ZSH和OMZ

apt install zshrm .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-xchmod 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-highlightinggit clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions# 配置.zshrctouoch .zshenvvim .zshrc
# Path to oh-my-zshexport ZSH=$HOME/.oh-my-zsh# Global variablesZSH_THEME='ys'# Load pluginsplugins=(z git sudo extract zsh-autosuggestions zsh-syntax-highlighting)source $ZSH/oh-my-zsh.sh# Alias for commandsalias lsa='ls -a'alias cls='clear'alias src='source'alias cg='cargo'alias py='python'alias dk='docker'# Load environmentssource ~/.zshenv

1.4. 解决中文乱码

apt install language-pack-zh-hans# Set the environment varibaletouch .zshenvcat "export LANG="zh_CN.UTF-8"" >> .zshenvsource .zshenv

2. 开发环境

1.2. Rust环境配置

# Rustup install scriptcurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh# Replace third-party crate sourcetouch .cargo/configvim .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 .zshenvmkdir Projectscargo new hellocd hellocargo 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-essentialcargo run------------------------------------------------------   Compiling hello v0.1.0 (/root/Projects/hello)    Finished dev [unoptimized + debuginfo] target(s) in 0.33s     Running `target/debug/hello`Hello, world!------------------------------------------------------