Server版相关
修改 SSH 服务端口
在 Ubuntu 24.04 中, 修改SSH端口不是简单的修改 /etc/ssh/sshd_config 里面的 Port 了, 需要用下面的步骤
执行
systemctl edit ssh.socket
然后会出现编辑框
### Editing /etc/systemd/system/ssh.socket.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file### Edits below this comment will be discarded
...
注意上面的文字提示, 新增加的端口配置如下, 必须放在 ### Anything between here and the comment below
这行下面
[Socket]
ListenStream=
ListenStream=10022
这些内容实际上会写入到新文件 /etc/systemd/system/ssh.socket.d/override.conf 之中, 编辑完可以检查其内容. 然后重启服务就可以了
systemctl daemon-reload
systemctl restart ssh.socket
可以通过netstat -lnp
检查新端口是否已经启用
安装 MySQL 8.0
Ubuntu 24.04 默认 MySQL版本为8.0, 直接用 apt安装
apt install mysql-server
之后可以用 root 直接登入
mysql -uroot
在里面添加带口令的用户, 创建数据库并授权给用户
mysql> create user 'root'@'%' identified by '123123';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;mysql> create user 'dbuser'@'%' identified by '123123';
mysql> create database testdb default character set utf8mb4;
mysql> grant all on testdb.* to 'dbuser'@'%';
修改MySQL服务端口
vi /etc/mysql/mysql.conf.d/mysqld.cnf
# 重启 MySQL
systemctl restart mysql.service
# 检查端口是否已变更
netstat -lnp
安装 Redis
apt安装
apt install redis-server
修改监听网口和端口, 编辑 /etc/redis/redis.conf
# 根据配置文件中的提示, 修改为监听所有
bind * -::*
# 修改端口
port 10379
# 修改口令
requirepass XCsVnAhua123456
重启服务
systemctl restart redis-server.service
桌面版相关
安装智能拼音
先到 Regions and Lanuage, 查看已经安装的语言, 根据提示完成安装, 再到 Keyboard, 但是在24.04中默认没有安装 Intelligent Pinyin, 需要手动安装
sudo apt install ibus-libpinyin
然后重新导入ibus, 再到 Keyboard 中就能找到 Chinese Intelligent Pinyin 了
ibus-daemon -drx
ibus智能拼音存在卡住的问题, 切换后打不出字, 要切换回en后过会儿才能继续打字. ibus-libpinyin/issues/429 出现这种问题的的处理方法(任意一种)
rm -rf ~/.cache/ibus/libpinyin
ibus-daemon -rd
rm -rf ~/.cache/ibus/libpinyin/*.tmp
安装 Asbru Connection Manager
直接用默认的安装方式无法安装 cannot install on Ubuntu 24.04 - package not found #1118, 参考最底下的说明, 用 loki 分支仓库安装
sudo apt install curl
curl -1sLf 'https://dl.cloudsmith.io/public/asbru-cm/loki/cfg/setup/bash.deb.sh' | sudo -E bash
sudo apt update
sudo apt install asbru-cm
替换nautilus 支持 type-ahead
lubomir-brindza 仓库支持最新的 Ubuntu24.04
软件仓库(包含最新说明): https://github.com/lubomir-brindza/nautilus-typeahead
# 添加软件源
sudo add-apt-repository ppa:lubomir-brindza/nautilus-typeahead
# 更新
sudo apt dist-upgrade
# 重启 alt + f2 然后执行
nautilus -r
需要在 Preferences 中关掉 Search on type ahead
增加字体
在 /usr/local/share/fonts 下面新建目录, 例如 custom, 将字体文件放到这个目录下, 然后执行 sudo fc-cache -f -v
禁用 Trackpoint 中键粘贴
使用指点杆时, 默认的中键粘贴非常烦人, 可以通过 xinput 设置将其禁用. 在用户的 home 目录下创建一个文件 .xinput_turn_off_mid_button, 内容
echo 'xinput remap trackpoint mid-button'
trackpoint_id=$(xinput --list | grep 'IBM TrackPoint' | grep -oP '(?<=id\=)[0-9]+')
button_map=$(xinput --get-button-map $trackpoint_id)
new_button_map=$(echo $button_map | sed '0,/2/{s/2/0/}')
xinput --set-button-map $trackpoint_id $new_button_map
然后将其加到启动应用, 按 win 键输入 startup 找到 Startup Application Preferences, 添加一项
- Name: XInput turn off mid-button
- Command: bash /home/[你的用户名]/.xinput_turn_off_mid_button
然后保存. 之后 logout 再登录进来就会生效. 如果没起作用, 可以用命令more /var/log/syslog |grep xinput
查看下系统日志里面报什么错误
禁用CPU睿频
T480使用的八代I5和I7, 在睿频状态下功耗最高能达到44W, 导致CPU温度飙升, 风扇一直转噪声很烦人. 而八代I5/I7在非睿频状态下性能应付日常工作已经够用, 在平时使用时可以将睿频关闭.
查看睿频(turbo)启用状态
cat /sys/devices/system/cpu/intel_pstate/no_turbo
禁用
echo "1" | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo