仓库源文站点原文


tags: [Ubuntu, Linux] title: Ubuntu 安装与配置记录 last_modified_at: 2023-6-18 slug: ubuntu-install-and-config redirect_from:

- /posts/Ubuntu安装与配置记录

起因

书接上回,完全迁移到了 Ubuntu,最大的感觉就是优化好了很多,bug 少了很多。<del>然后后来又迁移到Arch了。</del>

以下内容是鄙人的意识流大作,我也看不懂

安装前

先备份 Clash,Firefox,*(Markdown 编辑器)的目录,Icalingua++ 的设备信息,以及上次装 Deepin 的软件安装包以跳过一些麻烦步骤

安装

没什么好说的

配置

<del>哈哈,谁看得懂啊</del>

# Ubuntu 22.04
# 代码名 jammy
# sudo apt install *.deb
# 不要打断任何apt/dpkg!!!

sudo su
sudo apt remove libreoffice* gnome-sudoku gnome-mines gnome-mahjongg aisleriot

sudo nano /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# ===================Ctrl+X================

sudo add-apt-repository ppa:apt-fast/stable
sudo apt-get update
sudo apt-get -y install apt-fast

sudo nano /etc/default/grub
DEFAULT--->2 # The Sequence of Windows
TIMEOUT--->3
# ==================Ctrl+X===============
sudo update-grub

## 修改/home下目录名为英文
export LANG=en_US
xdg-user-dirs-gtk-update
## 这里确定转换为英文
export LANG=zh_CN
## 重启后选择否,不再提示


## 右键新建文件夹
sudo mkdir -p ~/Templates
echo "" > ~/Templates/File

## 安装一些东西
sudo tar xvf android-studio-2021.2.1.15-linux.tar.gz -C /usr/local/bin/
sudo cp ../applications/android-studio.desktop /usr/share/applications/
sudo mv /usr/local/bin/android-studio /usr/local/bin/android-studio-PATH
sudo ln -s /usr/local/bin/android-studio-PATH/bin/studio.sh /usr/local/bin/android-studio
sudo tar xvf Clash.for.Windows-0.19.25-x64-linux.tar.gz -C /usr/local/bin/
sudo cp ../applications/Clash.desktop /usr/share/applications/
sudo mv /usr/local/bin/Clash\ for\ Windows-0.19.25-x64-linux/ /usr/local/bin/Clash-PATH
sudo ln -s /usr/local/bin/Clash-PATH/cfw /usr/local/bin/cfw
sudo ln -s /usr/local/bin/Clash-PATH/cfw /usr/local/bin/clash
wget https://raw.fastgit.org/Dreamacro/clash/master/docs/logo.png -O /usr/local/bin/Clash-PATH/clash.png

sudo apt install ncat




### INSTALL FONTS
## INSTALL JetBrainsMono Nerd Font Mono
## https://www.nerdfonts.com/font-downloads
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/JetBrainsMono.zip
unzip JetBrainsMono.zip
sudo mkdir -p /usr/share/fonts/myfonts/JetBrains\ Mono
sudo chmod -R 755 /usr/share/fonts/myfonts/
rm -rf *Compatible.ttf
sudo mv *Mono.ttf /usr/share/fonts/myfonts/JetBrains\ Mono
rm JetBrainsMono.zip
rm -rf *.ttf
## INSTALL noto color emoji
wget https://hub.fastgit.xyz/googlefonts/noto-emoji/raw/main/fonts/NotoColorEmoji.ttf
sudo mv NotoColorEmoji.ttf /usr/share/fonts/myfonts/

mkfontscale
mkfontdir
fc-cache -fv
rm fonts.scale fonts.dir


##fcitx快速输入:改快捷键(在config->附加组件->快速输入中,改为"`");
加入这两项:
mkdir -p ~/.config/fcitx/data/
cd
curl -#C - -O https://raw.githubusercontent.com/levinit/fcitx-emoji/master/QuickPhrase.mb && cat ./QuickPhrase.mb >> ~/.config/fcitx/data/QuickPhrase.mb && rm ./QuickPhrase.mb
wget https://raw.githubusercontent.com/rainlime/fcitx-quick-phrase-emoji/master/QuickPhrase.mb && cat ./QuickPhrase.mb >> ~/.config/fcitx/data/QuickPhrase.mb && rm ./QuickPhrase.mb
## Also need to manual import QuickPhrase.mb in fcitx5-configtool


## 自动挂载NTFS卷:  https://blog.csdn.net/dscn15848078969/article/details/120699888

## shurufa https://zhuanlan.zhihu.com/p/508797663
sudo apt-fast install gnome-tweaks
sudo apt-fast install fcitx5 \
fcitx5-chinese-addons \
fcitx5-frontend-gtk3 fcitx5-frontend-gtk2 \
fcitx5-frontend-qt5 kde-config-fcitx5
mkdir -p ~/.local/share/fcitx5/pinyin/dictionaries/
mv ~/Downloads/zhwiki-20220722.dict ~/.local/share/fcitx5/pinyin/dictionaries/

## SWAP分区
# cat /proc/sys/vm/swappiness
sudo nano /etc/sysctl.conf
# 1024 Kbytes
vm.min_free_kbytes = 409600
# xxxxxuse swap only if free space less than 1GB
# vm.swappiness = 0
# use as less as possible
vm.swappiness = 1
sudo sysctl -p


sudo apt install neovim

设置 -> 键盘 -> 快捷键,更改成喜欢的

efibootmgr,可以删除多余启动项

理论上应该在/home/`whoami`/.mozilla/firefox,但这里是snap
/home/`whoami`/snap/firefox/common/.mozilla/firefox,firefox数据

sudo apt install libnautilus-extension-dev screen

sudo nano /etc/updatedb.conf
排除掉mnt里那些以及ntfs(安装mlocate前先做,要是装的过程中打断,需要sudo dpkg --configure -a)

sudo apt install openssh-server

sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt update
sudo apt install -y neovim

1.下载deb,安装
3.编辑~/.bashrc文件,配置环境变量。
JAVA_HOME=你的java安装路径(eg: /usr/local/jvm/jdk-18)
CLASSPATH=$JAVA_HOME/lib
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH)

sudo apt install gnome-tweaks

sudo apt install 7zip

unzip ghidra_10.1.5_PUBLIC_20220726.zip  -d /usr/local/bin
mv /usr/local/bin/ghidra_10.1.5_PUBLIC /usr/local/bin/ghidra-PATH
ln -s /usr/local/bin/ghidra-PATH/ghidraRun /usr/local/bin/ghidra

tar xvf firefox-103.0.tar.bz2 -C /usr/local/bin/
mv /usr/local/bin/firefox /usr/local/bin/firefox-PATH
ln -s /usr/local/bin/firefox-PATH/firefox-bin /usr/local/bin/firefox

sudo apt install python-is-python3 fsearch
npm config set registry https://registry.npmmirror.com
sudo npm install -g yarn
yarn config set registry registry.npmmirror.com/

sudo add-apt-repository ppa:christian-boxdoerfer/fsearch-stable
sudo apt update
sudo apt install fsearch

nano ~/.bashrc
export PATH=$PATH:/home/`whoami`/.local/bin

sudo apt install python3-distutils-extra
sudo python setup.py install # Menulibre

# 装完微信后
sudo apt --fix-broken install

#配好sshd后
sudo systemctl restart sshd.service

cd /etc/update-motd.d/
sudo nano 00-header,加一条exit 0
sudo nano 10-help-text,加一条exit 0
sudo nano 90-updates-available ,加一条exit 0
sudo nano 00-header,加一条cat /etc/update-motd.d/figleted
figlet Ubuntu\ \ Lenovo | sudo tee figleted

sudo apt install net-tools

痛点

惊喜