aimEye

aimEye

Linux Mint安装后配置

记录安装 Linux Mint 之后常做的一些动作,长期更新。除非明确指出,命令应该都可以用于大多数用 apt 做包管理的发行版。才疏学浅欢迎捉虫。

换源#

默认的源一般是国外的,换源会快很多,Mint 提供了管理 apt 源的 gui。

开始菜单搜索 Software Sources

image

输入密码

image

对 Main 和 Base,分别单击当前源查看所有源列表,默认应该是 geoip 按大致距离排序

image

可以盲选 Tuna,也可以等一会看测速结果哪个快,双击选定

image

两个源换完点下面 Ok 重新生成 apt 缓存

image

更新软件

sudo apt update # 刚才点ok做的就是这一步,可以跳过
sudo apt upgrade

中文输入法#

开始菜单搜索 Input method

1

点左侧简中,按照指引执行。

2

点 Install,跟随弹出的对话框装软件。完成后上方输入法框架切换为 Fcitx。

3

登出,重新登录。搜索运行 Fcitx Configuration

image

点左下角 +,取消Only Show Current Language的选中,搜 pinyin,点 Pinyin,Ok 确定。之后 Ctrl+Space 可以切换输入法

image

常用命令行程序#

  • vim:命令行编辑文本,比 vi 用起来直观一点
  • git:版本管理
  • htop:监控进程,cpu,内存状态等,个人认为比一般默认带的 top 好看一点
  • nload:监控网速,流量
  • aria2:多远端,多进程(还是线程没有弄很清楚,反正可以)加速下载
  • jq:命令行中解析 json
  • xclip:命令行 <-> 贴板
sudo apt install vim ...
  • rclone:命令行和网盘间同步文件
sudo -v ; curl https://rclone.org/install.sh | sudo bash

终端#

常用脚本#

可以用如下方式向 bash 中添加一些常用脚本:

vim ~/custom # 把下面的常用脚本贴进去保存

# 在rc脚本末尾source custom脚本,每次登陆时执行
echo "source ~/custom" >> ~/.bashrc
echo "source ~/custom" >> ~/.zshrc

常用脚本 ~/custom

# 命令行开启/关闭代理(clash默认地址)
# 用 px/upx 命令开启/关闭命令行代理,生效的前提是使用的软件遵从下面的命令行环境变量
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
}

# 复制日期到剪贴板
cdate() {
  xclip -r -sel clip <<< $(date '+%b %d, %Y')
}

# 完成git添加,commit和推送
# gitp {commit message}
gitp() {
	git add *; git commit -m $1; git push
}

# 获取github项目最新release版本号
# ghlrv VSCodium/vscodium
ghlrv() {
  version=$(curl -sL https://api.github.com/repos/$1/releases/latest | jq -r ".tag_name");
  echo $version; 
}

# jekyll创建新的博客md,填写基本信息模板
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 exits, try a new title"
    fi
}

# 常用命令别名
alias mamba=micromamba
alias conda=micromamba
alias vscode=/usr/bin/code
alias code=codium
alias pa='pre-commit run --all-files'
# -c:断点续传一个顺序下载下来的文件(如浏览器下载的)
# -x:允许最大连接数
# -s:目标连接总数,aria2严格尊重服务器端的最多连接数,如果服务器说最多创建两个,这里指定了创建16个,最后会创建2个连接
# 应该可以理解最终创建的连接数是 -x,-s,服务器允许 三者中最小的
alias down='aria2c -c -x 16 -s 16 '
alias rclone='rclone --order-by name,desc --transfers=32 --progress'
alias nload='nload -u M' # 默认是Byte为单位,MB为单位好看些
alias idea='cd ~/Desktop/software/idea*/bin/; ./idea.sh'

zsh#

sudo apt install -y zsh
cat /etc/shells # 列出所有可用的shell,应该有
chsh -s /bin/zsh # 切换到zsh

# 安装ohmyzsh
px # githubusercontent可能被墙
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
upx

xfce4-terminal#

希望终端有下列功能 / 特性:

  • 选中立即复制
  • 无限回滚:输出多时不会被刷没
  • 不安全粘贴弹框:一方面不会粘贴即执行,此外在 gui 中修改脚本比在命令行里稍微方便点
  • Quake Mode:快捷键唤起 / 收回屏幕顶部下拉的终端窗口
  • 轻量,依赖少

感觉 xfce4 很好的满足上述

安装:

doas apt install xfce4-terminal

xfce4-terminal --drop-down 命令绑定一个快捷键,xfce 桌面是搜索 keyboard,在 Application Shortcuts 中设。

编程语言#

Python#

安装 micromamba,配清华源。

px # githubusercontent可能被墙

"${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#

安装默认 Java 版本

sudo apt install default-jdk # 安装默认java版本

也可以指定 java 版本,不过 Mint 提供的大概率不到最新版。

apt-cache search openjdk- | grep -P "jdk " # 搜索apt提供的所有Java版本
doas apt install openjdk-[version]-jdk # 安装指定版本

切换 Java 版本

sudo update-alternatives --config java

image

安装最新版 Java:

安装完成后 update-alternatives 应该可以识别

编辑器 / IDE#

IDEA#

Flathub 上有 Idea,不过感觉安装下载要大很多,因为 FLathub 偏容器的风格用起来也不是太方便。

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

从 Intellj 官网下载,注意 Ultimate 是付费软件,30 天试用。往下滑 Community Edition 是免费的。

下载完成后解压,从解压出的根目录运行 ./bin/idea.sh 命令启动

在欢迎界面可以将 idea 添加到开始菜单

image

修改键位#

最方便的大概是买个可以改键的机械键盘

我有两个习惯的修改:切换 Caps 和 Tab,右空格 j/k->Home/End。第二个不是分体空格的键盘感觉很难实现,主要研究了第一个。

大概两类方案:

  • xorg 生态下的软件:(大概)优点是效率高,新增依赖少;缺点是做起来不是很方便和不支持 wayland
  • 其他软件:优点方便,选对了可能一次成功很简单;缺点是依赖多,需要后台运行

第一类方案研究了半天就记住了一句命令:重置键盘到 us 布局

setxkbmap -layout us

第二类方案比较多,参考:https://medium.com/@canadaduane/key-remapping-in-linux-2021-edition-47320999d2aa

Input Remapper 做 Cpas 和 Tab 的交换一次成功,安装的时候大概有 200m 的 Python 依赖,不过配置很简单,看起来功能比较丰富,感觉不是最好的选择但够好了。

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

常用软件#

Codium#

Codium 是微软 VSCode 的 FOSS build

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

常用插件

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

浏览器#

按照(个人理解的)保护隐私 / 防指纹程度高到低排序

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:初版。终端,Python
  • Sep 22, 2023:换源,中文输入法
  • Sep 24, 2023:浏览器
  • 计划:聊天 / 会议,docker,虚拟机,密码管理,API 测试,java 开发
加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。