Ubuntu 20.04 best configuration guide (required for newbies)

One, system configuration

1、 Turn off sudo password

In order to avoid entering the password every time the sudo command is used, we can turn off the password. Operation method:

1、 Enter the command sudo visudo in the terminal to open visudo;

2、 Find %sudo ALL=(ALL:ALL) ALL and modify it to %sudo ALL=(ALL:ALL) NOPASSWD:ALL

2. Modify software source

The default software source of Ubuntu is overseas, and there will be some problems in speed. We can check it in "So!ware & Updates" (software and updates)
Choose a domestic mirror.

3. Update system

Update the local newspaper database

sudo apt update

Update all installed packages (full-upgrade can also be used)

sudo apt upgrade

Remove unnecessary packages automatically

sudo apt autoremove

Here is a supplement to a commonly used cleanup command:

4. High split screen adaptation

By default, the UI elements appear too small in the high-split screen, so you need to adjust the scale of the interface. Ubuntu20.04 defaults to GNOME desktop
On the other hand, GNOME can enable HiDPI support in Settings>Displays, and adjust the screen ratio by integer multiples. and also
It can be set by the following command:

# scaling-factor can only be set to the integer 1=100%,2=200%3=300%......
gsettings set org.gnome.desktop.interfacescaling-factor 2

With integer zoom settings, UI elements are either too large or too small on some devices, so we need to make further adjustments.
Use the command below to view the Window System (graphics interface protocol) on your Linux device, usually Wayland/X11

echo $XDG_SESSION_TYPE

Wayland

If it is wayland, use the command below to start the experimental non-integer zoom function.

settings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

Then open Settings>Displays again, you can select non-integer zoom (125%, 150%, 175%). Ubuntu20.04 has
A graphical interface is provided in Settings>Displays to enable the experimental non-integer zoom function, so there is no need to go through the above
Command to open.

After I tried it, this method can't set non-integer zoom on my device normally. I judge it is because Ubuntu20.04 silent
The recognized Window System is X11 instead of Wayland. If your device is Wayland, it should be set up normally
of. Or you can choose Ubuntu On Wayland when logging in to the desktop system in theory.

X11

For X11, we can use scaling-factor and xrandr at the same time to achieve non-integer scaling, which can make TTF fonts scaled correctly and prevent blurring when xrandr is used alone. You can use gsettings or in Settings>Displays to specify the zoom factor, and use xrandr to specify the zoom factor.
First, set the boundary zoom factor to the minimum factor of "UI looks too big", usually 2 (200%), if it is not big enough, continue to try 3 or even larger factors. Then use xrandr to set the reduction factor. I set it to 1.25 by myself. If the UI looks too big, I increase the factor, and vice versa. The command is as follows:

xrandr --output DP-4--scale 1.25x1.25

You may encounter warning: output DP-4 not founnd; gnoring when using the above command, or the interface will not change after the command is executed. At this point, you need to execute the xrandr command to view your output parameters (that is, the name of the currently displayed interface, which is connected in the log), just like the DP-4 on my device.

After the command is executed correctly, the UI elements may be too small. Go back to Settings>Displays to see if it is an integer zoom
It is restored to 100%, if it is to re-select a suitable zoom ratio (such as 200%). After restarting, the settings of xrandr will be invalid. We can set up a script to start auto-execution, such as: start-service.sh:

# start-service.sh
#! /bin/bash
xrandr --output DP-4--scale 1.25x1.25
exit 0

Then grant execution permission to start-service.sh

sudo chmod +x start-service.sh

Then search for "sartup Applications" in Ubuntu and add the script:

So far, it can perfectly support 4K screen display.

5. Install Python2

Ubuntu20.04 comes with python3, but some third tools or scripts still use python2, so we need to install it ourselves

apt install python

6. Install Git

apt install git

7. Chinese input method

Since Sogou did not support Ubuntu 20.04 before entering the method, and its support for high-split screens was not very friendly, so no longer toss and choose ibus-libpinyin.

# installation
sudo apt install ibus-libpinyin
sudo apt install ibus-clutter

Then find "Language Support" in the application and change the "Keyboard input method system" to "IBUS". Restart the system, and then add "Chinese (Intelligent Pinyin)" in Settings>Region & Language>Input Sources, then you can use Chinese Enter the method.

⼆. Build your command tool (Terminator && ZSH)

1. Install Terminnator

If you are used to iTerm2 under the Mac platform, you will certainly be obsessed with its split-screen function, but Ubuntu's own Terminal is not easy to use. Fortunately, there are a variety of open source terminals under Linux, but Terminator is more recommended by the individual, which is more powerful than iTerm2, and it also supports split screen.

# installation
sudo add-apt-repository ppa:gnome-terminator
sudo apt update
sudo apt install terminator

The default interface of Terminator is uglier, but the configuration is flexible, and users can adjust it according to their preferences.

2. Configure Shell (install zsh and oh-my-zsh)

Get the Terminal, then configure the Shell. Perform the following commands:

cat /etc/shells

You can see that Ubuntu has built-in various Shells:

/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh

Linux distributions commonly used in the market usually use bash by default, but zsh is much stronger than bash.

# Install zsh
apt install zsh
# Set zsh as the system default shell
sudo chsh -s /bin/zsh

However, the configuration of zsh is too complicated. Fortunately, someone developed oh-my-zsh, which allows us to configure zsh more conveniently.

# Automatic installation, if you have not installed git, you need to install git first
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O -| sh
# Or you can choose to install manually
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

Restart Terminal and you will find the changes.

3. ZSH configuration###

The configuration of zsh is mainly concentrated in the ~/.zshrc file. For example, we can configure aliases for commonly used commands:

alias cls='clear'
alias ll='ls -l'
alias la='ls -a'
alias vi='vim'
alias grep="grep --color=auto"

Or choose the theme of zsh

ZSH_THEME="robbyrussell"

oh-my-zsh has many built-in themes, and the corresponding theme files are stored in the ~/.oh-my-zsh/themes directory. You can follow your preferences
Good choice or edit theme.

4. ZSH plugin installation###

oh-my-zsh also supports various plug-ins, which are stored in the ~/.oh-my-zsh/plugins directory. Here are some recommendations:
autojump: Quickly switch directory plugins

# installation
apt install autojump
# Use
j Document/

zsh-autosuggestions: The command line suggestion plug-in for historical commands

# installation
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-
zsh/custom}/plugins/zsh-autosuggestions

zsh-syntax-highlighting: command line syntax highlighting plugin

# installation
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

After the plug-in is installed, it needs to be used after configuration in the ~/.zshrc file. The configuration is as follows

# turn on~/.zshrc file, find the configuration code as follows, and append the plug-in name
plugins=(Other plugin name autojump zsh-autosuggestions zsh-syntax-highlighting)

5. Interesting commands ⏩小玩具###

After configuring Terminator and ZSH, we can also add some interesting small toys to the command line.
CMatrix(https://github.com/abishekvashok/cmatrix)

Terminal ⿊Customer Empire Screensaver

# installation
sudo apt install cmatrix
# Transport (plus-The lba parameter looks more like a movie, plus-The ol parameter is more like Win/Mac screensaver)
cmatrix

Effect picture:
Steam Locomotive(https://github.com/mtoyoda/sl)

Small terminal animation

# installation
sudo apt install sl
# Transport
sl

Effect picture:

Screenfetch(https://github.com/KittyKatt/screenFetch)

The Bash Screenshot Information Tool, used to display system information and ASCII-based Linux release icons on the terminal

# installation
sudo apt install screenfetch
# Transport
screenfetch

Effect picture:

3. Software installation

1. Install Clash (take a tizi, you know)

Step 1: Go to https://github.com/Dreamacro/clash/releases to download the latest Linux version of Clash, for example: clash-
linux-amd64-v0.19.0.gz. After decompression, you get an executable file clash-linux-amd64-v0.19.0:

tar -zxvf clash-linux-amd64-v0.19.0.gz

Step 2: Use the mv command to move to /usr/local/bin/clash:

sudo mv clash-linux-amd64-v0.19.0/usr/local/bin/clash

Step 3: Enter sudo chmod +x /usr/local/bin/clash in the terminal to add execution permissions;

sudo chmod +x /usr/local/bin/clash

Step 4: The terminal executes the clash command to run clash;

# Run clash
clash

At this time, two files will be generated in the directory /home/{user ID}/.config/clash: config.yaml and Country.mmdb; edit the config.yaml file, configure proxy server information and rules, part The merchant will provide the yaml file, download it and copy it;

Restart clash (close and reopen the terminal, execute the clash command) to load the updated configuration file;

Keep clash running, open the browser to visit clash.razord.top for policy configuration, select proxy line, etc. (you may need to enter the IP, port, and command according to the prompts. The specific content can be viewed in config.yaml;

Continue to keep clash running, set the manual proxy in the system network settings Settings>Network>Network Proxy>Manual (Settings>Network>Proxy>Manual). For configuration information, refer to config.yaml or the terminal output when clash is started. Chi. You can now access the network through clash.

After configuring according to the previous method, you need to open the terminal every time the system starts, execute the clash command, and the terminal cannot be closed, otherwise the entire clash process will end. If you don't want to keep the terminal open forever, you can use the nohup clash command to start the background operation. Or if you want to start clash automatically after booting, you can add the nohup clash command to the end of the start-service.sh script mentioned earlier.

2. Install Typroa (open source MarkDown editor)

# or run:
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE
wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add -
# add Typora's repository
sudo add-apt-repository 'deb https://typora.io/linux ./'
sudo apt update
# install typora
sudo apt install typora

3. JetBrains Whole Family Bucket###

After installing JetBrains ToolBox App, you can install all kinds of IDEs, including Android Studio, without your brain.

4. Installation of other applications###

For the official website that has provided the Ubuntu version .deb installation file, you can download the .deb installation file from the official website and execute the following command to install
Install:

# installation
sudo apt install ./<file>.deb

If you are an earlier Linux release, you need to use the following command to install (the same below):

sudo dpkg -i <file>.deb
sudo apt-get install -f # Install dependencies

Note: Some applications are not controlled by the Scale factor, so even after the Scale is set to 200% in Settings>Displays, the UI elements are still displayed too small in the high-split screen. For example: ZOOM, Easy Cloud Music, etc., in order to solve this problem, you can use the following command to start it, and it can be displayed normally.

# Start zoom, the zoom factor can be adjusted according to your needs
QT_SCALE_FACTOR=2 zoom
# Start Yiyun Music
QT_SCALE_FACTOR=2 netease-cloud-music

5. Use Deepin-Wine to install QQ/TIM/WeChat/Office/...

The official website does not provide the Ubuntu version .deb installation file, but some applications in deepin can be installed using Deepin-Wine.

Wine is a technology that implements part of the Windows system API on the Linux platform, allowing users to use Windows platform applications on the Linux platform without any effort.

deepin-wine is a wine program that has been modified on deepin linux by the deepin community in China, and the community has transplanted many Windows software on deepin-wine, such as WeChat, QQ, TIM, etc.

Someone on github has developed a project deepin-wine-ubuntu, and migrated deepin-wine and various deb packages that are equipped on it to Ubuntu. To install WeChat, QQ and other software, we need to install deep-wine-ubuntu first. The method is as follows:

# ⾸First clone deepin-wine-ubuntu source code to local
git clone [email protected]:wszqkzqk/deepin-wine-ubuntu.git
# Switch to the source directory
cd deepin-wine-ubuntu
# Installation script authorization
sudo chmod +x install_2.8.22.sh
# Install deep-wine-ubuntu
. /install_2.8.22.sh

After the installation of deep-wine-ubuntu is complete, we can download various deb software provided by Deepin Community. The specific installation method is the same as the installation method in Section 4

# installation
sudo apt install ./<file>.deb

Various deb software download addresses provided by Deepin Community:

Software download address
QQ https://mirrors.aliyun.com/deepin/pool/non-free/d/deepin.com.qq.im
TIM https://mirrors.aliyun.com/deepin/pool/non-free/d/deepin.com.qq.o!ice
WeChat https://mirrors.aliyun.com/deepin/pool/non-free/d/deepin.com.wechat

For more installation methods and software addresses, please refer to https://github.com/wszqkzqk/deepin-wine-ubuntu

If your system language is not Chinese, garbled characters will appear in the Chinese text of the software launched by deepin-wine. You need to modify the WINE_CMD in the /opt/deepinwine/tools/run.sh file to: WINE_CMD=“LC_ALL=zh_CN.UTF-8 deepin-wine”

  1. Install software in rmp format

Many softwares only provide installation packages in rmp format, but not in deb format, such as xmind. Therefore, we need to convert it to a deb installation package before installing it. Let's take xmind as an example to see how to operate.

Just like we downloaded the xmind installation package XMind-2020.rpm:

# Add universe warehouse (if not added)
sudo add-apt-repository universe
# Update
sudo apt update
# Install Alien
sudo apt install alien

# will.rpm package is converted to.deb package (the current directory will generate a deb installation package, such as: XMind-2020.deb)
sudo alien XMind-2020.rpm
# installation
sudo dpkg -i XMind-2020.deb

4. Table beautification

1. Install tweek

sudo apt install gnome-tweak-tool

2. Install plug-in extension support###

# Let gnome support plugin extensions
sudo apt install gnome-shell-extensions
# Chrome browser extension support, you can use the browser to install plug-ins
sudo apt install chrome-gnome-shell

3. List of frequently used plugins###

Plug-in name description
Dash to Dock ⃃Custom dock
Screenshot Tool screenshot plugin
Clipboard Indicator Expand the clipboard, you can see the past paste content
Coverflow Alt-Tab modify the Alt-Tab application switching effect
Applications Menu Add applications in the top status bar
OpenWeather top status bar displays weather data
Places Status Indicator Add file directory access to the top status bar
Status Title Bar displays the title of the current window in the top status bar
GTK Title Bar Remove the title bar of non-gtk applications
Hide Top Bar automatically hide the status bar
Transparent Top Bar

More extensions can be found on https://extensions.gnome.org.

4. theme###

Various desktop themes, shell themes, icon themes can be downloaded on GNOME-LOOK
Install desktop or shell themes

# Unzip the downloaded theme file
tar -xvf FileName.tar //Unzip

# Copy the unzipped theme file to/usr/share/themes
sudo cp -r FileName /usr/share/themes

Install icon theme

# Unzip the downloaded theme file
tar -xvf FileName.tar //Unzip

# Copy the unzipped theme file to/usr/share/icons
sudo cp -r FileName /usr/share/icons

Then open Tweeks and select the theme to install.
Insert picture description here

5. wallpaper###

Recommend a website to download 4K 8K ultra-high definition wallpapers:
https://pixabay.com
https://unsplash.com
https://wallpapersite.com
https://wallpapershome.com

Finally, post a beautified table (Applications Theme: SURU++; Icons Theme: Reversal)

Unzip the downloaded theme file

tar -xvf FileName.tar //Unzip

Copy the unzipped theme file to /usr/share/themes

sudo cp -r FileName /usr/share/themes

Five. Use the problem to record the problem

Problem 1: Windows and Ubuntu dual system time is not unified

If you have a dual system, after installing Ubuntu and setting the system time, you will find that the time is not unified when you return to Windows. In order to understand why
Well, we must first understand the basics:

Windows and Unix-like systems (Unix/Linux/Mac) look at system hardware time in different ways:

When you set the time displayed by the system correctly in Ubuntu, the computer hardware time becomes 8 hours subtracted from this time, so when you switch to the Windows system, it is 8 hours slower. This is the reason.

Solution: Change the computer hardware time to the system display time in Ubuntu, that is, disable UTC in Ubuntu

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

Question No.: Ubuntu Cyclic Login

I encountered this problem in Ubuntu 19.10 version. I did not verify it in 20.04 version. I am not sure if there is the same problem.

Before solving the problem, let me add a key knowledge point: Display Manager, which is used to provide graphical login,
Show the user a graphical login interface and handle user authentication. Common display managers in Linux include gdm3, kdm,
LightDM etc:

the reason:

Practical verification, it is preliminarily determined that it is caused by a bug in dgm3 that is triggered by the automatic login in the settings. (Ubuntu19.10 uses the GNOME desktop system by default, and gdm3 is the GNOME display manager)

Solution: Use LightDM to replace gdm3

Step 1: Install LightDM (Since you can’t access the graphical desktop now, you need to use the ctl + alt + F2 shortcut on the login page
Key to enter the command mode, enter the account password to log in, and then use the following command to install)

sudo apt-get install lightdm

After the installation is complete, the system will automatically ask you to select the display manager installed in the current system, and select lightdm.

Step 2: Restart

sudo reboot

After restarting, you can log in normally.

At this time, you will find that the login interface has changed. If you want to switch back to the previous login interface, turn off the automatic login after entering the system, and then implement the following command to select the gdm3 display manager again (restart required) Effective)

sudo dpkg-reconfigure gdm3

It's not that gdm3 bugs can be avoided after the automatic login is closed. This may only apply to the Ubuntu 19.10 I installed; the reason I said does not necessarily apply to everyone. But one thing is certain, if there is a cyclic login, replacing the display manager will usually solve the problem.

If you want to view the display manager currently running on the system, you can use the following command:

cat /etc/X11/default-display-manager

Problem 3: NVIDIA driver repair

Ubuntu 20.04 comes with nvidia graphics driver, but it was broken by my inconvenience. Mainly manifested in:

1、 The xrandr command mentioned above is invalid, and it is impossible to achieve multiple zooming;

2、 NVIDIA X Server Settings client opens blank;

3、 An error occurred when the command was executed when the nvidia-settings command was executed;

4、 You cannot set multiple resolutions and so on in Settings>Displays.

If you have the same problem as me, or want to manually install the graphics card driver, you can follow the steps below. (You need to download the graphics card driver corresponding to your device from the NVIDIA official website first)

# Install some dependent libraries first
sudo apt install build-essential libglvnd-dev pkg-config
# Stop the desktop manager and enter the command line to explore
sudo telinit 3
# Delete the installed nvidia driver
sudo apt purge "nvidia*"
# Manually install the graphics driver
sudo bash NVIDIA-Linux-x86_64-440.82.run
# Reboot
sudo reboot

For more graphics card driver methods, please refer to: https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-ubuntu-20-04-focal-fossa-linux

Reference document:

**Reference link: **

Ubuntu 18.04 installation, configuration and beautification: https://www.cnblogs.com/xiyu714/p/9900525.html

So far, this article about the best configuration guide for Ubuntu 20.04 (required for newbies) is here. For more related Ubuntu 20.04 configuration content, please search for previous articles on ZaLou.Cn or continue to browse related articles below. Hope you will see more in the future. Support ZaLou.Cn!

Recommended Posts

Ubuntu 20.04 best configuration guide (required for newbies)
Ubuntu 20.04 best configuration guide for engineers
Ubuntu 20.04 best configuration guide for engineers
ubuntu 18.04 early configuration
Ubuntu install guide
Ubuntu nfs configuration
ubuntu beautification guide
Ubuntu20.04 configuration notes
Ubuntu 14.04 configuration record
Common exceptions and solutions for Ubuntu system installation and configuration
Manual for Ubuntu Installation
ubuntu configuration python, Red
Ubuntu configuration development environment
Ubuntu 18.04 network card configuration
Ubuntu development environment configuration
Network configuration under Ubuntu
ubuntu iptables firewall guide
023. Ubuntu common personalized configuration