首页 换个shell皮肤
文章
取消

换个shell皮肤

今日任务:

  • 创建ubuntu20.04.04

  • 换源

  • 换肤

  • 安装docker

创建ubuntu20.0.4

微软商店下载

换源

复制一份备份

1
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

打开/etc/apt/sources.list文件,在前面添加如下条目,并保存。

1
sudo vim /etc/apt/sources.list

ubuntu镜像-ubuntu下载地址-ubuntu安装教程-阿里巴巴开源镜像站 (aliyun.com)

[ubuntu镜像站使用帮助清华大学开源软件镜像站Tsinghua Open Source Mirror](https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/)

更新源

1
sudo apt-get update

如出现依赖问题,解决方式如下:

1
sudo apt-get -f install

更新软件:

1
sudo apt-get upgrade

换肤

安装zsh

1
sudo apt-get install zsh

将 zsh 设置为默认 shell

1
chsh -s /bin/zsh

检查是否成功

1
2
echo $SHELL
# 返回 /usr/bin/zsh 即表示成功;若没成功,重启试试看

安装oh my Zsh

1
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

! 报错:

1
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|::|:443... failed: Connection refused.

获取 ip: 使用网址:https://www.ipaddress.com/ 获得raw.githubusercontent.com网站的ip地址:185.199.108.133

修改 hosts 文件

1
2
sudo gedit /etc/hosts
在最后一行添加:185.199.108.133 raw.githubusercontent.com

打开配置文件调整主题

1
2
3
vim ~/.zshrc

ZSH_THEME="ys"

应用配置

1
source ~/.zshrc

配置插件

自动补全 zsh-autosuggestions

1
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions 

代码高亮 zsh-syntax-highlighting

1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

快速打开 GitHub 仓库 git-open

1
git clone https://github.com/paulirish/git-open.git $ZSH_CUSTOM/plugins/git-open

最后需要配置 plugins

1
plugins=( git zsh-autosuggestions zsh-syntax-highlighting git-open )

应用配置

1
source ~/.zshrc

安装docker

更新软件包索引,并且安装必要的依赖软件,来添加一个新的 HTTPS 软件源:

1
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

使用下面的 curl 导入源仓库的 GPG key:

1
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

将 Docker APT 软件源添加到你的系统:

1
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

安装docker

1
sudo apt install docker-ce docker-ce-cli containerd.io
本文由作者按照 CC BY 4.0 进行授权