Ubuntu 16.04安装后的简单配置和常用软件安装

0.调整时区
为什么放到0来说呢,因为这实在是太重要了。估计没有几个人电脑上只有一个ubuntu系统。每次用ubuntu再切回win,win都会产生8小时时差,非常讨厌。至于原因就不再赘述。这里讲解决办法。
在Ubuntu 16.04 版本以前,关闭UTC的方法是编辑/etc/default/rcS,将UTC=yes改成UTC=no,。但在Ubuntu 16.04使用systemd启动之后,时间改成了由timedatectl来管理,所以之前的方法彻底没用了,也不要去尝试了。
正确的更改方法是:

timedatectl set-local-rtc 1 --adjust-system-clock

执行后重启直接进Ubuntu,然后再返回WIN看一下,应该就没有问题了。

0.5. 调整Launcher启动器位置
Launcher,相当于Windows下的任务栏。默认是放在屏幕左边的位置,实际上这个设计在当今宽屏的天下是相当不错的,有效的提升了显示面积。但是由于各种原因,很多人更喜欢把它放在底部。那么这里给出解决办法,Terminal中输入下面的命令即可:

gsettings set com.canonical.Unity.Launcher launcher-position Bottom

1.安装神器vim

sudo apt-get install vim  

2.安装sublime-text 3
我个人更加偏好用sublime-text 3编辑一切文本。搭配各种主题和插件,逼格效率双高。

wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update
sudo apt-get install sublime-text

安装完之后用命令subl即可启动。至于后续的注册和插件安装,请另行移步其他文章。
3.安装和启用搜狗拼音输入法
首先,加入ubuntu kylin的apt源

 sudo gedit /etc/apt/sources.list.d/ubuntukylin.list

不论文件是否为空,加入下面一行:

deb http://archive.ubuntukylin.com:10006/ubuntukylin trusty main

然后

sudo apt-get update
sudo apt-get install sogoupinyin

这条命令会自动把fcitx的依赖安装上。(如果之前没有安装)
安装完之后,在System Settings中找到Language Support,将Keyboard input method system改为fcitx。
注销后回来。应在会在屏幕右上角看到fcitx的图标。点击图标打开fcitx设置,在Input Method选项卡中点击左下角加号,弹出的选项卡中取消勾选”Only Show Current Language”选项,搜索”Sogou”定位到搜狗拼音输入法,确定。至此,搜狗拼音输入法已经配置完毕。至于快捷键和界面配置,就由各位自由发挥吧。

4.安装unrar
系统默认不带解压缩rar文件的功能,手动安装unrar程序。虽然不知道为什么这么多人偏爱rar,不过网络环境如此,这个必须装。但我个人还是建议多用些开源的压缩格式比较讲究。

sudo apt-get install unrar

安装完之后可以在资源管理器(nautilus)里直接对压缩档进行解压操作。无需命令。

5.安装Oracle Java

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

如果系统自带的是OpenJDK,或者安装OpenJDK后卸载OpenJDK带有残留,导致运行

 java -version

时第一行不是java的版本号,会是Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar这个提示,导致很多检测java版本号的脚本会运行出错,因此需要手动清除残留。

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

删除/usr/share/upstart/sessions/jayatana.conf文件,重启之后再运行java -version就不会再有Picked
up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar提示了。

6.安装系统指示器SysPeek
syspeek安装后会在屏幕右上角常驻一个小图标,可以用来查看系统各项资源的使用情况,包括CPU,内存,磁盘,网络,和进程。

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

7.安装经典菜单指示器。(就是在屏幕右上角添加一个小图标,用途和之前版本的类“开始菜单”按钮一样)

sudo add-apt-repository ppa:diesch/testing
sudo apt-get update
sudo apt-get install classicmenu-indicator

8.安装ExFat文件系统驱动
Ubuntu默认不支持exFat文件系统的挂载,需要手动安装exfat的支持。要么几乎用不到,要么天天要用到。占用空间极小,还是安上舒服些。

sudo apt-get install exfat-fuse

9.安装lnav
lnav工具是在终端界面看日志的神器

sudo apt-get install lnav

装上之后在终端里就可以用lnav彩色显示日志了。

10.安装smplayer
免费开源的媒体播放器SMPlayer。内置解码器,因此任何额外的编解码器。虽然高清解码不怎么给力,不过一次安装,就解决所有影音文件的播放问题。

sudo apt-add-repository ppa:rvm/smplayer
sudo apt-get update
sudo apt-get install smplayer smplayer-skins smplayer-themes

11.安装网易云音乐
堪称业绩恩良心。官网下载deb包直接安装。
终端里cd到deb包的下载目录。

sudo dpkg -i netease-cloud-music_1.0.0_amd64_ubuntu16.04.deb

如果出现依赖性错误,解决下依赖问题,然后重新走一遍安装

sudo apt-get -f install

12.安装Virtual Box
Windows下的虚拟机平台当属Vimware Workstation,不过这个东西比较臃肿,加上闭源收费,个人更推荐VirtualBox。本人实测VirtualBox虚拟个WINXP之类的效率不输于WIN平台下的VM。但是切记一定要在主机端安装extension pack,在客户机端安装Guest Addtions Pack,不然卡顿现象严重,很多实用的功能也用不了。
首先,把VirtualBox加入源列表

sudo gedit /etc/apt/sources.list

加入下面一行:

deb http://download.virtualbox.org/virtualbox/debian xenial contrib

然后下载秘钥

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

然后安装

sudo apt-get update
sudo apt-get install virtualbox-5.1

13.安装Unity Tweak Tool
如果想安装自定义主题的话,那么Unity Tweak Tool是必装的。虽然Unity并没有留给各位多少能Tweak的地方,但是只要是想个性化界面,一定不要忘了先安装它。

sudo apt-get install unity-tweak-tool

14.安装Ubuntu Tweak
比起上一个只能Tweak Unity的Tool来说,这个Ubuntu Tweak就可以用强大来形容了。因为它Tweak的是整个Ubuntu。这是Ubuntu上老牌的Tweak工具,可以调整的项目太多,而且还有系统清理功能,可以说是装机必备了。虽然其所有的功能都可以通过手动实现,但是谁不喜欢GUI呢?

wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
sudo sh -c 'echo "deb http://archive.getdeb.net/ubuntu xenial-getdeb apps" >> /etc/apt/sources.list.d/getdeb.list'
sudo apt-get update
sudo apt-get install ubuntu-tweak

15.安装Typora
Typora可以说是一款相当好用的Markdown编辑器了。程序员对文本有一种天生的好感,有那么一群人总觉得像word这种文档太浮夸,文本文件又没有格式,于是他们就发明了markdown这种语法(),用一些简单的标记来取得类似网页一样的展示效果。
什么?你不知道什么是markdown?那么我建议你立即学习!
安装方法:

sudo add-apt-repository 'deb http://typora.io linux/'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE
sudo apt-get update
sudo apt-get install typora

本文中的所有设置或者软件安装,本人写了一个shell脚本可以供懒人使用。每一步都可以手动选择。喜欢的可以拿走。下面附上代码:

#!/bin/bash
#调整时区,调整Launcher位置,安装vim,unrar,Oracle Java,ExFat文件系统驱动,SysPeek,sublime-text 3,lnav,smplayer,Virtual Box,搜狗拼音输入法,网易云音乐
#作者mutilcam_prince
#http://blog.csdn.net/mutilcam_prince

#函数:询问是否安装程序
function ask()
{
yes=0
while [ "$yes" != 1 ];do
    echo  -e "\033[32m确定要安装\033[31m$*吗\033[0m?(Y/N)(直接回车即为确认)\c"
    read string
    if [ "$string" = "" ];then
        string="y"
    fi
    if [ "$string" = "n" -o "$string" = "N" ];then
        echo  -e "\033[33m已跳过\033[31m$*\033[33m的安装\033[0m..."
        break
    elif [ "$string" = "y" -o "$string" = "Y" ];then
        yes=1
        echo  -e "\033[36m正在安装\033[31m$*...\033[0m"
    fi
done
}

#函数:检查是否已安装程序
function checkinstall()
{
    ((installed=0))
    pkgname=$*
    dpkg -s $pkgname > /dev/null
    ((installed=$?))
    if  [ "$installed" = 0 ];then
        echo  -e "\033[31m$pkgname\033[36m已经安装了, 如果你想重新安装,可以尝试命令: \033[32msudo apt install --reinstall $pkgname\033[0m"
        echo  -e "\033[33m已跳过\033[31m$*\033[33m的安装\033[0m..."
    fi
}
#检查是否已安装成功并反馈
function feedback()
{
    pkgname=$*
    dpkg -s $pkgname > /dev/null
    ((installed=$?))
    if (( $installed == 1 ));then
        echo  -e "\033[31m警告:\033[36m$pkgname\033[31m无法正确安装,请留意终端内的错误信息并手动解决!\033[0m"
    else
        echo  -e "\033[31m$pkgname\033[36m已成功安装!\033[0m"
    fi
}


yes=0
#调整时区
while [ "$yes" != 1 ];do
    echo  -e "\033[32m是否需要调整Ubuntu时区与Windows系统同步?\033[0m(Y/N)\c"
    read string
    if [ "$string" = "n" -o "$string" = "N" ];then
        echo  -e "\033[33m正在跳过...\033[0m"
        break
    elif [ "$string" = "y" -o "$string" = "Y" ];then
        yes=1
        echo  -e "\033[36m正在同步时区...\033[0m"
        timedatectl set-local-rtc 1 --adjust-system-clock
        echo  -e "\033[36m时区已同步!\033[0m"
    fi
done
yes=0

#调整Launcher启动器位置
while [ "$yes" != 1 ];do
    echo  -e "\033[32m你是否需要变更\033[31mLauncher启动器\033[32m的位置\033[0m(Y/N)\c"  
    read string
    if [ "$string" = "n" -o "$string" = "N" ];then
        echo  -e "\033[33m正在跳过...\033[0m"
        break
    elif [ "$string" = "y" -o "$string" = "Y" ];then
        yes=1
    fi
done
if [ "$yes" = 1 ];then
    echo  -e "\033[32m你想把\033[31mLauncher启动器\033[32m放在什么位置?\033[0m"
    echo  -e "\033[31m1.\033[33m屏幕左侧(默认)\033[0m"
    echo  -e "\033[31m2.\033[33m底部(推荐)\033[0m"
    ((num=0))
    while [ "$num" = 0 ];do
        echo -e "\033[36m请选择\033[32m1/2\033[36m(直接回车将选择默认选项):\033[0m\c"
        read num
        case $num in
            1)
                gsettings set com.canonical.Unity.Launcher launcher-position Left
                echo  -e "\033[36m完成!\033[0m"           
                ;;
            2)
                gsettings set com.canonical.Unity.Launcher launcher-position Bottom         
                echo  -e "\033[36m完成!\033[0m"   
                ;;

            "")
                gsettings set com.canonical.Unity.Launcher launcher-position Left
                echo  -e "\033[36m完成!\033[0m"   
                ;;
            *)
                num=0
                ;;
        esac
    done

fi
yes=0
#安装vim
ask vim
if [ "$yes" = 1 ];then
    checkinstall vim
    if  [ "$installed" = 1 ];then
        sudo apt-get install vim
        feedback vim
    fi
fi

#安装unrar
ask unrar
if [ "$yes" = 1 ];then
    checkinstall unrar
    if  [ "$installed" = 1 ];then
        sudo apt-get install unrar
        feedback unrar
    fi
fi

#安装ExFat文件系统驱动
ask ExFat
if [ "$yes" = 1 ];then
    checkinstall exfat-fuse
    if  [ "$installed" = 1 ];then
        sudo apt-get install exfat-fuse
        feedback exfat-fuse
    fi
fi

#安装SysPeek
ask SysPeek
if [ "$yes" = 1 ];then
    checkinstall syspeek
    if  [ "$installed" = 1 ];then
        echo  -e "\033[32mAdding repository...\033[0m"
        sudo add-apt-repository ppa:nilarimogard/webupd8
        echo  -e "\033[31mFetching updates...\033[0m"
        sudo apt-get update
        sudo apt-get install syspeek
        feedback syspeek
    fi
fi

#安装lnav
ask lnav
if [ "$yes" = 1 ];then
    checkinstall lnav
    if  [ "$installed" = 1 ];then
        sudo apt-get install lnav
        feedback lnav
    fi
fi

#安装sublime-text3
ask sublime-text3
if [ "$yes" = 1 ];then
    checkinstall sublime-text
    if  [ "$installed" = 1 ];then
        echo  -e "\033[32mInstall the GPG key...\033[0m"
        wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
        echo  -e "\033[32mEnsure apt is set up to work with https sources...\033[0m"
        sudo apt-get install apt-transport-https
        echo  -e "\033[32mCreating sublimetext3 apt source list...\033[0m"
        echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
        echo  -e "\033[31mFetching updates...\033[0m"
        sudo apt-get update
        echo  -e "\033[33mInstalling sublime-text...\033[0m"
        sudo apt-get install sublime-text
        feedback sublime-text
    fi
fi

#安装Oracle Java
ask Oracle Java
if [ "$yes" = 1 ];then
    checkinstall oracle-java8-installer
    if  [ "$installed" = 1 ];then
        sudo rm /usr/share/upstart/sessions/jayatana.conf
        echo  -e "\033[32mAdding repository...\033[0m"
        sudo add-apt-repository ppa:webupd8team/java
        echo  -e "\033[31mFetching updates...\033[0m"
        sudo apt-get update
        sudo apt-get install oracle-java8-installer
        feedback oracle-java8-installer
    fi
fi

#安装Unity Tweak Tool
ask Unity Tweak Tool
if [ "$yes" = 1 ];then
    checkinstall unity-tweak-tool
    if  [ "$installed" = 1 ];then
        sudo apt-get install unity-tweak-tool
        feedback unity-tweak-tool
    fi
fi

#安装Ubuntu Tweak
ask Ubuntu Tweak
if [ "$yes" = 1 ];then
    checkinstall ubuntu-tweak
    if  [ "$installed" = 1 ];then
        echo  -e "\033[32mAdding key...\033[0m"
        wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
        echo  -e "\033[32mAdding Ubuntu tweak to apt source list...\033[0m"
        sudo sh -c 'echo "deb http://archive.getdeb.net/ubuntu xenial-getdeb apps" >> /etc/apt/sources.list.d/getdeb.list'
        echo  -e "\033[31mFetching updates...\033[0m"
        sudo apt-get update
        echo  -e "\033[31mInstalling...\033[0m"
        sudo apt-get install ubuntu-tweak
        feedback ubuntu-tweak
    fi
fi

#安装SMPlayer
ask SMPlayer
if [ "$yes" = 1 ];then
    checkinstall smplayer
    if  [ "$installed" = 1 ];then
        echo  -e "\033[32mAdding repository...\033[0m"
        sudo apt-add-repository ppa:rvm/smplayer
        echo  -e "\033[31mFetching updates...\033[0m"
        sudo apt-get update
        sudo apt-get install smplayer smplayer-skins smplayer-themes
        feedback smplayer
    fi
fi

#安装Sogou Pinyin
ask Sogou Pinyin
if [ "$yes" = 1 ];then
    checkinstall sogoupinyin
    if  [ "$installed" = 1 ];then
        echo  -e "\033[32mCreating Ubuntu Kylin apt source list...\033[0m"
        echo "deb http://archive.ubuntukylin.com:10006/ubuntukylin trusty main" | sudo tee /etc/apt/sources.list.d/ubuntukylin.list
        echo  -e "\033[32mAdding key...\033[0m"
        sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D259B7555E1D3C58
        echo  -e "\033[31mFetching updates...\033[0m"
        sudo apt-get update
        echo  -e "\033[33mInstalling sogoupinyin...\033[0m"
        sudo apt-get install sogoupinyin
        echo  -e "\033[36mDone!\033[0m"
        feedback sogoupinyin
    fi
fi

#安装Virtual Box 5.1
ask Virtual Box
if [ "$yes" = 1 ];then
    checkinstall virtualbox-5.1
    if  [ "$installed" = 1 ];then
        echo  -e "\033[32mCreating Virtual Box apt source list...\033[0m"
        echo "deb http://download.virtualbox.org/virtualbox/debian xenial contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
        echo  -e "\033[32mAdding key...\033[0m"
        wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
        wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
        echo  -e "\033[31mFetching updates...\033[0m"
        sudo apt-get update
        echo  -e "\033[33mInstalling virtualbox-5.1...\033[0m"
        sudo apt-get install virtualbox-5.1
        feedback virtualbox-5.1
    fi  
fi

#安装Typora
ask Typora
if [ "$yes" = 1 ];then
    checkinstall typora
    if  [ "$installed" = 1 ];then
        echo  -e "\033[32mAdding repository...\033[0m"
        sudo add-apt-repository 'deb http://typora.io linux/'
        echo  -e "\033[32mAdding key...\033[0m"
        sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE
        echo  -e "\033[31mFetching updates...\033[0m"
        sudo apt-get update
        echo  -e "\033[33mInstalling typora...\033[0m"
        sudo apt-get install typora
        feedback typora
    fi  
fi

#安装网易云音乐
ask Netease Cloud Music 64bit
if [ "$yes" = 1 ];then
    checkinstall netease-cloud-music
    if  [ "$installed" = 1 ];then
        echo  -e "\033[32mDownloading deb package...\033[0m"
        wget http://s1.music.126.net/download/pc/netease-cloud-music_1.0.0-2_amd64_ubuntu16.04.deb
        echo  -e "\033[33mInstalling netease-cloud-music...\033[0m"
        sudo dpkg -i netease-cloud-music_1.0.0-2_amd64_ubuntu16.04.deb
        echo  -e "\033[33mInstalling dependencies and finish configuring the packages(s)...\033[0m"
        sudo apt-get -f install
        echo  -e "\033[33mRemoving Downloaded deb...\033[0m"
        sudo rm netease-cloud-music_1.0.0-2_amd64_ubuntu16.04.deb
        feedback netease-cloud-music
    fi
fi
echo  -e "\033[36m脚本结束,感谢使用!\033[0m"

将这段代码用文本编辑器(如gedit等)保存为xxxx.sh
然后给这个sh文件加上执行权限,Terminal中:

chmod +x xxxx.sh

然后执行:

./xxxx.sh

根据脚本内提示进行安装、配置即可

你可能感兴趣的:(Ubuntu)