Ubuntu22.04 系统、软件安装与环境配置
Install Ubuntu 22.04
安装Ubuntu 22.04
1. 更新源及软件升级
- change the mirror source to tsinghua
更改ubuntu源为清华源
sudo gedit /etc/apt/sources.list
https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
- sudo apt update 更新系统
- sudo apt upgrade 升级软件
2. 安装搜狗输入法
- add the chinese language support 增加中文支持
- install fcitx 安装fcitx
- *follow the sogou pinyin install instructions 根据指引安装 https://shurufa.sogou.com/linux/guide
3. 安装必要应用软件
-
install VPN 安装VPN
-
install google-chrome 安装Chrome浏览器
-
install Feishu 安装飞书办公软件
-
install WPS 安装WPS办公套件
-
install code 安装VSCODE
-
install Xterminal 安装Xterminal
-
install Zed 安装Zed编辑器 https://zed.dev/download
-
install wezterm [https://github.com/wezterm/wezterm/releases]
配置文件,sudo gedit ~/.wezterm.lua
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This will hold the configuration.
local config = wezterm.config_builder()
-- This is where you actually apply your config choices
-- For example, changing the color scheme:
config.color_scheme = '' -- 你可以在这里填写你喜欢的配色方案,例如 'Gruvbox Dark'
-- 启用右键粘贴功能
config.mouse_bindings = {
{
event = { Down = { streak = 1, button = "Right" } },
mods = "NONE", -- 不需要任何修饰键
action = wezterm.action.PasteFrom("Clipboard"), -- 右键点击时粘贴剪贴板内容
},
}
-- and finally, return the configuration to wezterm
return config
配置右键打开命令行
创建脚本文件
在 ~/.local/share/nautilus/scripts/ 目录下创建一个新的脚本文件,例如 Open Wezterm Here:
mkdir -p ~/.local/share/nautilus/scripts
sudo gedit ~/.local/share/nautilus/scripts/Open\ Wezterm\ Here
编辑脚本内容
将以下内容粘贴到文件中,并保存:
# Convert file:// URI to local path
current_dir=$(echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed 's/^file:\/\///' | sed 's/%20/ /g')
# Open Wezterm in the current directory
wezterm start --cwd "$current_dir"
$NAUTILUS_SCRIPT_CURRENT_URI 是文件管理器传递的当前文件夹路径。
赋予可执行权限
确保脚本有可执行权限:
chmod +x ~/.local/share/nautilus/scripts/Open\ Wezterm\ Here
使用右键菜单打开文件管理器(Nautilus)。
右键点击文件夹空白处,选择 “脚本”,然后选择 “Open Wezterm Here”。
- install fsearch
sudo add-apt-repository ppa:christian-boxdoerfer/fsearch-stable # 添加安装源
sudo apt update && sudo apt upgrade # 更新软件源
sudo apt install fsearch # 安装
fsearch # 打开
配置 Fsearch 搜索路径
打开 Fsearch,添加文件夹(Add Folders)
Edit→Preferences→Database;编辑→选项→数据库】;
添加/目录下的所有文件夹则全局搜索,如果只添加’/home/user’则只搜索用户目录。
-
install flameshot 安装flameshot
sudo apt install flameshot
设置快捷键:
settings -> keyboard -> keyboard shotcut -> custom shortcuts -> +
name: flameshot
cmd: env QT_AUTO_SCREEN_SCALE_FACTOR=1 flameshot gui
key: F1
- install wechat 安装微信
https://linux.weixin.qq.com/en
下载微信图标:https://developers.weixin.qq.com/doc/oplatform/Downloads/Design_Resource.html
保存为WeChat.png
创建微信快捷方式:sudo gedit /usr/share/applications/wechat.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Wechat
Comment=Wechat
Exec=/home/andy/Wechat/WeChatLinux_x86_64.AppImage
Icon=/home/andy/Wechat/WeChat.png
Terminal=false# 如果没有给自己账户root权限就需要这里设为true来启动终端输入密码
StartupNotify=true
Type=Application
Categories=Application;Development;
4. 更改关闭盖子不做任何操作
sudo gedit /etc/systemd/logind.conf
将
#HandleLidSwitch=suspend
更改为
HandleLidSwitch=ignore
注意取消前面的#号。
5. 更改显示方式为X11
sudo gedit /etc/gdm3/custom.conf
修改如下内容,去掉最前面的#号:
#WaylandEnable=false
为
WaylandEnable=false
6. 自动挂载硬盘
点击左下角左应用程序(Win键)-> 选择Disks -> 找到所在的硬盘和分区 -> 点击设置 -> 修改挂载选项(Edit Mount Option)-> 取消User Session Default 勾选
即可实现自动挂载
7. 修改日历选项
使用
locale
查看当前设置的区域
执行
sudo gedit /usr/share/i18n/locales/zh_CN
打开设置,找到
“ first_weekday 2 ” 这一行,将2改成1,周日设置为每周的第一天
使用命令
sudo locale-gen
重新生成 locale 信息
8. 禁用snap
- 删掉所有的已经安装的 Snap 软件
for p in $(snap list | awk '{print $1}'); do
sudo snap remove $p
done
一般需要执行两次(桌面版三次),提示如下则正确执行
snap "Name" is not installed
core20 removed
snapd removed
再次执行,提示如下,表明已经删除干净
No snaps are installed yet. Try 'snap install hello-world'.
- 删除 Snap 的 Core 文件
sudo systemctl stop snapd
sudo systemctl disable --now snapd.socket
for m in /snap/core/*; do
sudo umount $m
done
- 删除 Snap 的管理工具
sudo apt autoremove --purge snapd
- 删除 Snap 的目录
rm -rf ~/snap
sudo rm -rf /snap
sudo rm -rf /var/snap
sudo rm -rf /var/lib/snapd
sudo rm -rf /var/cache/snapd
- 配置 APT 参数:禁止 apt 安装 snapd
sudo sh -c "cat > /etc/apt/preferences.d/no-snapd.pref" << EOL
Package: snapd
Pin: release a=*
Pin-Priority: -10
EOL
a -> Archive
c -> Component
o -> Origin
l -> Label
n -> Architecture
验证效果:可以查询到该包,但是无法安装。
$ apt list snapd
Listing... Done
snapd/jammy-updates 2.56.2+22.04ubuntu1 amd64
N: There is 1 additional version. Please use the '-a' switch to see it
$ sudo apt install snapd
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package snapd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'snapd' has no installation candidate
同时禁用 snap Firefox 的更新
sudo sh -c "cat > /etc/apt/preferences.d/no-firefox.pref" << EOL
Package: firefox
Pin: release a=*
Pin-Priority: -10
EOL
9. 安装Firefox及创建桌面快捷方式
先下载firefox,:https://www.mozilla.org/en-US/firefox/download/thanks/
然后解压到home目录,并在icon文件夹中添加图标:添加图标:https://www.flaticon.com/free-icon/firefox_5968822
创建快捷方式到桌面,创建文件:
sudo gedit /usr/share/applications/firefox.desktop
然后放入一下信息(如果路径不一致自行修改)
[Desktop Entry]
Encoding=UTF-8
Name=Firefox
Comment=Firefox
Exec=/home/andy/firefox/firefox
Icon=/home/andy/firefox/icons/firefox.png
Terminal=false# 如果没有给自己账户root权限就需要这里设为true来启动终端输入密码
StartupNotify=true
Type=Application
Categories=Application;Development;
最后的最后,重启下机器。