安装 Ubuntu 后的系统配置

2017-02-05 2958点热度 0人点赞 0条评论

每次重新安装 Ubuntu 系统后,都需要进行一些配置,写篇文章记录一下 Ubuntu 16.04 中的系统配置:

清理不必要的软件

删除 Amazon 的链接

$ sudo apt remove unity-webapps-common

删掉基本不用的自带软件

$ sudo apt remove thunderbird firefox rhythmbox empathy brasero gnome-mahjongg aisleriot gnome-mines gnome-orca webbrowser-app gnome-sudoku onboard deja-dup
$ sudo apt autoremove

这样系统就基本上干净了。

安装软件

常用工具

$ sudo apt install vim vpnc git wget axel aria2 openssh-server cmake lnav unrar unzip p7zip-full

Google Chrome

https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 下载最新的安装文件。
然后

$ sudo dpkg -i google-chrome-stable_current_amd64.deb

安装过程中会提示依赖错误,使用 apt -f install 安装依赖:

$ sudo apt-get -f install

安装完成后会自动向系统添加 Chrome 的软件源。

搜狗拼音输入法

前往搜狗官网下载安装包:
http://pinyin.sogou.com/linux/?r=pinyin
然后使用 dpkg 安装:

$ sudo dpkg -i sogoupinyin_2.1.0.0082_amd64.deb
$ sudo apt -f install

WPS Office

目前 WPS 在 Linux 中对 MS Office 的格式支持算是最好的了。
http://community.wps.cn/download/ 下载安装包。

$ sudo dpkg -i wps-office_10.1.0.5672-a21_amd64.deb

Oracle JDK

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

安装后运行 java -version 查看 Java 版本。

如果第一行不是 java 的版本号,出现 Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 这个提示。这是由于系统自带的 Open JDK 配置残留导致检测 Java 版本号的脚本会运行出错,因此需要手动清除残留:

$ sudo rm /usr/share/upstart/sessions/jayatana.conf

删除之后重启系统,再运行 java -version 就会正确显示版本号了。

Sublime Text 3

$ sudo add-apt-repository ppa:webupd8team/sublime-text-3
$ sudo apt-get update
$ sudo apt-get install sublime-text

系统指示器 SysPeek

$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install syspeek

使用技巧

禁用 Guest 账户

添加 lightdm 配置文件以禁用 Guest 账户:

$ sudo sh -c 'printf "[SeatDefaults]\nallow-guest=false\n" >/usr/share/lightdm/lightdm.conf.d/50-no-guest.conf'

需要恢复 Guest 账户时只需要删除添加的配置文件:

$ sudo rm -f /usr/share/lightdm/lightdm.conf.d/50-no-guest.conf

系统时间同步

Ubuntu 16.04 中修改了时间配置文件,不再在/etc/default/rcS 文件中配置。
先在 Ubuntu 下更新一下时间,确保时间无误:

$ sudo apt-get install ntpdate
$ sudo ntpdate time.windows.com

然后将时间更新到硬件上:

$ sudo hwclock --localtime --systohc

gedit 中文乱码

gsettings set org.gnome.gedit.preferences.encodings candidate-encodings "['GB18030','UTF-8','CURRENT','ISO-8859-15', 'UTF-16']"

自定义 DNS 地址

修改 DNS 解析配置文件:

$ sudo gedit /etc/dhcp/dhclient.conf

在第 21 行 #prepend domain-name-servers 127.0.0.1; 下一行添加自定义地址(这里使用 114 公共 DNS):

prepend domain-name-servers 114.114.114.114;
prepend domain-name-servers 114.114.114.115;

这样可以优先使用 114 的 DNS 进行域名解析。

Fcitx 与 Sublime 冲突

搜狗拼音输入法是基于 Fcitx 的,而 Fcitx 本身和一些软件会发生冲突,常见的就是 Sublime 与 Qt Creator 。

解决方法:

$ git clone https://github.com/lyfeyaj/sublime-text-imfix
$ cd sublime-text-imfix
$ ./sublime-imfix

Fcitx 与 Qt Creator 冲突

安装依赖

$ sudo apt-get install cmake fcitx-libs-dev

设置环境变量

$ export PATH="/path/to/Qt_version/version/gcc_64/bin":$PATH

其中/path/to/Qt_version/version/为安装 Qt 的位置,这个根据个人的安装位置情况而定.

下载 fcitx-qt5 源码

$ git clone https://github.com/fcitx/fcitx-qt5

编译 fcitx-qt5

$ cd fcitx-qt5
$ cmake .
$ make
$ sudo make install

复制 so 文件

编译成功之后,将编译得到的 libfcitxplatforminputcontextplugin.so 文件拷贝到 Qt 的按装目录下 Tools/QtCreator/bin/plugins/platforminputcontextsTools/QtCreator/lib/Qt/plugins/platforminputcontext
之中。两个目录由安装情况而定,有的会是第一个路径,有的则是第二个路径,最后重启 Qt 即可输入中文。

可能遇到的问题

缺少 ECMConfig.cmakeecm-config.cmake

CMake Error at CMakeLists.txt:8 (find_package):
Could not find a package configuration file provided by "ECM" (requested
version 1.4.0) with any of the following names:
ECMConfig.cmake
ecm-config.cmake
Add the installation prefix of "ECM" to CMAKE_PREFIX_PATH or set "ECM_DIR"
to a directory containing one of the above files. If "ECM" provides a
separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!

下载 extra-cmake-modules_1.4.0.orig.tar.xzhttps://launchpad.net/ubuntu/+source/extra-cmake-modules/1.4.0-0ubuntu1
解压后进行如下操作:

$ cd extra-cmake-modules-1.4.0
$ cmake .
$ sudo make install

缺少 Qt5Config.cmakeqt5-config.cmake

CMake Error at CMakeLists.txt:29 (find_package):
Could not find a package configuration file provided by "Qt5" (requested
version 5.1.0) with any of the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.

设置 CMAKE_PREFIX_PATH 环境变量:

$ export CMAKE_PREFIX_PATH="/path/to/Qt_version/version/gcc_64/lib/cmake/"

缺少 xkbcommon

-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- Could NOT find XKBCommon_XKBCommon (missing: XKBCommon_XKBCommon_LIBRARY XKBCommon_XKBCommon_INCLUDE_DIR)
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find XKBCommon (missing: XKBCommon_LIBRARIES XKBCommon) (Required is at least version "0.5.0")

进行安装即可:

$ sudo apt-get install libxkcommon-dev

编译:

$ sudo apt-get install bison
$ ./configure --prefix=/usr --libdir=/usr/lib/x86_64-Linux-gnu --disable-x11
$ make
$ sudo make install

SilverLining

也可能是只程序猿

文章评论