138 lines
4.4 KiB
Markdown
138 lines
4.4 KiB
Markdown
# Ubuntu 初始配置
|
||
|
||
## 使用清华源
|
||
|
||
Ubuntu 的软件源配置文件是 /etc/apt/sources.list。将系统自带的该文件做个备份,将该文件替换为清华的软件源配置文件,即可使用 TUNA 的软件源镜像。
|
||
|
||
适用于 Ubuntu 18.04 LTS 的清华源配置文件如下:
|
||
|
||
```sh
|
||
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
|
||
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
|
||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
|
||
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
|
||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
|
||
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
|
||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
|
||
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
|
||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
|
||
|
||
# 预发布软件源,不建议启用
|
||
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
|
||
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
|
||
```
|
||
|
||
其他版本 Ubuntu 系统清华源配置文件可参考 <https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/>
|
||
|
||
## 安装 Gnome3
|
||
|
||
```sh
|
||
sudo apt-get install gnome gnome-audio gnome-shell gnome-terminal gnome-themes-extra gnome-tweaks gnome-tweak-tool gnome-icon-theme gnome-control-center gnome-colors gnome-color-chooser gnome-color-manager gnome-calendar gnome-calculator gnome-backgrounds gnome-alsamixer gnome-screensaver
|
||
```
|
||
|
||
### 安装主题
|
||
|
||
示例如下:
|
||
|
||
```sh
|
||
sudo apt-get install breeze-icon-theme breeze-cursor-theme breeze-gtk-theme
|
||
```
|
||
|
||
之后在 gnome tweak tool 中可更换主题。
|
||
|
||
### 安装中文输入法
|
||
|
||
Gnome3 默认支持 ibus 输入法,安装方法如下:
|
||
|
||
```sh
|
||
sudo apt-get install ibus-pinyin ibus-sunpinyin ibus-gtk ibus-gtk3 ibus-qt4
|
||
```
|
||
|
||
不安装 ibus-gtk、ibus-gtk3 和 ibus-qt4 的话将不会产生光标跟随效果,输入法待选字都在左下角。
|
||
|
||
之后在 system settings -> Region & Language 里面增加输入法,重启后生效。
|
||
|
||
### 切换登陆管理器
|
||
|
||
默认在安装 Gnome3 时会弹出登陆管理器切换界面,如需自行修改的话可使用如下命令:
|
||
|
||
```sh
|
||
sudo dpkg-reconfigure gdm
|
||
# 或
|
||
sudo dpkg-reconfigure lightdm
|
||
```
|
||
|
||
### 切换主目录为英文
|
||
|
||
中文系统默认主目录下文件夹名为中文,在 shell 下访问太过费事,最好改为英文。方法是修改 ~/.config/user-dirs.dirs 文件内容如下,之后将各目录修改为对应的英文名,然后重新登陆该账户即可:
|
||
|
||
```sh
|
||
XDG_DESKTOP_DIR="$HOME/Desktop"
|
||
XDG_DOWNLOAD_DIR="$HOME/Downloads"
|
||
XDG_TEMPLATES_DIR="$HOME/Templates"
|
||
XDG_PUBLICSHARE_DIR="$HOME/Public"
|
||
XDG_DOCUMENTS_DIR="$HOME/Documents"
|
||
XDG_MUSIC_DIR="$HOME/Music"
|
||
XDG_PICTURES_DIR="$HOME/Pictures"
|
||
XDG_VIDEOS_DIR="$HOME/Videos"
|
||
```
|
||
|
||
之后:
|
||
|
||
```sh
|
||
gsettings set org.blueman.transfer shared-path '/home/<user name>/Downloads'
|
||
```
|
||
|
||
或通过:
|
||
|
||
```sh
|
||
sudo blueman-services
|
||
```
|
||
|
||
重新配置,否则重启会提示:
|
||
|
||
```sh
|
||
Configured directory for incoming files does not exist
|
||
```
|
||
|
||
## 查看已安装工具包
|
||
|
||
```sh
|
||
dpkg -l
|
||
```
|
||
|
||
可配合 grep 工具使用。
|
||
|
||
## 安装开发工具
|
||
|
||
```sh
|
||
sudo apt-get install build-essential
|
||
sudo apt-get install global openssl gcc git make gnu-efi libssl-dev libpciaccess-dev uuid-dev libsystemd-dev libevent-dev libxml2-dev libusb-1.0-0-dev python3 python3-pip libblkid-dev e2fslibs-dev minicom gtkterm parted gparted tmux
|
||
sudo pip3 install kconfiglib
|
||
```
|
||
|
||
## 提升权限
|
||
|
||
普通用户可能无法访问某些设备,需要提升权限:
|
||
|
||
```sh
|
||
gpasswd --add <user name> dialout
|
||
groups <user name>
|
||
```
|
||
|
||
## 安装 Flash Player
|
||
|
||
```sh
|
||
sudo apt-get install flashplugin-installer
|
||
```
|
||
|
||
## 让 Shell 只显示当前路径
|
||
|
||
Shell 默认显示完整路径,有时候路径比较长就非常恼人,可以设置只显示当前目录名称,修改 ~/.bashrc,将所有 PS1 对应的小写 w 改为大写 W 即可,例如:
|
||
|
||
```sh
|
||
# PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||
# \w\ 改为 \W\
|
||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
|
||
```
|