Ubuntu 20.04 配置备忘手册

2020-05-03T13:08:00

最近 Ubuntu 20.04 LTS 终于发布了,我也完成了升级(其实是干掉了原本的 Fedora 32 去重装),整体来看这次的版本是非常值得去使用的,而且 Bug 也非常少,比起之前配置安装要省事太多,但还是有一些要做的事情,现在整理一下。


安装后 UEFI 启动项消失

虽然我之前一直用 UEFI 的方式安装 Ubuntu, 但是我奇怪的发现,如果我删除了系统 BIOS 里的 Ubuntu 项目之后,重新安装系统并不会添加回来,而且会导致直接硬盘无法启动。

解决方法也比较傻逼,直接用 LiveCD 启动,挂载 EFI 分区,把 /EFI/Ubuntu/ 下面的所有文件,复制到 /EFI/Boot/ 目录下就可以了。

当然,你是应该选择从你的 SSD 主硬盘启动,至于 Bios 里的项目,除非你是台式机可以手动添加,如果是笔记本的话,那就算了吧,我也不知道为啥回不来了。


安装常用软件

sudo add-apt-repository ppa:papirus/papirus -y
sudo add-apt-repository ppa:atareao/telegram -y
sudo apt-get install gimp inkscape openshot filezilla audacity curl ctags cscope fonts-dejavu indent vim exuberant-ctags zsh telegram wget papirus-icon-theme exfat-fuse exfat-utils ttf-bitstream-vera gtk2-engines-pixbuf gnome-themes-standard gnome-tweaks ubuntu-restricted-extras chrome-gnome-shell easytag abcde mkcue vlc -y

安装包括 Gnome-shell 插件管理和高级设置等工具,同时添加 Telegram 和 papirus 图标的 PPA。


设置字体,换为文泉驿微米黑

sudo apt install fonts-wqy-microhei xfonts-wqy
sudo apt install fonts-wqy-zenhei
sudo apt remove fonts-noto-cjk
sudo apt remove fonts-noto-mono

虽然 Ubuntu 20.04 已经采用了 NotoSans 字体,但这个字体我觉得并不好看,尤其是在 Non HiDPI 屏幕上,歪歪扭扭,很糟糕。

sudo gedit /etc/fonts/conf.avail/69-language-selector-zh-cn.conf

写入下面的内容,设置为文泉驿优先

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <test qual="any" name="family">
      <string>serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Bitstream Vera Serif</string>
      <string>HYSong</string>
      <string>AR PL UMing CN</string>
      <string>AR PL UMing HK</string>
      <string>AR PL ShanHeiSun Uni</string>
      <string>AR PL New Sung</string>
      <string>WenQuanYi Bitmap Song</string>
      <string>AR PL UKai CN</string>
      <string>AR PL ZenKai Uni</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Bitstream Vera Sans</string>
      <string>WenQuanYi Micro Hei</string>
      <string>WenQuanYi Zen Hei</string>
      <string>Droid Sans Fallback</string>
      <string>HYSong</string>
      <string>AR PL UMing CN</string>
      <string>AR PL UMing HK</string>
      <string>AR PL ShanHeiSun Uni</string>
      <string>AR PL New Sung</string>
      <string>AR PL UKai CN</string>
      <string>AR PL ZenKai Uni</string>
    </edit>
  </match>
  <match target="pattern">
    <test qual="any" name="family">
      <string>monospace</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Bitstream Vera Sans Mono</string>
      <string>WenQuanYi Micro Hei Mono</string>
      <string>WenQuanYi Zen Hei Mono</string>
      <string>Droid Sans Fallback</string>
      <string>HYSong</string>
      <string>AR PL UMing CN</string>
      <string>AR PL UMing HK</string>
      <string>AR PL ShanHeiSun Uni</string>
      <string>AR PL New Sung</string>
      <string>AR PL UKai CN</string>
      <string>AR PL ZenKai Uni</string>
    </edit>
  </match>
</fontconfig>

设置英文目录名

export LANG=en_US
xdg-user-dirs-gtk-update
export LANG=zh_CN

安装 ZSH 并设置主题

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
wget --no-check-certificate https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.ansi-dark
mv dircolors.ansi-dark .dircolors
eval `dircolors ~/.dircolors`

科学上网

sudo vim /etc/shadowsocks-libev/config.json
sudo vim /lib/systemd/system/shadowsocks-libev.service
sudo vim /lib/systemd/system/shadowsocks-libev-local.service

sudo vim /etc/systemd/resolved.conf
sudo systemctl stop systemd-resolved.service
https://github.com/shawn1m/overture

sudo bash -c 'cat >> /etc/sysctl.conf' << EOF\
\
net.core.default_qdisc=fq\
net.ipv4.tcp_congestion_control=bbr\
EOF
sudo sysctl -p\

修复 ThinkPad X1 Carbon 2017 触摸板与指点杆唤醒后不能使用的问题

sudo vim /lib/systemd/system-sleep/trackpad

#!/bin/sh
case $1/$2 in
  pre/*)
    echo "Going to $2..."
    # Place your pre suspend commands here, or `exit 0` if no pre suspend action required
    modprobe -r psmouse
    ;;
  post/*)
    echo "Waking up from $2..."
    # Place your post suspend (resume) commands here, or `exit 0` if no post suspend action required
    sleep 2
    modprobe psmouse
    ;;
esac


sudo chmod 755 /lib/systemd/system-sleep/trackpad

干掉温度墙

sudo apt install git virtualenv build-essential python3-dev libdbus-glib-1-dev libgirepository1.0-dev libcairo2-dev
git clone https://github.com/erpalma/lenovo-throttling-fix.git
sudo ./install.sh

sudo vim /etc/lenovo_fix.conf 

[BATTERY]

# Other options here...
PL2_Tdp_W: 40
Trip_Temp_C: 75

[AC]

# Other options here...
PL1_Tdp_W: 34
PL2_Tdp_W: 40
Trip_Temp_C: 90

[UNDERVOLT]
# CPU core voltage offset (mV)
CORE: -80
# Integrated GPU voltage offset (mV)
GPU: -75
# CPU cache voltage offset (mV)
CACHE: -80
# System Agent voltage offset (mV)
UNCORE: -75
# Analog I/O voltage offset (mV)
ANALOGIO: 0
 

sudo service lenovo_fix restart 

设置 Fcitx 4 输入法(虽然可以装 Fcitx 5 但是问题太多了)

sudo apt install fcitx-module-cloudpinyin fcitx-mozc fcitx-sunpinyin

LDAC 支持

sudo apt install -y libavcodec-extra58 libfdk-aac1 bluez pulseaudio
Download and Install Debs from https://f.bytefuse.net/pulseaudio-modules-bt-ppa/

安装 Typora

wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add -
sudo add-apt-repository 'deb https://typora.io/linux ./'
sudo apt install typora

换回原本的商店

sudo apt install ubuntu-software
sudo apt remove snapd
sudo apt remove ubuntu-software

映射硬盘的目录到 Home

ln -s /HDD/Documents/ ~/
ln -s /HDD/Downloads/ ~/
ln -s /HDD/Music/ ~/
ln -s /HDD/Pictures/ ~/
ln -s /HDD/Videos/ ~/
ln -s /HDD/Dropbox/ ~/
ln -s /HDD/Software/ ~/

安装 Gnome Shell 插件

https://extensions.gnome.org/extension/1401/bluetooth-quick-connect/

https://extensions.gnome.org/extension/517/caffeine/

https://extensions.gnome.org/extension/2087/desktop-icons-ng-ding/

https://extensions.gnome.org/extension/1162/emoji-selector/

https://extensions.gnome.org/extension/2/move-clock/

https://extensions.gnome.org/extension/2848/hide-keyboard-layout/

https://extensions.gnome.org/extension/261/kimpanel/

https://extensions.gnome.org/extension/36/lock-keys/

https://extensions.gnome.org/extension/750/openweather/

https://extensions.gnome.org/extension/1462/panel-date-format/

https://extensions.gnome.org/extension/905/refresh-wifi-connections/

https://extensions.gnome.org/extension/2741/remove-alttab-delay-v2/

https://extensions.gnome.org/extension/1112/screenshot-tool/

https://extensions.gnome.org/extension/906/sound-output-device-chooser/

https://extensions.gnome.org/extension/355/status-area-horizontal-spacing/

https://extensions.gnome.org/extension/1473/toggle-mute-on-middle-click/

https://extensions.gnome.org/extension/1287/unite/

https://extensions.gnome.org/extension/19/user-themes/

https://extensions.gnome.org/extension/1460/vitals/

调整插件兼容性:

sudo gedit ~/.local/share/gnome-shell/extensions/mailto:dynamic-panel-transparency@rockon999.github.io/intellifade.js

change

    let anchor_y = -Main.layoutManager.panelBox.get_anchor_point()[1];
    let pivot_y = -Main.layoutManager.panelBox.get_pivot_point()[1];

    // Adjust for bottom panel.
    if (anchor_y > 0) {
        this.panel_bounds.y = anchor_y;
        this.panel_bounds.is_top = false;
    } else if (pivot_y > 0) {
        this.panel_bounds.y = pivot_y;
        this.panel_bounds.is_top = false;
    }

to

    let pivot_y = -Main.layoutManager.panelBox.get_pivot_point()[1];

    // Adjust for bottom panel.
    if (pivot_y > 0) {
        this.panel_bounds.y = pivot_y;
        this.panel_bounds.is_top = false;
    }
dconf write /org/gnome/shell/extensions/panel-date-format/format "'%A %I:%M %p'"

安装剪贴板监控软件 Gpaste

sudo apt install gnome-shell-extensions-gpaste gpaste

修改 Dash to Dock 的 APP Icon

https://plumz.me/archives/11609/


当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »