这篇文章介绍了Ubuntu 20.10的优化方法。内容包括更换软件源、系统设置、设置Sudo免密码、安装基础软件、去除鼠标加速、安装显卡驱动、下载个人配置、安装输入法、双系统时间设置、安装Guake、安装Oh My Tmux、安装Oh My Zsh、配置Vim、配置Grub引导、自动挂载硬盘、安装PulseAudio Volume Control、安装Docker、安装Gnome Shell Extensions、使用Flameshot进行截图、体验macOS Big Sur动态壁纸等。文章提醒读者不要照搬命令,建议最小化安装,并推荐使用清华大学的软件源。文中还附有作者的个人配置备份。
安装 Ubuntu 后的 20 件事
最近搞挂了一块数据盘,刚好在 Ubuntu 20.10 的发行时间点,索性重装 Ubuntu。 本文主要为备忘。切勿照搬命令。建议最小化安装。
推荐清华大学的源
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
个人的备份源
https://raw.githubusercontent.com/eallion/dotfiles/ubuntu/sources.list
1
2
sudo mv /etc/apt/sources.list/etc/apt/sources.list.backup
wget -c https://raw.githubusercontent.com/eallion/dotfiles/ubuntu/sources.list -O /etc/apt/sources.list
然后 update 一下:
1
2
sudo apt update
sudo apt upgrade
在 系统设置
里按自己的习惯设置即可。
常用的个人电脑,是可以运行 sudo
免输密码的,公用电脑不建议这样设置。
在 root ALL=(ALL:ALL) ALL
下一行添加: (eallion
请替换成自己的用户名)
1
eallion ALL=(ALL:ALL) ALL
在 % sudo ALL=(ALL:ALL) ALL
下一行添加: (eallion
请替换成自己的用户名)
1
eallion ALL=(ALL:ALL) NOPASSWD:ALL
1
2
3
4
5
6
7
8
9
sudo apt install vim \
git \
curl \
gnome - tweak - tool \
gdebi \
preload \
google - chrome - stable \
gnome - shell - extensions \
ubuntu - restricted - extras
对于 FPS 玩家,尤其推荐去掉鼠标加速。 5.1. 在 GNOME Tweaks
点击 键盘和鼠标
在 鼠标
-加速配置
里选择 Flat
。 5.2. 在 系统设置
里 设备
-鼠标和触摸板
-鼠标
-鼠标速度
调节自己适应的鼠标速度。
如果是 Nvidia 独立显卡,在 Dash 里搜索 drive
,打开 附加驱动
,选择专有驱动。
基于 Linux 特性,备份配置文件即可。 我的部分配置备份于 GitHub:
https://github.com/eallion/dotfiles
1
git clone https://github.com/eallion/dotfiles.git -b ubuntu ~/Documents/dotfiles
恢复 Git Vim Tmux Fcitx 等配置。
个人使用 Fcitx 五笔拼音
1
sudo apt install fcitx-table-wbpy
主题: https://github.com/Yucklys/fcitx-nord-skin 主题: https://github.com/Sakitami/fcitx-themes-package
配置默认输入法:
自定义标点符号:
1
wget -c https://raw.githubusercontent.com/eallion/dotfiles/ubuntu/.config/fcitx/data/punc.mb.zh_CN -O ~/.config/fcitx/data/punc.mb.zh_CN
按下面格式添加符号,如果不符合习惯请自行修改。
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
~ ~
` `
! !
@ @
# #
$ ¥
% ␣
^ ……
& &
* *
( (
) )
_ ——
- -
+ +
= =
| |
\ 、
[ 【
] 】
{ 〖
} 〗
: :
; ;
" “ ”
' ‘ ’
< 《
> 》
, ,
. 。
? ?
安装:
1
sudo apt install fcitx5 fcitx5-chinese-addons fcitx5-frontend-gtk2 fcitx5-frontend-gtk3 fcitx5-frontend-qt5
切换输入法:
安装 Psionics-Remix 主题(可选)
https://github.com/xTpx/Psionics-Remix
1
git clone https://github.com/xTpx/Psionics-Remix.git ~/.local/share/fcitx5/themes/Psionics-Remix
1
vim ~/.config/fcitx5/conf/classicui.conf
配置主题:
1
2
3
***
Theme=Psionics-Remix
***
自定义快速输入:
1
sudo vim /usr/share/fcitx5/data/quickphrase.d/quick.mb
在文件中添加形如 input output
的代码,一行一条,即可实现添加快速输入辞典。 示例:要在快速输入中输入 ddrr
,在候选中显示 大大的小蜗牛
,只需在上述 mb 文件中添加一行 ddrr 大大的小蜗牛
即可。(注意空格)
友情提示:快速输入可以使用分号打开,Rime 不支持快速输入。
解决切换到 Windows 时间不对的问题。将本地时间更新到硬件上。
1
2
3
sudo apt install ntpdate
sudo ntpdate ntp.aliyun.com # 阿里云的时间服务器,可用其他时间服务器替换
sudo hwclock --localtime --systohc
前 9 个步骤执行完成后,建议重启一下!
通过软件仓库直接安装的 Guake 版本不够新,而且中文显示不全。 推荐源码安装:
1
2
3
4
5
git clone https://github.com/Guake/guake.git ~/Documents/guake
cd ~/Documents/guake
./scripts/bootstrap-dev-debian.sh run make
make
sudo make install
Ubuntu 20.10 默认终端的背景色:#300a24
Guake indicator 如果有需要可安装 Guake indicator:
1
sudo apt install guake-indicator
https://github.com/gpakosz/.tmux
1
2
3
4
cd
git clone https://github.com/gpakosz/.tmux.git
ln -s -f .tmux/.tmux.conf
cp .tmux/.tmux.conf.local .
参考:https://eallion.com/ubuntuzsh
安装 Zsh:
1
2
sudo apt update
sudo apt install zsh autojump fasd
安装 Oh My Zsh:
官方文档 https://github.com/ohmyzsh/ohmyzsh#basic-installation
1
sh - c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
下载、安装、配置字体:
下载:Ubuntu Nerd Font 下载:Knack Nerd Font Mono (推荐)
安装主题 Powerlevel9k :
1
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
安装历史命令建议插件:
1
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
安装命令行语法高亮插件:
1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
设置 Oh My Zsh :
需要修改如下几个地方:
1
2
3
4
5
6
7
8
9
10
11
12
******
POWERLEVEL9K_MODE='nerdfont-complete'
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir dir_writable disk_usage vcs newline)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time)
******
ENABLE_CORRECTION="true"
******
COMPLETION_WAITING_DOTS="true"
******
plugins=( git extract fasd zsh-autosuggestions zsh-syntax-highlighting docker docker-compose)
******
我个人的配置:
1
2
rm ~/.zshrc
wget -c https://raw.githubusercontent.com/eallion/dotfiles/ubuntu/.zshrc -O ~/.zshrc
让配置生效:
如果安装时没有选择将 Zsh 作为默认 Shell,可以用下面的命令设置:
查看当前所用的 Shell : echo $SHELL
。
https://github.com/spf13/spf13-vim
https://github.com/LER0ever/EverVim Ubuntu 配置 EverVim https://eallion.com/ubuntuevervim/
安装 EverVim 步骤 安装依赖:
1
sudo apt install -y git curl python3-pip python3-dev exuberant-ctags cmake gcc g++ build-essential
安装 EverVim :
1
curl -sLf https://raw.githubusercontent.com/LER0ever/EverVim/master/Boot-EverVim.sh | bash
进 Vim 安装插件:
如果进 Vim 提示 Your ycmd is shut down ,需要安装 You Compute Me :
1
2
cd ~/.vim/bundle/YouCompleteMe
python3 install.py --clang-completer
Etx4 文件系统用 Grub-customizer 即可,Btrfs、ZFS 等文件系统此软件无效。
1
sudo apt install grub-customizer
Theme:
https://github.com/sandesh236/sleek–themes https://github.com/gustawho/grub2-theme-breeze
如果 Nvidia 独立显卡在引导界面开机黑屏:将 nomodeset
加到 /etc/default/grub
即可。
1
GRUB_CMDLINE_LINUX_DEFAULT="nomodeset quiet splash"
查看硬盘的 UUID 和 Type :
记录下 UUID
和 Type
。 创建挂载目录:
1
mkdir -p ~/Files ~/Media
查看自己的 uid gid:
编辑配置文件:
按格式添加:
1
UUID=xxxx /mount-folder type defaults 0 0
如:
1
2
UUID=xxxx /home/eallion/Files ntfs defaults,uid=1000,gid=1000,umask=022 0 0
UUID=xxxx /home/eallion/Media ntfs defaults,uid=1000,gid=1000,umask=022 0 0
如果不加 uid gid ,自动挂载后可能是 root 权限,无法读写。
1
sudo apt install pavucontrol
https://docs.docker.com/engine/install/ubuntu/ Ubuntu 20.10 暂时还没有官方源,使用 Ubuntu 20.04 的源替代。 即:替换 $(lsb_release -cs)
为 focal
。
1
2
3
4
5
sudo apt remove docker docker - engine docker . io containerd runc
sudo apt install - y apt - transport - https ca - certificates curl gnupg - agent software - properties - common
curl - fsSL https : // download . docker . com / linux / ubuntu / gpg | sudo apt - key add -
sudo add - apt - repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt install - y docker - ce docker - ce - cli containerd . io
检查是否安装成功:
1
2
docker version
sudo docker run hello-world
安装 Docker Compose:
1
2
3
sudo curl - L "https://github.com/docker/compose/releases/download/1.27.1/docker-compose-$(uname -s)-$(uname -m)" - o / usr / local / bin / docker - compose
sudo chmod + x / usr / local / bin / docker - compose
sudo ln - s / usr / local / bin / docker - compose / usr / bin / docker - compose
Docker 属于高频操作,运行 Docker 时,免去 sudo
https://docs.docker.com/engine/install/linux-postinstall/
1
2
3
4
5
6
sudo groupadd docker
sudo usermod -aG docker $USER
reboot
newgrp docker
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R
可以使用 Chrome 插件,如果登录了 Google 账号,有自动同步功能。
1
sudo apt install gnome-shell-extensions
以下扩展插件按需启用 安装完成后,按 Alt
+F2
,输入 r
重启
需要设置快捷键,所以把火焰截图单独拿出来说。
1
sudo apt install flameshot
设置截图快捷键:系统设置
- 设备
- 键盘快捷键
- 自定义快捷键
点加号添加一个:
1
2
3
名称:flameshot
命令:flameshot gui
设置快捷键:(按键盘设置)
实际上没什么卵用,个人也不太喜欢。 Gnome 桌面环境原生支持按时间自动切换壁纸的功能。 无论什么 Linux 发行版,只要使用 Gnome 桌面环境都可以使用此壁纸。 此套壁纸支持 5K 分辨率。 Windows 可以使用 WinDynamicDesktop 。
https://github.com/eallion/Big-Sur-Ubuntu
1
git clone https://github.com/eallion/Big-Sur-Ubuntu.git ~/Pictures/Big-Sur-Ubuntu
打开 Gnome Tweaks
找到 外观
-背景
选择 groovy.xml
(文件在 /home/username/Pictures/Big-Sur-Ubuntu/groovy.xml
路径) 选择 Zoom
调整方式
推荐一些常用的软件:
1
sudo snap install authy --beta
1
sudo apt install filezilla
1
sudo snap install photogimp
1
sudo apt install telegram-desktop
1
sudo apt install thunderbird thunderbird-locale-zh-cn
1
sudo apt install virtualbox
https://github.com/TheAssassin/AppImageLauncher/
https://docs.docker.com/engine/install/ubuntu/
https://www.dropbox.com/install
https://golang.org/doc/install
https://github.com/gohugoio/hugo/releases
https://keybase.io/docs/the_app/install_linux
https://github.com/muharemovic/MouseWheel
https://music.163.com/#/download
https://eallion.com/ubuntu2004lnmp/
https://github.com/nvm-sh/nvm
https://obsproject.com/wiki/install-instructions#linux
PicGo (snap install with --danderous
) https://github.com/Molunerfinn/PicGo
https://github.com/c0re100/qBittorrent-Enhanced-Edition https://github.com/poplite/qBEE-Ubuntu-Packaging
https://im.qq.com/linuxqq/index.html
https://slack.com/downloads/linux
https://www.spotify.com/us/download/linux/
https://termius.com/linux
https://typora.io/#linux
通过 Snap 仓库安装有中文输入 Bug 。https://code.visualstudio.com/Download