This script automates the removal of the slower virtual memory swapfile
and installs/configures zRAM as swap, which provides faster and more modern memory swapping for Linux and Ubuntu-based systems.
- Removes the old and slow
swapfile
- Enables ZRAM as swap using
zram-config
- Installs and activates EarlyOOM (a mechanism that prevents system freezes due to low memory)
- Ubuntu 24.04 and later or derivatives (Kubuntu, Linux Mint, Zorin OS...)
- Clone the repository or download the script and save it to your *Downloads folder:
cd ~/Downloads
wget https://github.com/diogopessoa/ubuntu-zram-setup/blob/main/ubuntu-zram-setup.sh
- Make the script executable:
chmod +x ubuntu-zram-setup.sh
- Run the script as root:
sudo ./ubuntu-zram-setup.sh
You can use the following commands to verify everything was configured correctly:
zramctl
swapon --show
systemctl status zram-config
systemctl status earlyoom
MIT β feel free to use, modify, and contribute!