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來管理,因此以前的方法完全沒用了,也不要去嘗試了。
正確的更改方法是:java

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

執行後重啓直接進Ubuntu,而後再返回WIN看一下,應該就沒有問題了。linux

0.5. 調整Launcher啓動器位置
Launcher,至關於Windows下的任務欄。默認是放在屏幕左邊的位置,實際上這個設計在當今寬屏的天下是至關不錯的,有效的提高了顯示面積。可是因爲各類緣由,不少人更喜歡把它放在底部。那麼這裏給出解決辦法,Terminal中輸入下面的命令便可:程序員

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

1.安裝神器vimweb

sudo apt-get install vim

2.安裝sublime-text 3
我我的更加偏好用sublime-text 3編輯一切文本。搭配各類主題和插件,逼格效率雙高。shell

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源ubuntu

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

不論文件是否爲空,加入下面一行:vim

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

而後sublime-text

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"定位到搜狗拼音輸入法,肯定。至此,搜狗拼音輸入法已經配置完畢。至於快捷鍵和界面配置,就由各位自由發揮吧。bash

4.安裝unrar和7zip
系統默認不帶解壓縮rar和7zip文件的功能,須要咱們手動安裝。markdown

sudo apt-get install unrar
sudo apt-get install p7zip

安裝完以後能夠在資源管理器(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,搜狗拼音輸入法,網易雲音樂
#做者zaiden
http://www.cnblogs.com/zaiden

#函數:詢問是否安裝程序
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

#安裝p7zip
ask 7zip
if [ "$yes" = 1 ];then
    checkinstall p7zip
    if  [ "$installed" = 1 ];then
        sudo apt-get install p7zip
        feedback p7zip
    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

根據腳本內提示進行安裝、配置便可

相關文章
相關標籤/搜索