Things to Do After Installing Ubuntu
2017-11-27
A quick note. It includes installing packages and configuring the fresh system.
Final update: 2020.01.02
Note:
- You don’t have to
sudo apt updateanymore after adding a apt-key or PPA after Ubuntu 18.04 LTS. aptis equivalent (in most of the cases) toapt-get, so I just writeapt.
Software and Library Installation
TL;DR
Too long; didn’t read version.
Run the following command directly to save (my) time. Check them all first if you are not familiar with them.
1
sudo apt install git emacs vim vim-gtk3 python-apt python-pip python3-pip curl zsh zsh-syntax-highlighting ruby-full cmake silversearcher-ag autojump gir1.2-gtop-2.0 gir1.2-nw-1.0 autotools-dev automake fonts-powerline gtk2-engines-pixbuf gnome-themes-standard chrome-gnome-shell clang
Note: there is high probability that you fail to exectute the command with so many packages to install. You may want to install them separately.
Install through CLI
Add sudo if needed. If you saw agi in the command, it is an alias to “sudo apt-get install”. You can enable this feature after installing Oh-My-Zsh and the Ubuntu plugin.
git
For version control.
1
apt install git
-
Global settings
Change the user name and email before everything else.
1 2 3 4
git config --global user.name "LanternD" git config --global user.email the_email@gmail.com git config --global core.editor emacs git config --global credential.helper cache
curl
A tool to access the url.
1
apt install curl
Terminator
Terminator is a terminal that is better than the default gnome-terminal.
1
apt install terminator
Install the plugin TerminatorThemes by following the instructions on EliverLara/terminator-themes.
And them you can install various themes. The one I am using is SpaceGrey Eighties.
Zsh (Z shell)
An augmented shell, a substitution of the default bash. oh-my-zsh further augments the Zsh with (better) package management.
1
apt install zsh
Follows by oh-my-zsh (Official Github Link).
1
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
After adding ubuntu plugins in zsh, we will have alias agi="sudo apt-get install" in the ~/.zshrc file.
An optional list of missions for zsh:
- Change the theme to
Powerlevel10k - Change the font to Source Code Pro
- Install
zsh-syntax-highlightingplugin - Install
zsh-autosuggestionsplugin - Install
zsh-completionplugins
1
2
3
4
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
Read more at: iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + Powerlevel9k
cmake
Augmented make.
1
apt install cmake
htop
Task monitor.
1
apt install htop
tmux
Deprecared: 2020-01-02. I don’t use tmux anymore
A terminal multiplexer. It helps to manage terminal sessions and windows easily. A must have if you work extensively with CLI.
2018-11-09 Update: If you have Terminator installed, tmux is optional (Their functions overlap).
Link: tmux/tmux - Github
According to the doc, it depends on libevent and ncurses. Usually ncurses is already included in the system, so we just need libevent.
Install libevent:
1
2
3
4
5
6
git clone https://github.com/libevent/libevent.git
cd libevent
mkdir build && cd build
cmake ..
make
sudo make install
Install tmux:
1
2
3
4
5
git clone https://github.com/tmux/tmux.git
cd tmux
sh autogen.sh
./configure && make
sudo make install
Read more:
- A popular tmux configuration by gpakosz.
-
If you want to start
tmuxeach time you start the terminal, add the following two lines to the.zshrcfile.1 2
[[ $- != *i* ]] && return [[ -z "$TMUX" ]] && exec tmux
A note here for myself: should install Dropbox and synchronize everything before proceeding.
pyenv
Link: Pyenv/pyenv - GitHub
A great Python version management tool. You can easily switch between 2.x and 3.x (or whatever) versions globally, with consistent python xxx.py command.
-
Install the required packages first. See here.
1
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev
-
Install
pyenvthrough the official installation script in this link.1
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash -
Don’t forget the add
PATHandevalstuff to the.bashrcor.zshrc(Step 3 in the installation tutorial).1 2 3
export PATH="~/.pyenv/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)"
After the installation, restart the terminal. Use pyenv to install certain python version.
1
2
3
4
5
6
7
8
pyenv install 3.8.0
# wait for a while
pyenv install 2.7.15
# wait for a while
python global 3.8.0
python -V # output 3.8.0
python global 2.7.15
python -V # output 2.7.15
Get ride of every annoying version selection between Python 2.7.x and 3.7.x.
pip
Python package management system. Note that this is for the Python in the system, not the one installed by pyenv. After you switch to the pyenv Python, the pip also changed by itself.
1
2
apt install python-pip python3-pip
sudo pip install --upgrade pip
For Python packages, see my another post.
clang
A language fontend for C and C++.
Link.
1
agi clang clangd clang-format libclang
Note: libclang is for the ccls below.
Emacs (Spacemacs)
Emacs is the “best” editor after configuration, while Spacemacs is best editor and IDE, because it is equipped with evil (a vim emulator).
1
apt install emacs
- Emacs Configuration
-
First
git clonethe.emacs.dto~directory.1
git clone -b develop https://github.com/syl20bnr/spacemacs ~/.emacs.d -
Use symbolic link to create
~/.spacemacs.dfolder. (for my personal use only)1
ln -s ~/Dropbox/Misc_Cfg_Sync/.spacemacs.d ~/.spacemacs.d
(You can put your own Spacemacs configuration in (
~/.spacemacs.dfolder.)
-
Let Emacs daemon starts at the system boot: Start Emacs In Ubuntu The Right Way.
Change the command executed in the emacs.desktop:
sudo vim /usr/share/applications/emacs26.desktop, change the “Exec” row.
1
2
3
4
5
6
7
8
9
10
11
12
[Desktop Entry]
Name=Emacs
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/
Exec=emacsclient -c -a emacs %F
Icon=emacs26
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs
Keywords=Text;Editor;
emacsclient -c -a emacs %F means it tries emacsclient first, it the daemon is not running, it will start emacs GUI.
Some useful alias for Emacs:
1
2
3
4
5
alias emd="emacs --daemon > /dev/null 2>&1"
alias emc="LC_CTYPE=zh_CN.UTF-8 emacs &"
alias emt="emacsclient -t"
alias emx="emacsclient -c -a emacs &"
alias semacs="sudo -E emacs -t"
svn (Optional)
An outdated version control software.
1
agi subversion
vim
Great editor. Need some more configurations.
1
apt install vim vim-gtk3
Seems vim-gtk3 is needed to yank text to system clipboard.
ccls
Link: ccls - Github
A C/C++ LSP (Language Server Protocol) server, based on llvm+clang, for C/C++ development in Spacemacs.
1
2
3
4
git clone --depth=1 --recursive https://github.com/MaskRay/ccls
cd ccls
cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/path/to/clang+llvm-xxx
cmake --build Release
You can enable it by either:
sudo cp ccls /usr/local/bin/cclsexport PATH=/path/to/ccls/Release:$PATH
Sublime Text 3
Official site: Linux Repositories
1
2
3
4
5
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
LaTeX environment (work with Spacemacs)
-
TeXlive
A complete LaTeX distribution, maintained by a group. Cross-plateform, first choice.
1
agi texlive-full
It has 5.0+ GB, so be patient. I recommend you install it in the end.
-
PDF viewer:
Enviceby default in GNOME. -
Spacemacs settings:
SPC SPC customize-variable RET tex-view-program-selection RET, insertevinceasoutput-pdfviewer.
Ruby (for Jekyll)
Tutorial: Ruby Installation
1
agi ruby-full
The packages in ruby:
-
install
jekyll(bundleris required to run jekyll)1 2
sudo gem install jekyll bundler bundle install
-
To run jekyll:
1
bundle exec jekyll serve
Pinyin input method
-
Prequisites
- Install language package in your settings
-
fcitx
Follow this link.
1 2 3
add-apt-repository ppa:fcitx-team/stable apt-get update agi fcitx fcitx-module-cloudpinyin fcitx-googlepinyin fcitx-sunpinyin
[!important]
fcitxonly works inXorgenvironment, make sure you log into that.Let
fcitxstart after loging-in. Usegnome-tweaks-toolto do so. -
Sogou Pinyin Input Method
Tutorial: Sogou Pinyin Official Help
- Make sure
fcitxis installed properly. - Enter
im-configin terminal, set the corresponding items. - Install Sogou Pinyin via the
.debpackage.
- Make sure
-
Add Sogou Pinyin in
fcitxconfigure- Open
fcitx->configure - Click
+button - Uncheck “Only show current language”
- Find “Sogou pinyin”
- Open
gtk missing packages
Sometimes the gtk+ GUI looks ugly, that is because of the missing of some packages, such as pixmap and adwaita.
This can be reproduced by running a software with command line. There will be a warning like:
Gtk-WARNING **: Unable to locate theme engine in module_path: “pixmap”
Gtk-WARNING **: Unable to locate theme engine in module_path: “adwaita”
Install them to solve this issure.
1
2
agi gtk2-engines-pixbuf
agi gnome-themes-standard
ag
Tutorial: the_silver_searcher - Github
A fast code searching tool.
1
agi silversearcher-ag
autojump
A great tool to boost the efficiency. For example, if your project directory is ~/aa/bb/cc/dd/ee/my_project. After you visit there once, you can jump to the your project folder by a simple command j my_project. Fantastic!
1
agi autojump
Shutter
Link: Shutter Project.
One of the best screenshot tools on Ubuntu.
1
agi shutter
If you want to edit the photo after screenshot, you may need a plugin.
Bind the shortcut: See this post.
PostgreSQL (Optional)
Tutorial: How to Install PostgreSQL 10 on Ubuntu 16.04 and 14.04 LTS
-
Installation
Add the Apt Repo to source list in Ubuntu and then sudo install.
1
agi postgresql postgresql-contrib
Python use
psycopg2to manipulate the PostgreSQL database. Do not forget to install it as well.1
pip install psycopg2 -
Setting user info
Tutorial: Setting a password for the
postgresuserUse
psqlcommand and\passwordcommand to do so.Update: it would be less painful to create a new role (user) and use it to create a database.
pgAdmin (Optional)
A python-written program that manages PostgreSQL. Install it using python wheel. Use python in system (not those in pyenv) to install.
1
pip install pgAdmin
This app requires sudo permission to run.
powerline
- Official site: powerline/powerline - GitHub
- Installation: powerline - readthedocs.io
An enhanced status bar for vim, zsh, tmux, etc.
1
pip install powerline-status
ANGRYsearch
Link: ANGRYsearch - Github
File searcher. An “Everything” equivalent on Linux.
Install via .deb file
Google Chrome
Of cause. Link: Chrome.
Dropbox
Use the client provided by Dropbox. Download link.
VNC Viewer
It supports connection from remote computers.
Download, install, login, done. Google Remote Desktop somewhat does not support Ubuntu 17.10.
The VNC Viewer only works under Xorg environment. VNC Connect is the server software required in the computer to be connected to.
Visual Studio Code
Link.
An open source programming IDE provided by Microsoft.
TeXstuidio
Link: texstudio.org.
A substitution if you are not interested in working in Spacemacs. Still need texlive-full installation.
Found the corresponding package for the system in the link.
Other Installation
These packages are installed via ppa or downloaded .tar.gz files. They are not directly accessible or have multiple steps, so you need to click into the website and follow the instructions out there.
- KiCad: an open source schematics and PCB EDA software.
- Sw4STM32: an IDE based on Eclipse. I use it to compile and download STM32 project.
- bladeRF: the driver for the bladeRF software-defined radio.
- Java SE Runtime Environment
- Check the installation walkthrough on WikiHow.
- PyCharm: one of the best Python IDE.
- FileZilla: a file transfer software with multiple protocols supported.
- Zotero: a document management system. It organizes everything perfectly, especially my paper database.
- Installation guide
Zotfile: Link
- Telegram
- Slack
- VNCViewer and VNCServer
- GIMP
- Foxit Reader
- LibreOffice: note the version, make sure you get the latest.
- Visual Studio Code: As a Spacemacs user, I usually do not use VS Code.
Settings
GitHub SSH key
Follow the instructions on these two posts:
Remove Unused Folders in Home
Tutorial: Ubuntu - permanently remove ~/Videos and ~/Public
Change the following:
~/.config/user-dirs.dirs./etc/xdg/user-dirs.conf:enabled=False./etc/xdg/user-dirs.defaults.
Then we can rmdir those folders.
Replace Caps Lock by Ctrl
Tutorial: MovingTheCtrlKey - EmacsWiki
Install GNOME Tweaks and changes the settings: Keyboard & Mouse -> Additional Layout Options -> Caps Lock key behavior -> Caps Lock is also a Ctrl.
Enable vim in sudo mode
In .zshrc file, add:
alias svim="sudo -E vim"
Enable Chinese Character Input in Spacemacs
In .zshrc file, add:
alias emacs_chn="LC_CTYPE=zh_CN.UTF-8 emacs &"
Use emacs_chn to open Spacemacs.
Disable Auto Printer Discovery
Tutorial: How do I disable automatic remote printer installation?
svim /etc/cups/cups-browsed.conf- Add (uncomment) this line:
BrowseProtocols none sudo service cups-browsed restartsudo service cups restart
SSH timeout settings
Prevent the disconnection due to keyboard inactive.
Link: 解决SSH自动断线,无响应的问题
1
2
3
4
sudo vim /etc/ssh/ssh_config
# Add or uncomment the following code at client side
ServerAliveInterval 20
ServerAliveCountMax 999
And
1
2
3
4
sudo vim /etc/ssh/sshd_config
# Uncomment the following code at server side
ClientAliveInterval 30
ClientAliveCountMax 6
(Sometimes this file is not there. You need to create one.)
UI Related
Add Fonts
Tutorial: How To Install New Fonts In Ubuntu 14.04 and 16.04
Font list:
- Source Code Pro
- Operator
- Fira Code
- icon font (For Spacemacs. See NeoTree and all-the-icons GitHub page)
- Chinese fonts
Gnome Extensions
-
We can find plenty of extensions from the official Gnome website:
-
Some of the helpful ones:
-
system-monitor(there is a hyphen in the word). Need to installgirdependencies before installing this extensions.1
agi gir1.2-gtop-2.0 gir1.2-networkmanager-1.0
OpenWeather: A plugin for the live weather conditions.User themes: an extension that changes shell (the top bar) themes from user directory.
-
Beautify the UI
Use ocs-url to install them (see how to install osc-url here).
Theme
-
Install
chrome-gnome-shellfirst:1
apt install chrome-gnome-shell -
Theme: Ant Theme
Icons
- Install
ocs-urlpackage from this website. -
Download the icons theme: Papirus Icons
-
Set the theme and icons in
Gnome-tweak-tool, the one used in setting the Caps Lock key. - Change folder icons:
- Tutorial: Custom icon selection - AskUbuntu
- Key point: the custom icons are in
~/.local/share/icons/. The default icons are in/usr/share/icons/. - Open the properties window for the folder, click the icon and select.
- Change the icon for the following folders: Downloads, Github, Dropbox etc.
ZSH themes (Optional)
Most of the work is done by synchronizing the .oh-my-zsh folder and .zshrc file via Dropbox, the rest things we can do is:
-
Install powerline fonts. powerline/fonts - GitHub
1
agi fonts-powerline
-
Install the powerline plugin (see above).
-
Recommended theme: powerlevel9k.
1
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
Set ZSH_THEME="powerlevel9k/powerlevel9k" in .zshrc.
Remove Redundant Icons and Softwares (Optional)
-
Amazon Link in the docker
1 2
sudo rm -f /usr/share/applications/com.canonical.launcher.amazon.desktop sudo rm -f /usr/share/applications/ubuntu-amazon-default.desktop
-
Firefox browser
(You may keep it in case Google Chrome crashes.)
1
sudo apt-get autoremove firefox firefox-locale-en
Lagacy (not used anymore)
Google Drive
Update: I don’t use Google Drive anymore because it doesn’t officially support Linux.
Bad solution: In Ubuntu Settings, enter Online Accounts, and add Google account. After a while, the files in Google Drive will be synchonized as a mounted folder.
Better solution: the above method is not convenient. Use Grive2 instead.
-
Just follow the instructions. Remember to add the
.griveignorefile before runninggrive -acommand.
GNU Radio
Tutorials: GNURadio - GitHub
Follow the instruction. Use pybombs to install it. It will take care of UHD at the same time.
WhatPulse
A tool for keyboard and mouse input statistic.
Tutorial: WhatPulse Linux Installation
Optional.
- ← Older-STT 861 Theory of Prob and STT I Lecture Note - 12
- STT 861 Theory of Prob and STT I Lecture Note - 13-Newer →