Go back

Linux Installation and Initial Setup Guide - Part 2

Notes

Please note that this guide is recommended to be used together with the other parts of the series. The previous article is Part 1.

Basic Setup

Installing Basic Utilities

Ubuntu

sudo apt install git curl wget vim btop unzip zip p7zip-full unrar tar xz-utils build-essential
# Not required if you are using KDE
sudo apt install ark

Fedora

sudo dnf install git curl wget vim btop unzip unrar zip p7zip p7zip-plugins tar xz
# Development and compilation tools
sudo dnf group install c-development
# Virtualization packages
sudo dnf install @virtualization
# Not required if you are using KDE
sudo dnf install ark

git: Version control tool (Git).
curl: Transfers data using URLs and supports HTTP(S), FTP, and other protocols.
wget: Another commonly used download utility, especially useful for resuming downloads.
vim: A classic terminal-based text editor.
btop: An interactive system monitor for CPU, RAM, disks, network activity, and processes.
unzip / zip: Extracts and creates ZIP archives.
p7zip / p7zip-plugins: Command-line version of 7-Zip.
unrar: Utility specifically designed for RAR archives, with better compatibility for encrypted and newer RAR formats.
tar: Archiving utility commonly used together with compression tools.
xz: Utilities and libraries for xz/txz compression.
c-development: C compilation packages and development tools.
@virtualization: Virtualization packages.


Flatpak

Ubuntu

Run the following commands to install Flatpak on Ubuntu:

sudo apt install flatpak
# You do not need the following line if you are using GNOME
#sudo apt install gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
reboot

Fedora

Flatpak is included with Fedora by default.


McBopomofo Input Method

Applicable to both Ubuntu and Fedora.

This is a system-wide installation.

Reference:

https://github.com/openvanilla/fcitx5-mcbopomofo/wiki/%E4%BD%BF%E7%94%A8-Flatpak-%E5%AE%89%E8%A3%9D--fcitx5-mcbopomofo

# Optional: On Ubuntu, you can remove IBus using the following command
sudo apt purge ibus
# Logging out is a good idea
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Password authentication may be required
flatpak install flathub org.fcitx.Fcitx5
flatpak install flathub org.fcitx.Fcitx5.Addon.McBopomofo
flatpak run org.fcitx.Fcitx5

Use the following command for configuration:

  • fcitx5-config-qt

You may be prompted to install fcitx5-configtool. Allow it to be installed.

Ubuntu

System-wide installation.

The input method will be installed globally and can be used by all users.

Follow the steps below:

sudo apt install fcitx5 fcitx5-chinese-addons
# Installation instructions for Ubuntu 24.04
# Might not work on Ubuntu 20.04
sudo apt install pkg-config fcitx5 libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev fcitx5-modules-dev cmake extra-cmake-modules gettext libfmt-dev libicu-dev libjson-c-dev

im-config -n fcitx5
sudo apt purge ibus
mkdir ~/Tools && cd ~/Tools

git clone https://github.com/openvanilla/fcitx5-mcbopomofo.git
cd fcitx5-mcbopomofo
  • Ubuntu 20.04

    mkdir -p build
    cd build
    cmake ../ -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DUSE_LEGACY_FCITX5_API=1
    make
    
  • Ubuntu 22.04/24.04

    cmake -B build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
    cmake --build build
    sudo cmake --install build
    
    # After the initial installation, run the following command
    # to make the McBopomofo icon appear in the Fcitx5 menu
    sudo update-icon-caches /usr/share/icons/*
    

Use the following command for configuration:

  • fcitx5-config-qt

You may be prompted to install fcitx5-configtool. Allow it to be installed.

Fedora

This is also a system-wide installation. COPR is used to install the package, and all users will be able to use it after installation.

Follow the steps below:

https://github.com/openvanilla/fcitx5-mcbopomofo/wiki/%E5%A6%82%E4%BD%95%E5%9C%A8-Fedora-%E4%B8%8A%E5%AE%89%E8%A3%9D-fcitx5-mcbopomofo

# If Fcitx5 has not been installed yet, install it first
sudo dnf install fcitx5

sudo dnf copr enable apicalshark/fcitx5-mcbopomofo
sudo dnf install fcitx5-mcbopomofo

On GNOME, automatic startup is already configured by fcitx5-autostart.

On KDE, configure it through:

Keyboard > Virtual Keyboard

Use the following command for configuration:

  • fcitx5-config-qt

You may be prompted to install fcitx5-configtool. Allow it to be installed.

Setting Fcitx5 as the Default Input Method on KDE

On KDE, Fcitx is started by configuring it as the default virtual keyboard.

  • ~/.config/kwinrc
  • [Wayland]
    InputMethod[$e]=/usr/share/applications/fcitx5-wayland-launcher.desktop
    VirtualKeyboardEnabled=true
    

After configuring this, log out and log back in.


Oh My Zsh and Powerlevel10k

Ubuntu

First, install Zsh:

sudo apt install zsh

If the Zsh configuration screen appears, press q to exit.

Fedora

sudo dnf install zsh

If the Zsh configuration screen appears, press q to exit.

The Following Steps Apply to Both Ubuntu and Fedora

Installation for an Individual User

After installation, use the following command to set Zsh as your login shell:

Use chsh -s $(which zsh) and reboot the system.

Log back in before continuing with the following steps.

If the Zsh configuration screen appears, press q to exit.

Next, install Oh My Zsh for the current user:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

After installing Zsh, install Powerlevel10k.

First, download the required fonts:

sudo mkdir -p /usr/local/share/fonts/m/

sudo wget -P /usr/local/share/fonts/m/ "https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf"
sudo wget -P /usr/local/share/fonts/m/ "https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf"
sudo wget -P /usr/local/share/fonts/m/ "https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf"
sudo wget -P /usr/local/share/fonts/m/ "https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf"

Then run the following command to update the font cache:

fc-cache -fv /usr/local/share/fonts

Restart the terminal.

After reopening it, go to:

Open Settings → Edit Current Profile → Appearance

Click Select Font and select MesloLGS NF Regular.

(This may not always be necessary, as the font is usually detected automatically.)

Next, install and download Powerlevel10k:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"

This places Powerlevel10k in the Oh My Zsh themes directory.

Then change the following line in .zshrc to enable it in Oh My Zsh:

ZSH_THEME="powerlevel10k/powerlevel10k"

Follow the on-screen instructions to complete the configuration.

Installation for All Users (System-wide Installation)

After installing Zsh as described above, use the following command to set Zsh as the login shell:

Run chsh -s $(which zsh) and reboot the system.

Log back in before continuing with the following steps.

If the Zsh configuration screen appears, press q to exit.

For a fresh system with only one existing user, follow the steps below.

First, configure newly created users to use Zsh by default:

sudo useradd -D -s /bin/zsh

Next, perform the system-wide installation.

First, clone Oh My Zsh into /usr/share/ohmyzsh:

sudo git clone https://github.com/ohmyzsh/ohmyzsh.git /usr/share/ohmyzsh

Configure the permissions:

# Set root as the owner
sudo chown -R root:root /usr/share/ohmyzsh
# Set directory permissions to 755
sudo find /usr/share/ohmyzsh -type d -exec chmod 755 {} +
# Set file permissions to 755
sudo find /usr/share/ohmyzsh -type f -exec chmod 755 {} +

After installing Zsh, install Powerlevel10k.

First, download the required fonts:

sudo mkdir -p /usr/local/share/fonts/m/

sudo wget -P /usr/local/share/fonts/m/ "https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf"
sudo wget -P /usr/local/share/fonts/m/ "https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf"
sudo wget -P /usr/local/share/fonts/m/ "https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf"
sudo wget -P /usr/local/share/fonts/m/ "https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf"

Then run:

fc-cache -fv /usr/local/share/fonts

Restart the terminal.

After reopening it, go to:

Open Settings → Edit Current Profile → Appearance

Click Select Font and select MesloLGS NF Regular.

(This may not always be necessary, as the font is usually detected automatically.)

Download Powerlevel10k.

Note that this command is different from the Powerlevel10k installation command shown above.

sudo git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "/usr/share/ohmyzsh/custom/themes/powerlevel10k"

Then perform the following steps for the current user:

nano ~/.zshrc

Add:

export ZSH="/usr/share/ohmyzsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
source "$ZSH/oh-my-zsh.sh"

After the installation is complete, configure the template file used for newly created users:

sudo nano /etc/skel/.zshrc

Add:

export ZSH="/usr/share/ohmyzsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
source "$ZSH/oh-my-zsh.sh"

Done.

All newly created users will now have Zsh, Oh My Zsh, and Powerlevel10k configured by default.

SSH Server and Client Setup Guide (Linux Server + Windows Client)

Setting Up an SSH Server on Linux

1. Install the SSH Server

On Fedora, or another distribution that uses dnf, the SSH client is usually installed by default.

The SSH server may not be installed. If it is missing, install it with:

# Install the SSH server
sudo dnf install openssh-server
2. Enable the Firewall and Allow SSH

Check whether the firewall is running:

sudo systemctl status firewalld

If it is not running, enable it and check its status:

sudo systemctl enable --now firewalld
sudo systemctl status firewalld

Then use the following commands to allow SSH traffic through the firewall:

sudo firewall-cmd --add-service=ssh --permanent
sudo firewall-cmd --reload
3. Start and Enable the SSH Server

Use the following commands to start the SSH server and configure it to start automatically at boot:

sudo systemctl enable --now sshd
sudo systemctl status sshd
4. Obtain the SSH Server Public Key Fingerprint

The fingerprint acts as a security identifier that can be used to verify the identity of the server when connecting.

Assuming the server uses the ed25519 algorithm, check the fingerprint with:

ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub

If this key file does not exist on your system, you can use another available server public key file instead.

Record the displayed fingerprint. You will compare it later when connecting from Windows.

At this point, the basic SSH server configuration is complete.

You can now test the connection from Windows.

Logging In with a Password from Windows (Client)

  1. Open PowerShell or Command Prompt.

  2. Enter:

    ssh <username>@<server_ip>
    

    Example:

    ssh testuser@192.168.1.10
    
  3. The first connection will display the server fingerprint.

    Compare it with the fingerprint obtained from the Linux server. If they match, enter yes.

  4. The system will ask for the user’s password. If the login succeeds, the setup is complete.

At this point, basic SSH login and configuration are complete.

Logging In with a Key Pair (Key Pair Authentication)

In addition to password authentication, SSH also supports key-based authentication.

Key-based authentication is more secure than password-only authentication.

The process is:

Generate a key on Windows > Upload the public key to the server > Log in

1. Enable Public Key Authentication on the Server
sudo nano /etc/ssh/sshd_config

Find the following line and make sure it is enabled by removing the comment marker if necessary:

PubkeyAuthentication yes

Save the file and exit.

Then create the SSH directory under the account that will be used for login:

cd ~
mkdir .ssh
2. Generate a Key on Windows
ssh-keygen -t ed25519 -C "my key"

-C specifies a comment.

ed25519 is recommended because it provides strong security and good performance.

By default, the keys are stored in C:\Users\<your_username>\.ssh\.

You can optionally configure a passphrase. Using one is recommended for additional security.

After completion, two files will be generated:

id_ed25519      Private key (keep this on your local machine)
id_ed25519.pub  Public key (upload this to the server)
3. Upload the Public Key to the Server

In PowerShell, run the following commands to copy the public key to the target user’s home directory:

cd C:\Users\<your_username>\.ssh
scp id_ed25519.pub user@<server_ip>:~
4. Deploy the Public Key on the Server

After logging in to Linux, run:

cat ~/id_ed25519.pub
# After running the command above, copy the displayed public key

nano ~/.ssh/authorized_keys
# After running the command above, paste the public key you just copied

chmod 600 ~/.ssh/authorized_keys

sudo systemctl restart sshd

rm -rf ~/id_ed25519.pub

The server will now trust this key.


5. Test Key-Based Login

On Windows:

ssh user@<server_ip>

If you can log in without entering the account password, or if you are only asked for the key passphrase, the key-based authentication setup is working correctly.

Disable Password Authentication (Optional)

For better security, after confirming that key-based authentication works correctly, you can disable password authentication:

sudo nano /etc/ssh/sshd_config

Find:

PasswordAuthentication yes

Change it to the following, removing the comment marker if necessary:

PasswordAuthentication no

Save the file and restart the SSH service:

sudo systemctl restart sshd

Configuration complete.