Ubuntu Server 20.04 LTS

桌面系统安装

标准安装流程:

  1. 执行sudo apt update。(务必执行一下,否则可能会导致tasksel报apt-get (100)的错误)
  2. 执行sudo apt install tasksel安装tasksel。
  3. 执行tasksel install ubuntu-desktop-minimal ubuntu-desktop-minimal-default-languages安装最小桌面系统。(亦可以直接执行tasksel使用界面选择系统安装或使用tasksel --list-tasks查看可用的安装列表)
  4. 等待安装完成即可

为什么不使用apt直接安装?

apt直接安装的命令是sudo apt-get install --no-install-recommends ubuntu-desktop,虽然通过该命令可以直接安装一个最小(是极其小)的ubuntu桌面,但是,对于可能会使用到中文语言(亦或是显示中文语言)的地方,需要单独安装字体文件。而且通过该方式安装的桌面系统,缺失了非常多的关键组件,需要单独安装,且安装时还可能报出依赖错误导致系统crash,例如实际使用时就出现了安装ibus中文输入法由于依赖问题导致了桌面系统无法再启动且无法再安装的问题。

参考资料:

字体安装

''注意:通过tasksel执行了languages安装后可以不再安装字体文件。''

执行sudo apt install fonts-*(默认安装全部字体),可通过fc-list :lang=zh_cn查看已安装的中文字体。

ubuntu中文默认提供的字体如下所示:

/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing TW MBE:style=Light
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK SC:style=Bold
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK TC:style=Bold
/usr/share/fonts/truetype/arphic/ukai.ttc: AR PL UKai CN:style=Book
/usr/share/fonts/truetype/arphic/ukai.ttc: AR PL UKai HK:style=Book
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK JP:style=Bold
/usr/share/fonts/opentype/noto/NotoSerifCJK-Bold.ttc: Noto Serif CJK KR:style=Bold
/usr/share/fonts/truetype/arphic/ukai.ttc: AR PL UKai TW:style=Book
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK JP:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK HK:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK KR:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK SC:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans CJK TC:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK SC:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK TC:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK JP:style=Regular
/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc: Noto Serif CJK KR:style=Regular
/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf: Droid Sans Fallback:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK TC:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK SC:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK KR:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK HK:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans Mono CJK JP:style=Bold
/usr/share/fonts/truetype/arphic/ukai.ttc: AR PL UKai TW MBE:style=Book
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing TW:style=Light
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing CN:style=Light
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing HK:style=Light
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK SC:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK TC:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK HK:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK KR:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: Noto Sans Mono CJK JP:style=Regular
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK JP:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK KR:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK HK:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK TC:style=Bold
/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: Noto Sans CJK SC:style=Bold

网络配置

''注意:多网卡主机若没有将多余的网口关闭(默认为DHCP)将导致开机的时候等待2分钟。具体表现为:显示「A start job is running for wait for Network to be configured」的消息,消息旁有一个计时器在计时。''

'''关闭多余的网口'''

将/etc/netplan/*.yaml中需要关闭的网口配置信息删除或添加optional: true

参考:

'''配置网络'''

参考如下的配置信息

# This is the network config written by 'subiquity'
network:
  ethernets:
    enp3s0:
      addresses:
      - 192.168.244.2/24
      gateway4: 192.168.244.1
      nameservers:
        addresses:
        - 192.168.244.1
        search: []
  version: 2
应用网络配置

sudo netplan apply

卸载Firefox

''仅桌面系统''

卸载流程:

  1. 通过dpkg --get-selections | grep firefox查看firefox的安装信息。
  2. sudo apt purge -y firefox firefox-*卸载firefox。(根据安装系统中显示的包信息进行卸载,可以使用*通配符)

添加桌面图标

''仅桌面系统''

以添加Chrome浏览器桌面图标为例。

添加流程:

  1. 桌面系统默认的应用图标在/usr/share/applications/目录下
  2. 通过ls -la /usr/share/applications/ | grep chrome查询chrome的图标
  3. 通过cp /usr/share/applications/google-chrome.desktop /home/[user]/Desktop将图标复制到桌面
  4. 在桌面界面中右键选择google-chrome.desktop文件,点击允许启动(allow lunching)完成图标添加
  5. 双击添加的图标即可启动Chrome浏览器

本地安装deb包

方案一:sudo dpkg -i ./*.deb

方案二:sudo apt install ./*.deb

推荐使用方案二进行安装,实际使用中方案一如果缺失包依赖的话,不会默认安装包所需要的依赖。也有通过修改apt源为本地源的方案进行安装的方式,详情参考:Ubuntu使用apt-get安装本地deb包

服务管理

  • 服务配置中使用管道操作符,如下:例如在在ExecStart中使用管道:bash -c 'find . -name "*.sh" | xargs -i bash {} start'
  • 服务不会自动加载profile、bashrc等自定义环境中的变量,需要通过Environment指定。注意Environment的拼写
  • 需要指定执行目录可以通过WorkingDirectory指定

参考资料:

Ubuntu Desktop 20.04 LTS

系统安装

桌面系统分为正常安装和最小安装,最小安装结果与服务器版本最小安装一致。