NotePublic/Software/System/Linux/Editions/Ubuntu/Ubuntu_初始配置.md

142 lines
5.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Ubuntu 初始配置
## 使用清华源
Ubuntu 的软件源配置文件是 /etc/apt/sources.list。将系统自带的该文件做个备份将该文件替换为清华的软件源配置文件即可使用 TUNA 的软件源镜像。
适用于 Ubuntu 18.04 LTS 的清华源配置文件如下:
```bash
# 默认注释了源码镜像以提高 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
```bash
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
```
### 安装主题
示例如下:
```bash
sudo apt-get install breeze-icon-theme breeze-cursor-theme breeze-gtk-theme
```
之后在 gnome tweak tool 中可更换主题。
### 安装中文输入法
Gnome3 默认支持 ibus 输入法,安装方法如下:
```bash
sudo apt-get install language-support ibus-pinyin ibus-sunpinyin ibus-gtk ibus-gtk3 ibus-qt4
```
不安装 ibus-gtk、ibus-gtk3 和 ibus-qt4 的话将不会产生光标跟随效果,输入法待选字都在左下角。
之后在 system settings -> Region & Language 里面增加输入法,重启后生效。
### 切换登陆管理器
默认在安装 Gnome3 时会弹出登陆管理器切换界面,如需自行修改的话可使用如下命令:
```bash
sudo dpkg-reconfigure gdm
# 或
sudo dpkg-reconfigure lightdm
```
### 切换主目录为英文
中文系统默认主目录下文件夹名为中文,在 shell 下访问太过费事,最好改为英文。方法是修改 ~/.config/user-dirs.dirs 文件内容如下,之后将各目录修改为对应的英文名,然后重新登陆该账户即可:
```ini
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"
```
之后:
```bash
gsettings set org.blueman.transfer shared-path '/home/<user name>/Downloads'
```
或通过:
```bash
sudo blueman-services
```
重新配置,否则重启会提示:
```bash
Configured directory for incoming files does not exist
```
## 查看已安装工具包
```bash
dpkg -l
```
可配合 grep 工具使用。
## 安装开发工具
```bash
sudo apt install bison build-essential make gcc gcc-multilib global git-core git openssl module-init-tools gnu-efi xz-utils debianutils iputils-ping e2fslibs-dev ccache gawk wget diffstat bc zip unzip chrpath socat texinfo cpio flex minicom xterm gtkterm parted gparted tmux python python-pip python-wand python-crypto python3 python3-pip python3-pexpect libncurses-dev libncurses5-dev libncursesw5-dev libssl-dev libpciaccess-dev uuid-dev libsystemd-dev libevent-dev libxml2-dev libusb-1.0-0-dev liblz4-tool libsdl1.2-dev libssl-dev libblkid-dev libcv-dev libopencv-*-dev protobuf-c-compiler protobuf-compiler libprotobuf-dev libboost-dev libleveldb-dev libgflags-dev libgoogle-glog-dev libblas-dev liblmdb-dev libsnappy-dev libopenblas-dev python-numpy libboost-python-dev gfortran python-scikits-learn python-skimage-lib usbutils pciutils autoconf automake autotools-dev libltdl-dev libtool net-tools locales language-pack-zh-han*
sudo pip3 install kconfiglib
```
## 提升权限
普通用户可能无法访问某些设备,需要提升权限:
```bash
# 通过下列命令获得设备节点所在的组.
ls -l /dev |grep <device node>
# 以下命令中的 group name 为上述 ls 得到设备节点所在组名.
sudo gpasswd --add <user name> <group name>
# 通过以下命令确认是否已将用户添加到该组.
groups ${USER}
```
## 安装 Flash Player
```bash
sudo apt-get install flashplugin-installer
```
## 让 Shell 只显示当前路径
Shell 默认显示完整路径,有时候路径比较长就非常恼人,可以设置只显示当前目录名称,修改 ~/.bashrc将所有 PS1 对应的小写 w 改为大写 W 即可,例如:
```ini
# PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
# \w\ 改为 \W\
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
```