This document is an annotated index of popular articles and important information for improving and adding functionalities to the installed Kubuntu system.
- configure ufw firewall
- remove snap and reboot
- update/upgrade
- install graphic driver
- disable crash-reporter that spams logs (apport.service)
- install proprietary media codecs
- improve Battery by installing TLP for Linux
- install additional packages
- configure journalctl log size
#!/bin/bash
# Kubuntu Post-Installation Script
# --- 1. Configure Firewall ---
echo "Configuring UFW firewall..."
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable
sudo ufw status
# --- 2. Remove Snap ---
echo "Removing Snap packages and snapd..."
if snap list | grep -q "."; then
# Dynamically find and remove all installed snaps
for snap in $(snap list | awk 'NR>1 {print $1}'); do
sudo snap remove --purge "$snap"
done
fi
sudo apt-get remove --purge -y snapd plasma-discover-backend-snap
sudo rm -rf ~/snap /snap /var/snap /var/lib/snapd
echo "Snap removal complete. A REBOOT IS REQUIRED."
# reboot
# --- After rebooting ---
# --- 3. System Update & Package Installation ---
echo "Updating system and installing all packages..."
sudo apt-get update
sudo apt-get upgrade --fix-missing -y
# Consolidated package list
sudo apt-get install -y \
kubuntu-restricted-extras \
build-essential curl wget git gnupg lsb-release \
rar unrar zip unzip p7zip-full \
rsync net-tools dnsutils iputils-ping \
htop smartmontools lm-sensors \
tlp tlp-rdw powertop \
acpi pciutils usbutils
# --- 4. Install Graphic Drivers ---
echo "Installing graphic drivers..."
sudo ubuntu-drivers autoinstall
# Optional: Nvidia suspend/resume fix
# Consider applying only if you experience issues.
sudo systemctl disable --now nvidia-hibernate.service nvidia-resume.service nvidia-suspend.service
# The following command forcefully prevents the script from running.
# Use with caution as it modifies a system file.
# sudo sed -i '2i exit 0' /usr/bin/nvidia-sleep.sh
echo "Driver installation complete. A REBOOT IS REQUIRED."
# reboot
# --- After rebooting ---
# --- 5. System Optimizations ---
echo "Applying system optimizations..."
# Disable Apport crash reporter
sudo systemctl disable --now apport.service
sudo systemctl mask apport.service
sudo rm -rf /var/crash/*
# Enable power management and hardware monitoring
sudo systemctl enable --now tlp.service
sudo systemctl enable --now smartd.service
# Persist powertop tunings
sudo tee /etc/systemd/system/powertop.service > /dev/null <<EOF
[Unit]
Description=Powertop tunings
[Service]
Type=oneshot
ExecStart=/usr/sbin/powertop --auto-tune
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now powertop.service
echo "Post-installation tasks complete."
sudo vim /etc/systemd/journald.conf
-----------------------------------
[Journal]
#Storage=auto
#Compress=yes
#Seal=yes
#SplitMode=uid
#SyncIntervalSec=5m
#RateLimitIntervalSec=30s
#RateLimitBurst=10000
SystemMaxUse=200M
SystemKeepFree=50M
SystemMaxFileSize=50M
#SystemMaxFiles=100
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#RuntimeMaxFiles=100
MaxRetentionSec=2week
MaxFileSec=1week
#ForwardToSyslog=no
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
#LineMax=48K
#ReadKMsg=yes
#Audit=yesThanks to:
- Schwarzer Kater aka "The Black Kitten" | Apr 25, 2024
- Silver Moon | June 5, 2023
- bkanhu