====== Debian 10 相關設定整理 ======
===== 網路 IP 設定 =====
* 參考
- https://www.debian.org/doc/manuals/debian-reference/ch05.zh-tw.html
- https://kingjoy1235.pixnet.net/blog/post/28565594
- http://note.drx.tw/2008/02/ubuntu-ip.html
* Exp. 更改 IP 設定為 10.20.0.34 sudo vi /etc/network/interfaces
:
allow-hotplug ens18
iface ens18 inet static
addresses 10.20.0.34/24
gateway 10.20.0.254
dns-nameserver 8.8.8.8
修改之後 reboot 重新開機才會正常生效, 之前的 /etc/init.d/networking restart執行後可以完成 ens18 的 IP 設定
* Debian 11 執行 restart 發現沒有正確設定 IP 的狀況, 可透過 ifup ens18方式來解決
===== 更改 hostname =====
* 參考 - https://www.qedev.com/linux/337271.html
* 執行 hostnamectl 設定 hostname Exp. 更改為 pve-devops1
hostnamectl set-hostname pve-devops1
===== 建立使用者命令 =====
* 參考 - https://www.cyberciti.biz/faq/create-a-user-account-on-ubuntu-linux/
* Exp. 建立 localadmin
useradd -s /bin/bash -d /home/localadmin/ -m -G sudo localadmin
passwd localadmin
===== Kernel 更新但重開機仍舊版 =====
* 直接執行 update-grub後再重新開機
* ++看操作紀錄|
root@pve-49:~# update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.114-1-pve
Found initrd image: /boot/initrd.img-5.4.114-1-pve
Found linux image: /boot/vmlinuz-5.4.73-1-pve
Found initrd image: /boot/initrd.img-5.4.73-1-pve
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin
Adding boot menu entry for EFI firmware configuration
done
root@pve-49:~# reboot
++
===== 移除已經不再使用的 Kernel 安裝檔 =====
* 參考 - https://www.tutorialspoint.com/how-to-delete-old-unused-kernels-in-debian-and-ubuntu
- 先確認目前已安裝哪些 Kernel 版本dpkg --list | grep linux-image
* ++看操作紀錄|
# dpkg --list | grep linux-image
ii linux-image-5.10.0-0.bpo.11-amd64 5.10.92-1~bpo10+1 amd64 Linux 5.10 for 64-bit PCs (signed)
ii linux-image-5.10.0-0.bpo.12-amd64 5.10.103-1~bpo10+1 amd64 Linux 5.10 for 64-bit PCs (signed)
ii linux-image-5.10.0-0.bpo.15-amd64 5.10.120-1~bpo10+1 amd64 Linux 5.10 for 64-bit PCs (signed)
ii linux-image-5.10.0-0.bpo.3-amd64 5.10.13-1~bpo10+1 amd64 Linux 5.10 for 64-bit PCs (signed)
ii linux-image-5.10.0-0.bpo.4-amd64 5.10.19-1~bpo10+1 amd64 Linux 5.10 for 64-bit PCs (signed)
ii linux-image-5.10.0-0.bpo.5-amd64 5.10.24-1~bpo10+1 amd64 Linux 5.10 for 64-bit PCs (signed)
ii linux-image-5.10.0-0.bpo.7-amd64 5.10.40-1~bpo10+1 amd64 Linux 5.10 for 64-bit PCs (signed)
ii linux-image-5.10.0-0.bpo.8-amd64 5.10.46-4~bpo10+1 amd64 Linux 5.10 for 64-bit PCs (signed)
ii linux-image-5.10.0-0.bpo.9-amd64 5.10.70-1~bpo10+1 amd64 Linux 5.10 for 64-bit PCs (signed)
ii linux-image-5.10.0-0.deb10.16-amd64 5.10.127-2~bpo10+1 amd64 Linux 5.10 for 64-bit PCs (signed)
rc linux-image-5.4.0-0.bpo.4-amd64 5.4.19-1~bpo10+1 amd64 Linux 5.4 for 64-bit PCs (signed)
ii linux-image-5.6.0-0.bpo.2-amd64 5.6.14-2~bpo10+1 amd64 Linux 5.6 for 64-bit PCs (signed)
ii linux-image-5.7.0-0.bpo.2-amd64 5.7.10-1~bpo10+1 amd64 Linux 5.7 for 64-bit PCs (signed)
ii linux-image-5.8.0-0.bpo.2-amd64 5.8.10-1~bpo10+1 amd64 Linux 5.8 for 64-bit PCs (signed)
ii linux-image-5.9.0-0.bpo.2-amd64 5.9.6-1~bpo10+1 amd64 Linux 5.9 for 64-bit PCs (signed)
ii linux-image-5.9.0-0.bpo.5-amd64 5.9.15-1~bpo10+1 amd64 Linux 5.9 for 64-bit PCs (signed)
ii linux-image-amd64 5.10.127-2~bpo10+1 amd64 Linux for 64-bit PCs (meta-package)
++
- 確認目前使用哪個 Kernel uname -na
* ++看操作紀錄|
# uname -na
Linux pve-omv5-246 5.10.0-0.deb10.16-amd64 #1 SMP Debian 5.10.127-2~bpo10+1 (2022-07-28) x86_64 GNU/Linux
++
- 移除不需要的 Kernel
* 自動清除 : 可使用 apt-get autoremove --purge 來自動清除, 如果無法自動清除就要依照以下方式進行手動清除
* 手動清除 : 可使用 apt-get purge linux-image-[version-number]* 方式來清除, 依照以上的範例, 只要保留現在正在使用的 Kernel - Debian 5.10.127-2~bpo10+1, 可參考一下的作法
apt-get purge linux-image-5.4.*
apt-get purge linux-image-5.6.*
apt-get purge linux-image-5.7.*
apt-get purge linux-image-5.8.*
apt-get purge linux-image-5.9.*
apt-get purge linux-image-5.10.0-0.bpo.*
{{tag>debian}}