1. 设置apt仓库镜像

sudo sed -i 's/cn.archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sudo apt update && sudo apt upgrade -y && sudo apt autoclean && sudo apt autoremove -y

2. 新增用户

group add demogroup
useradd -m -g demogroup -s /bin/bash demouser
passwd demouser

3. 修改主机名

sudo hostnamectl set-hostname <NEW_HOSTNAME>

4. 执行sudo命令不需要密码

whoami # 获取用户名
sudo visudo
最后一行添加:
`用户名` ALL=(ALL) NOPASSWD: ALL

5. 安装必备软件

sudo apt install -y git net-tools vim curl unzip unar tree apt-transport-https ca-certificates software-properties-common language-pack-zh-hans openssh-server

# gnome
sudo apt install -y neofetch gnome-tweak-tool chrome-gnome-shell

6. 美化字体/图标

# 下载字体后安装
wget http://soft-1252259164.file.myqcloud.com/Menlo.ttc
wget http://soft-1252259164.file.myqcloud.com/Monaco.ttf
wget http://soft-1252259164.file.myqcloud.com/PingFang.ttc
# mac icons
wget https://codeload.github.com/USBA/macOS-iCons/zip/master
unzip macOS-iCons-master.zip
mv macOS-iCons-master/ /usr/share/icons/
sudo apt install chrome-gnome-shell -y
# chrome访问 https://extensions.gnome.org
# 安装User-Themes

7. 安装docker

#!/bin/bash
# prepare
sudo apt update && sudo apt upgrade -y && sudo apt autoclean && sudo apt autoremove -y
sudo apt install -y net-tools vim curl apt-transport-https ca-certificates software-properties-common language-pack-zh-hans
sudo apt remove -y docker docker-ce docker-engine docker.io
# install docker via apt
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y docker-ce
sudo usermod -aG docker $USER
sudo docker version
# image mirror
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://3itj1ym2.mirror.aliyuncs.com"]
}
EOF
# expose endpoint for external services, eg: portainer.
sudo sed -i 's/ExecStart.*/& -H tcp:\/\/0.0.0.0:2375/g' /lib/systemd/system/docker.service
sudo chmod 777 /var/run/docker.sock
sudo chmod 777 /etc/docker/ -R
sudo systemctl daemon-reload
sudo systemctl restart docker
# install docker-compose
sudo wget http://soft-1252259164.file.myqcloud.com/docker-compose -O /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose version

8. 安装zsh

sudo apt install zsh -y
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
sudo chsh -s /bin/zsh
# 安装字体
sudo apt install powerline -y
git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh
sudo mkdir /usr/share/fonts/OTF/ -p
wget https://raw.githubusercontent.com/powerline/powerline/develop/font/10-powerline-symbols.conf
wget https://raw.githubusercontent.com/powerline/powerline/develop/font/PowerlineSymbols.otf
sudo cp 10-powerline-symbols.conf /usr/share/fonts/OTF/
sudo mv 10-powerline-symbols.conf /etc/fonts/conf.d/
sudo mv PowerlineSymbols.otf /usr/share/fonts/OTF/

# 安装插件
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


# 修改~/.zshrc
ZSH_THEME="agnoster"
DEFAULT_USER=`whoami`
export LC_ALL=zh_CN.UTF-8
plugins=(
  git
  zsh-autosuggestions
  zsh-syntax-highlighting
)
alias f='free -h'
alias d='df -h'
alias as='sudo apt search'
alias s='sudo apt update && sudo apt upgrade -y && sudo apt autoclean && sudo apt autoremove -y'

alias setclip="xclip -selection c"
alias getclip="xclip -selection c -o"

source ~/.zshrc

# 设置终端字体为 Meslo LG s for Powerline Regular 12

9. 安装sdkman

curl -s "https://get.sdkman.io" | zsh
source "$HOME/.sdkman/bin/sdkman-init.sh"

10. 屏蔽百度广告

sudo vim /etc/hosts
# 添加:

# Baidu DSP
0.0.0.0        pos.baidu.com
0.0.0.0        release.baidu.com
0.0.0.0        hm.baidu.com
0.0.0.0        eclick.baidu.com
0.0.0.0        dup.baidustatic.com