2019-01-08 18:43:22 +08:00
|
|
|
|
# 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
|
|
|
|
|
|
2019-07-04 13:41:56 +08:00
|
|
|
|
```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
|
|
|
|
|
```
|
2019-01-08 18:43:22 +08:00
|
|
|
|
|
|
|
|
|
### 安装主题
|
|
|
|
|
|
|
|
|
|
示例如下:
|
|
|
|
|
|
2019-07-04 13:41:56 +08:00
|
|
|
|
```sh
|
|
|
|
|
sudo apt-get install breeze-icon-theme breeze-cursor-theme breeze-gtk-theme
|
|
|
|
|
```
|
2019-01-08 18:43:22 +08:00
|
|
|
|
|
|
|
|
|
之后在 gnome tweak tool 中可更换主题。
|
|
|
|
|
|
|
|
|
|
### 安装中文输入法
|
|
|
|
|
|
|
|
|
|
Gnome3 默认支持 ibus 输入法,安装方法如下:
|
|
|
|
|
|
2019-07-04 13:41:56 +08:00
|
|
|
|
```sh
|
|
|
|
|
sudo apt-get install ibus-pinyin ibus-sunpinyin ibus-gtk ibus-gtk3 ibus-qt4
|
|
|
|
|
```
|
2019-01-08 18:43:22 +08:00
|
|
|
|
|
|
|
|
|
不安装 ibus-gtk、ibus-gtk3 和 ibus-qt4 的话将不会产生光标跟随效果,输入法待选字都在左下角。
|
|
|
|
|
|
|
|
|
|
之后在 system settings -> Region & Language 里面增加输入法,重启后生效。
|
|
|
|
|
|
|
|
|
|
### 切换登陆管理器
|
|
|
|
|
|
|
|
|
|
默认在安装 Gnome3 时会弹出登陆管理器切换界面,如需自行修改的话可使用如下命令:
|
|
|
|
|
|
2019-07-04 13:41:56 +08:00
|
|
|
|
```sh
|
|
|
|
|
sudo dpkg-reconfigure gdm
|
|
|
|
|
# 或
|
|
|
|
|
sudo dpkg-reconfigure lightdm
|
|
|
|
|
```
|
2019-01-08 18:43:22 +08:00
|
|
|
|
|
2019-07-04 13:43:59 +08:00
|
|
|
|
### 切换主目录为英文
|
2019-01-08 19:57:47 +08:00
|
|
|
|
|
|
|
|
|
中文系统默认主目录下文件夹名为中文,在 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"
|
|
|
|
|
```
|
|
|
|
|
|
2019-01-09 12:42:55 +08:00
|
|
|
|
之后:
|
|
|
|
|
|
2019-07-04 13:41:56 +08:00
|
|
|
|
```sh
|
|
|
|
|
gsettings set org.blueman.transfer shared-path '/home/<user name>/Downloads'
|
|
|
|
|
```
|
2019-01-09 12:42:55 +08:00
|
|
|
|
|
|
|
|
|
或通过:
|
|
|
|
|
|
2019-07-04 13:41:56 +08:00
|
|
|
|
```sh
|
|
|
|
|
sudo blueman-services
|
|
|
|
|
```
|
2019-01-09 12:42:55 +08:00
|
|
|
|
|
|
|
|
|
重新配置,否则重启会提示:
|
|
|
|
|
|
2019-07-04 13:41:56 +08:00
|
|
|
|
```sh
|
|
|
|
|
Configured directory for incoming files does not exist
|
|
|
|
|
```
|
2019-01-09 12:42:55 +08:00
|
|
|
|
|
2019-01-08 18:43:22 +08:00
|
|
|
|
## 查看已安装工具包
|
|
|
|
|
|
2019-07-04 13:41:56 +08:00
|
|
|
|
```sh
|
|
|
|
|
dpkg -l
|
|
|
|
|
```
|
2019-01-08 18:43:22 +08:00
|
|
|
|
|
|
|
|
|
可配合 grep 工具使用。
|
|
|
|
|
|
|
|
|
|
## 安装开发工具
|
|
|
|
|
|
2019-07-04 13:41:56 +08:00
|
|
|
|
```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
|
|
|
|
|
```
|
2019-01-08 19:57:47 +08:00
|
|
|
|
|
|
|
|
|
## 提升权限
|
|
|
|
|
|
|
|
|
|
普通用户可能无法访问某些设备,需要提升权限:
|
|
|
|
|
|
2019-07-04 13:41:56 +08:00
|
|
|
|
```sh
|
2020-05-12 17:07:37 +08:00
|
|
|
|
# 通过下列命令获得设备节点所在的组.
|
|
|
|
|
ls -l /dev |grep <device node>
|
|
|
|
|
# 以下命令中的 group name 为上述 ls 得到设备节点所在组名.
|
|
|
|
|
gpasswd --add <user name> <group name>
|
|
|
|
|
# 通过以下命令确认是否已将用户添加到该组.
|
2019-07-04 13:41:56 +08:00
|
|
|
|
groups <user name>
|
|
|
|
|
```
|
2019-07-25 20:07:48 +08:00
|
|
|
|
|
|
|
|
|
## 安装 Flash Player
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
sudo apt-get install flashplugin-installer
|
|
|
|
|
```
|
2019-07-30 15:10:06 +08:00
|
|
|
|
|
|
|
|
|
## 让 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\$ '
|
|
|
|
|
```
|