aimEye

aimEye

Configuration after installing Linux Mint

Recording some common actions performed after installing Linux Mint, with long-term updates. Unless explicitly stated, the commands should work for most distributions that use apt for package management. Suggestions for improvements are welcome.

Change Source#

The default source is generally foreign, changing the source can speed things up significantly. Mint provides a GUI for managing apt sources.

Search for Software Sources in the start menu.

image

Enter your password.

image

For Main and Base, click on the current source to view the list of all sources. The default should be geoip sorted by approximate distance.

image

You can blindly select Tuna, or wait a moment to see which one is faster based on speed test results, then double-click to select.

image

After changing the two sources, click Ok below to regenerate the apt cache.

image

Update software.

sudo apt update # The previous step of clicking ok is this step, can be skipped
sudo apt upgrade

Chinese Input Method#

Search for Input method in the start menu.

1

Click on Simplified Chinese on the left and follow the instructions.

2

Click Install and follow the prompts to install the software. After completion, the input method framework at the top should switch to Fcitx.

3

Log out and log back in. Search and run Fcitx Configuration.

image

Click the + in the lower left corner, uncheck Only Show Current Language, search for pinyin, click Pinyin, and confirm with Ok. After that, you can switch input methods with Ctrl+Space.

image

Common Command Line Programs#

  • vim: Command line text editor, more intuitive than vi
  • git: Version control
  • htop: Monitor processes, CPU, memory status, etc. Personally, I find it more visually appealing than the default top
  • nload: Monitor network speed and traffic
  • aria2: Multi-remote, multi-process (or thread, not entirely clear) accelerated downloads
  • jq: Parse JSON in the command line
  • xclip: Command line <-> clipboard
sudo apt install vim ...
  • rclone: Synchronize files between command line and cloud storage
sudo -v ; curl https://rclone.org/install.sh | sudo bash

Terminal#

Common Scripts#

You can add some common scripts to bash as follows:

vim ~/custom # Paste the common scripts below and save

# Source the custom script at the end of the rc script, executed on each login
echo "source ~/custom" >> ~/.bashrc
echo "source ~/custom" >> ~/.zshrc

Common scripts ~/custom

# Command line to enable/disable proxy (clash default address)
# Use px/upx command to enable/disable command line proxy, effective only if the software used adheres to the command line environment variables below
px() {
  proxy_addr=http://127.0.0.1:7890
  export https_proxy=$proxy_addr http_proxy=$proxy_addr all_proxy=$proxy_addr
}
upx() {
	unset  http_proxy  https_proxy  all_proxy
}

# Copy date to clipboard
cdate() {
  xclip -r -sel clip <<< $(date '+%b %d, %Y')
}

# Complete git add, commit, and push
# gitp {commit message}
gitp() {
	git add *; git commit -m $1; git push
}

# Get the latest release version number of a GitHub project
# ghlrv VSCodium/vscodium
ghlrv() {
  version=$(curl -sL https://api.github.com/repos/$1/releases/latest | jq -r ".tag_name");
  echo $version; 
}

# Create a new blog md with Jekyll, fill in the basic information template
function nb() {
    local cur_date=$(date +%F)
    local cur_time=$(date +%T)
    local local_utc_offset=$(date +%z)
    local title=$*
    file="$cur_date-"${title// /-}".md"
    content="---
layout: post
title: \"$title\"
permalink: /:title/
date: $cur_date $cur_time $local_utc_offset
categories:
tags:
pin: false
published: false
---
"
    if [ ! -f "$file" ]; then
        echo "$content" >> $file
        echo "Blog post created with the title: $title"
    else 
        echo "ERROR: Blog post with the title already exists, try a new title"
    fi
}

# Common command aliases
alias mamba=micromamba
alias conda=micromamba
alias vscode=/usr/bin/code
alias code=codium
alias pa='pre-commit run --all-files'
# -c: Resume a sequentially downloaded file (like from a browser)
# -x: Allow maximum number of connections
# -s: Total number of target connections, aria2 strictly respects the maximum connection number specified by the server. If the server says to create a maximum of two, specifying 16 here will ultimately create 2 connections.
# It should be understood that the final number of connections created is the minimum of -x, -s, and what the server allows.
alias down='aria2c -c -x 16 -s 16 '
alias rclone='rclone --order-by name,desc --transfers=32 --progress'
alias nload='nload -u M' # Default is in Bytes, MB is more visually appealing
alias idea='cd ~/Desktop/software/idea*/bin/; ./idea.sh'

zsh#

sudo apt install -y zsh
cat /etc/shells # List all available shells, should be there
chsh -s /bin/zsh # Switch to zsh

# Install ohmyzsh
px # githubusercontent may be blocked
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
upx

xfce4-terminal#

Hope the terminal has the following features:

  • Immediate copy on selection
  • Infinite scrollback: Output won't be lost when it gets too long
  • Unsafe paste prompt: On one hand, it won't paste and execute immediately, and on the other hand, modifying scripts in GUI is slightly more convenient than in the command line
  • Quake Mode: Hotkey to summon/retract the terminal window that drops down from the top of the screen
  • Lightweight, few dependencies

xfce4 seems to meet the above requirements well.

Installation:

doas apt install xfce4-terminal

Bind a shortcut key to the xfce4-terminal --drop-down command, search for keyboard in the xfce desktop, and set it in Application Shortcuts.

Programming Languages#

Python#

Install micromamba and configure Tsinghua source.

px # githubusercontent may be blocked

"${SHELL}" <(curl -L micro.mamba.pm/install.sh)

cat <<EOF >> ~/.condarc
channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
EOF

cat <<EOF >>~/.config/pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
EOF

upx

Java#

Install the default Java version.

sudo apt install default-jdk # Install the default Java version

You can also specify the Java version, but the version provided by Mint is unlikely to be the latest.

apt-cache search openjdk- | grep -P "jdk " # Search for all Java versions provided by apt
doas apt install openjdk-[version]-jdk # Install the specified version

Switch Java versions.

sudo update-alternatives --config java

image

To install the latest version of Java:

  • Download the jdk deb package from oracle java downloads
  • Install: doas apt install ./jdk-[version]_linux-x64_bin.deb

After installation, update-alternatives should recognize it.

Editors/IDEs#

IDEA#

There is an Idea on Flathub, but it seems to take much longer to install and download, and using Flathub is not very convenient due to its container style.

https://www.jetbrains.com/idea/download/?section=linux

Download from the Intellj website, note that Ultimate is a paid software with a 30-day trial. Scroll down to find the free Community Edition.

After downloading, extract it and run the command ./bin/idea.sh from the extracted root directory to start.

In the welcome screen, you can add Idea to the start menu.

image

Modify Key Bindings#

The easiest way is probably to buy a mechanical keyboard that allows key remapping.

I have two habitual modifications: switching Caps and Tab, right space j/k->Home/End. The second one is quite difficult to achieve without a split space keyboard, mainly focused on the first.

There are generally two types of solutions:

  • Software under the xorg ecosystem: (generally) advantages are high efficiency and few new dependencies; disadvantages are that it is not very convenient to implement and does not support wayland.
  • Other software: advantages are convenience, if chosen correctly, it can be simple and successful at once; disadvantages are many dependencies and the need to run in the background.

After researching the first type of solution for half a day, I remembered one command: reset the keyboard to the US layout

setxkbmap -layout us

There are many options for the second type of solution, reference: https://medium.com/@canadaduane/key-remapping-in-linux-2021-edition-47320999d2aa

Input Remapper successfully swapped Caps and Tab once, but it has about 200MB of Python dependencies during installation. However, the configuration is quite simple and seems to have rich functionality, feeling like a good enough choice.

version=$(ghlrv sezanzeb/input-remapper)
down https://github.com/sezanzeb/input-remapper/releases/download/${version}/input-remapper-${version}.deb
sudo apt install ./input-remapper-${version}.deb
rm input-remapper-${version}.deb

Common Software#

Codium#

Codium is the FOSS build of Microsoft's VSCode.

version=$(ghlrv VSCodium/vscodium)
down https://github.com/VSCodium/vscodium/releases/download/$version/codium_${version}_amd64.deb
doas apt install ./codium_${version}_amd64.deb
rm codium_${version}_amd64.deb

Common plugins:

  • akamud.vscode-theme-onedark
  • ms-python.python

Browser#

Sorted by (my understanding of) privacy protection/fingerprinting from high to low:

Tor Browser: https://www.torproject.org/download

mkdir -p ~/Desktop/software
cd ~/Desktop/software
px

# parse bin and sig url
tor_versions=$(curl -s https://aus1.torproject.org/torbrowser/update_3/release/downloads.json)
bin_url=$(echo $tor_versions | jq -r '.downloads.linux64.ALL.binary')
sig_url=$(echo $tor_versions | jq -r '.downloads.linux64.ALL.sig')
# jq -r # raw output without "

wget $bin_url
tar -xvf tor-browser-linux64-*_ALL.tar.xz
rm tor-browser-linux64-*_ALL.tar.xz

cd tor-browser
./start-tor-browser.desktop --register-app
upx

Mullvad Browser: https://mullvad.net/en/download/browser/linux

mkdir -p ~/Desktop/software
cd ~/Desktop/software
px
wget https://mullvad.net/en/download/browser/linux64/latest
tar -xvf latest
rm latest
cd mullvad-browser
./start-mullvad-browser.desktop --register-app
upx

Libre Wolf: https://librewolf.net/installation/

sudo apt update && sudo apt install -y wget gnupg lsb-release apt-transport-https ca-certificates

distro=$(if echo " una bookworm vanessa focal jammy bullseye vera uma " | grep -q " $(lsb_release -sc) "; then echo $(lsb_release -sc); else echo focal; fi)

wget -O- https://deb.librewolf.net/keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/librewolf.gpg

sudo tee /etc/apt/sources.list.d/librewolf.sources << EOF > /dev/null
Types: deb
URIs: https://deb.librewolf.net
Suites: $distro
Components: main
Architectures: amd64
Signed-By: /usr/share/keyrings/librewolf.gpg
EOF

sudo apt update

sudo apt install librewolf -y

Brave: https://brave.com/linux/

sudo apt install curl

sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list

sudo apt update

sudo apt install brave-browser

Changelog#

  • Sep 21, 2023: First version. Terminal, Python
  • Sep 22, 2023: Change source, Chinese input method
  • Sep 24, 2023: Browser
  • Plans: Chat/meeting, docker, virtual machines, password management, API testing, java development
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.