红联Linux门户
Linux帮助

Ubuntu 16.04 LTS安装配置笔记

发布时间:2016-10-26 10:56:57来源:plumz.me作者:plumz
Ubuntu 16.04 LTS 发布了,最近按照自己的需求,在常用的 VPS ,笔记本,台式机上都进行了升级,下面记录一下升级过程,以便自己将来参考。
Ubuntu 16.04 LTS安装配置笔记
 
升级系统
sudo apt update
sudo apt dist-upgrade
 
默认的思源黑体个人觉得非常丑陋,安装文泉驿黑体更换
sudo apt-get install wqy-*
sudo gedit /etc/fonts/conf.avail/69-language-selector-zh-cn.conf
使用以下内容替换:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test qual="any" name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Bitstream Vera Serif</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>WenQuanYi Bitmap Song</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Bitstream Vera Sans</string>
<string>WenQuanYi Micro Hei</string>
<string>WenQuanYi Zen Hei</string>
<string>Droid Sans Fallback</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string><
string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Bitstream Vera Sans Mono</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>WenQuanYi Zen Hei Mono</string>
<string>Droid Sans Fallback</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>
</fontconfig>
 
笔记本的话安装帮助降低功耗的 TLP:
sudo apt-get install tlp tlp-rdw 
sudo apt-get install tp-smapi-dkms acpi-call-dkms 
sudo apt-get install thermald
sudo apt-get install powertop
 
添加一些常见的 PPA:
# 常见工具集合 PPA
sudo add-apt-repository ppa:diesch/testing -y
sudo add-apt-repository ppa:atareao/atareao -y
sudo add-apt-repository ppa:nilarimogard/webupd8 -y
# VLC
sudo add-apt-repository ppa:videolan/master-daily -y
# 音频切换 Indicator 的 PPA
sudo add-apt-repository ppa:yktooo/ppa -y
# Numix 图标集合 PPA
sudo apt-add-repository ppa:numix/ppa -y
# JDK 字体渲染补丁 PPA
sudo add-apt-repository ppa:no1wantdthisname/openjdk-fontfix -y
# DNSCrypt PPA
sudo add-apt-repository ppa:anton+/dnscrypt -y
# noobslab 图标 PPA
sudo add-apt-repository ppa:noobslab/icons -y
# 录屏软件 PPA
sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder  -y
# Telegram PPA
sudo add-apt-repository ppa:atareao/telegram -y
# Uget PPA
sudo add-apt-repository ppa:plushuang-tw/uget-stable -y
# Emoji 颜文字 PPA
sudo apt-add-repository ppa:eosrei/fonts
 
添加完毕后更新并安装常用软件
sudo apt update
sudo apt dist-upgrade
sudo apt-get install fcitx fcitx-sunpinyin fcitx-module-cloudpinyin gtk2-engines-murrine:i386 libudev1:i386 vlc i965-va-driver vainfo gimp inkscape openshot shutter filezilla audacity classicmenu-indicator numix-gtk-theme shimmer-themes numix-icon* caffeine leafpad git indicator-sound-switcher  unity-tweak-tool fcitx-mozc ibus-qt4 curl ctags vim-doc vim-scripts cscope fonts-dejavu indent vim vim-gnome exuberant-ctags indicator-keylock pidgin  psensor syspeek blueman libluajit-5.1-2 python3-pip dnscrypt-proxy unsettings ubuntu-make ppa-purge jayatana simplescreenrecorder compizconfig-settings-manager ultra-flat-icons-* ultra-flat-icons zsh uget telegram fonts-emojione-svginot -y
 
python
sudo pip3 install pep8
sudo pip3 install jedi
 
基本支持:
sudo apt-get install ttf-bitstream-vera
sudo apt-get install exfat-fuse exfat-utils
 
配置 DNScrypt
sudo vim /etc/default/dnscrypt-proxy 
# 修改里面的默认配置文件为 cisco,同时记得新的监听地址已经改了,127.0.2.1
sudo vim /usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv
sudo vim /etc/default/dnscrypt-proxy
sudo service dnscrypt-proxy restart
 
配置 TLP
sudo vim /etc/default/tlp
sudo tlp start
 
美化:
因为 Ubuntu 16.04 使用了新版 GTK ,可以使用 Arc-theme 了,我个人觉得这个主题是现阶段除了 Numix 以外比较好的了,对于过白的问题网络上有改版。
sudo apt-get remove arc-theme* -y
sudo rm -rf /usr/share/themes/{Arc,Arc-Darker,Arc-Dark}
rm -rf ~/.local/share/themes/{Arc,Arc-Darker,Arc-Dark}
rm -rf ~/.themes/{Arc,Arc-Darker,Arc-Dark}
sudo apt-get install autoconf automake pkg-config libgtk-3-dev git -y
git clone https://github.com/horst3180/arc-theme --depth 1
cd arc-theme
./autogen.sh --prefix=/usr --disable-transparency
sudo make install
cd ..\
rm -rf arc-theme
图标建议使用 Ultra-Flat-Icons,值得一提的是 Arc-theme 使用后音量调整的 OSD 图标并不支持,建议使用 Numix 的来替换,我是直接拷贝的,最好是能做链接,先把文件名记录下来。
notification-audio-volume-high.svg
notification-audio-volume-low.svg
notification-audio-volume-medium.svg
notification-audio-volume-muted.svg
notification-audio-volume-off.svg
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-high.svg /usr/share/icons/Ultra-Flat/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-low.svg /usr/share/icons/Ultra-Flat/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-medium.svg /usr/share/icons/Ultra-Flat/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-muted.svg /usr/share/icons/Ultra-Flat/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-off.svg /usr/share/icons/Ultra-Flat/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-high.svg /usr/share/icons/Ultra-Flat-Orange-Bright/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-low.svg /usr/share/icons/Ultra-Flat-Orange-Bright/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-medium.svg /usr/share/icons/Ultra-Flat-Orange-Bright/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-muted.svg /usr/share/icons/Ultra-Flat-Orange-Bright/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-off.svg /usr/share/icons/Ultra-Flat-Orange-Bright/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-high.svg /usr/share/icons/Ultra-Flat-Green/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-low.svg /usr/share/icons/Ultra-Flat-Green/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-medium.svg /usr/share/icons/Ultra-Flat-Green/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-muted.svg /usr/share/icons/Ultra-Flat-Green/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-off.svg /usr/share/icons/Ultra-Flat-Green/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-high.svg /usr/share/icons/Ultra-Flat/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-low.svg /usr/share/icons/Ultra-Flat/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-medium.svg /usr/share/icons/Ultra-Flat/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-muted.svg /usr/share/icons/Ultra-Flat/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-off.svg /usr/share/icons/Ultra-Flat/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-high.svg /usr/share/icons/Ultra-Flat-Orange/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-low.svg /usr/share/icons/Ultra-Flat-Orange/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-medium.svg /usr/share/icons/Ultra-Flat-Orange/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-muted.svg /usr/share/icons/Ultra-Flat-Orange/status/scalable/
sudo ln -s /usr/share/icons/Numix/48/notifications/notification-audio-volume-off.svg /usr/share/icons/Ultra-Flat-Orange/status/scalable/
 
安装罗技优连管理程序
wget https://launchpad.net/~daniel.pavel/+archive/ubuntu/solaar/+files/solaar_0.9.2-1ppa1_all.deb
sudo dpkg -i solaar_0.9.2-1ppa1_all.deb
 
消除 Ubuntu LightDM 登陆界面的白点
原本用 Ubuntu Tweak,不过作者现在成果粉了,Unity-Tweak-Tool 也可以替代,但是这个功能那玩意还是没有,不过用命令也能实现。
gsettings set com.canonical.unity-greeter draw-grid false
sudo xhost +SI:localuser:lightdm
sudo su lightdm -s /bin/bash
gsettings set com.canonical.unity-greeter draw-grid false
quit
运行两次是因为用户不同,锁屏的白点还是你自己用户的。
 
修改音质解析:Linux下Pulse Audio 的音质处理(//m.ajphoenix.com/linux/25326.html)、Linux下多声卡采样率的自动处理(//m.ajphoenix.com/linux/25402.html)
sudo vim /etc/pulse/daemon.conf
pulseaudio -k
pulseaudio --start
 
使用 libinput 代替默认的输入控制,包括更好的触摸板和指点杆支持
sudo apt install xserver-xorg-input-libinput
sudo vim /usr/share/X11/xorg.conf.d/90-libinput.conf 
之后触摸板更滑润,但是其他问题比较多,最后我还是禁用了,使用了 indicator-touchpad
sudo apt install indicator-touchpad
这玩意有个 Bug,就是快捷键禁用后不会恢复你的三指中键点击,用了一个很丑陋的方式修了这个 Bug,因为没什么注释我是在懒得看它的函数怎么写的了。
sudo vim /opt/extras.ubuntu.com/touchpad-indicator/share/touchpad-indicator/touchpad.py
在启用函数下添加:
Ubuntu 16.04 LTS安装配置笔记
self.synclient.set('TouchpadOff','0')
self.synclient.set('TapButton3','2')
self.synclient.set('PalmDetect','1')
 
使用 terminator 替换默认终端
sudo apt-get install terminator
sudo update-alternatives --config x-terminal-emulator
gsettings set org.gnome.desktop.default-applications.terminal exec 'terminator'
 
配置 Oh-My-ZSH(//m.ajphoenix.com/linux/25401.html)
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
wget --no-check-certificate https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.ansi-dark
mv dircolors.ansi-dark .dircolors
eval `dircolors ~/.dircolors`
git clone https://github.com/sigurdga/gnome-terminal-colors-solarized.git
cd gnome-terminal-colors-solarized
./set_dark.sh
 
删除敏感证书:
sudo dpkg-reconfigure ca-certificates 
 
固态硬盘启用 Trim (不推荐使用, Ubuntu 16.04.1 已经自带这个功能)
sudo gedit /etc/cron.daily/trim
内容:
#!/bin/sh
LOG=/var/log/trim.log
echo "*** $(date -R) ***" >> $LOG
fstrim -v / >> $LOG
fstrim -v /home >> $LOG
运行并添加任务
sudo fstrim -v /
sudo chmod +x /etc/cron.daily/trim
 
内核加参数,为笔记本省电
sudo vim /etc/default/grub
i915 enable_rc6=1 enable_fbc=1 lvds_downclock=1 semaphores=1
sudo update-grub
 
解决主题缺失:
sudo apt-get install  gtk2-engines-pixbuf:i386
sudo apt-get install gtk2-engines-pixbuf gnome-themes-standard libcanberra-gtk3-module:i386 libcanberra-gtk3-module
 
解决 Ubuntu 16.04 挂机唤醒后 Wi-Fi 信号变成本地连接图标的问题: (不推荐使用, Bug 已经修复)
nmcli con down "CONNECTION NAME" && nmcli con up "CONNECTION NAME"
 
修改本地文件夹名称为英文
export LANG=en_US
xdg-user-dirs-gtk-update
export LANG=zh_CN
重启后
ln -s /HDD/Documents/ ~/
ln -s /HDD/Downloads/ ~/
ln -s /HDD/Music/ ~/
ln -s /HDD/Pictures/ ~/
ln -s /HDD/Videos/ ~/
ln -s /HDD/Dropbox/ ~/
ln -s /HDD/Software/ ~/
 
Shadowsocks
git clone https://github.com/shadowsocks/shadowsocks-libev.git
cd shadowsocks-libev
sudo apt-get install --no-install-recommends build-essential autoconf libtool libssl-dev gawk debhelper dh-systemd init-system-helpers pkg-config asciidoc xmlto
dpkg-buildpackage -b -us -uc -i
cd ..
sudo dpkg -i shadowsocks-libev_*_amd64.deb 
修改启动命令为 ss-local
sudo vim /lib/systemd/system/shadowsocks-libev.service 
配置文件
sudo vim /etc/shadowsocks-libev/config.json 
修改启动参数,如果有一次认证记得在这里加 -A
sudo vim /etc/default/shadowsocks-libev 
sudo systemctl daemon-reload
sudo service shadowsocks-libev restart
 
Ubuntu 16.04 使用了新的网络管理,你的网络名称会变成 enp2s0 而不是之前的 eth0 ,会导致一些稳定问题,改回去可以
sudo vim /etc/default/grub
增加参数:
GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=0"
sudo update-grub
 
Ubuntu 16.04 中文月份显示两个“月”的问题: (已经修复)
gsettings set com.canonical.indicator.datetime time-format 'custom'
gsettings set com.canonical.indicator.datetime custom-time-format 'FORMAT_VALUE_HERE'
以下是参数含义:
%a = 星期名缩写
%A = 星期名完整拼写
%b = 月份名缩写
%B = 月份名完整拼写
%d = 每月的日期
%l = 小时 ( 1..12), %I = 小时 (01..12)
%k = 小时 ( 1..23), %H = 小时 (01..23)
%M = 分钟 (00..59)
%p = 午别,AM 或 PM, %P = am 或 pm.
%S = 秒 (00..59)
 
Fcitx 输入法换回原生 indicator,不用那个 qim
sudo apt remove fcitx-ui-qimpanel 
 
安装 Ubuntu Emoji 支持 (不需要,已经有 PPA 了)
wget https://github.com/eosrei/emojione-color-font/releases/download/v1.0-beta3/EmojiOneColor-SVGinOT-Linux-1.0-beta3.zip
unzip -o EmojiOneColor-SVGinOT-Linux-1.0-beta3.zip
./install.sh
 
大体就是如此,顺便这次 Ubuntu 16.04 发布时 Bug 很多, DNS 服务几率挂掉,网络连接图标乱改, Gnome-Software 中心不支持第三方 deb ,正常使用 Compiz 内存占用比 14.04 多一倍,并且速度还慢。
 
好在Ubuntu 16.04.1版本的Bug修复了不少,基本算是稳定能用了。
 
本文永久更新地址://m.ajphoenix.com/linux/25403.html