My Avatar

LanternD's Castle

An electronics enthusiast - survive technically

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:

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

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:

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 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.

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

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:

  1. sudo cp ccls /usr/local/bin/ccls
  2. export 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)

Ruby (for Jekyll)

Tutorial: Ruby Installation

1
agi ruby-full

The packages in ruby:

Pinyin input method

  1. Prequisites

    • Install language package in your settings
  2. 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] fcitx only works in Xorg environment, make sure you log into that.

    Let fcitx start after loging-in. Use gnome-tweaks-tool to do so.

  3. Sogou Pinyin Input Method

    Tutorial: Sogou Pinyin Official Help

    • Make sure fcitx is installed properly.
    • Enter im-config in terminal, set the corresponding items.
    • Install Sogou Pinyin via the .deb package.
  4. Add Sogou Pinyin in fcitx configure

    • Open fcitx -> configure
    • Click + button
    • Uncheck “Only show current language”
    • Find “Sogou pinyin”

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

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

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.

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:

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?

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:

Gnome Extensions

Beautify the UI

Use ocs-url to install them (see how to install osc-url here).

Theme

Icons

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:

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)

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.

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.



Disqus Comment 0