This repository covers optional post-install setup tasks and recommended package installations for a Debian Live USB with persistence. It is designed as a follow-up to Part 1: Debian USB with Persistence, which explains how to create a live USB with persistent storage.
Users can choose which steps and software to apply according to their personal preferences. This guide is intended to help streamline the setup process, improve usability, and save time when configuring your Debian Live USB environment.
- Set Passwords
- Manage Specific Packages (Optional)
- Update and Upgrade System
- Install Common Utilities (Optional)
- Install Okular and Remove KDE Connect (Optional)
- Install Web Server and PHP (Optional)
- Install Development Tools (Optional)
- Personal Bash Tweaks (Optional)
- Disable Unnecessary Services at Boot (Optional)
- Set Date and Time
- Live USB Performance and Wear Optimization (Optional)
- Follow Part 1 to create your Debian Live USB with persistence.
- Clone or download this repository.
- Follow the step-by-step instructions in the Markdown files or sections below.
- Customize the steps as needed for your environment.
Note: This guide is meant for Debian 12.x Live USB users. Adjust commands and package names if you are using a different version.
sudo passwd user # Set password for the default user
sudo passwd root # Set root passwordNote: On a Debian 12.4 Live USB (see Part 1 of this guide on GitHub), some applications like Firefox, LibreOffice, and GIMP are pre-installed. Updating and upgrading the system may also upgrade these apps and the system to Debian 12.12, which can take a lot of time. Using
apt-mark holdprevents these specific packages from being upgraded, saving time.
You have two ways to manage these pre-installed packages:
Use apt-mark hold to stop specific packages from being upgraded during system updates:
sudo apt-mark hold firefox-esr-l10n-*
sudo apt-mark hold libreoffice*
sudo apt-mark hold gimp*
sudo apt-mark showholdIf you prefer to remove certain applications entirely (for example, if you only use Gnumeric), you can do so:
sudo apt remove --purge libreoffice* # Keep only Gnumeric
sudo apt remove --purge gimp*
sudo apt remove firefox-esr-l10n-*
sudo apt clean
sudo apt autoremoveTip: Removing unused packages frees up disk space and can speed up future updates.
sudo apt update
sudo apt upgradeCheck system info:
uname -a
cat /etc/debian_version
stat -c %w /
lsblk -o NAME,SIZE,MODEL,MOUNTPOINTExamples of utilities you might install:
sudo apt install -y htop neofetch mate-themes qpdfview qcomicbook gnumeric gnome-calculator gnome-screenshot audacious vlc easytag speedtest-cli filezilla transmission bluefish falkon lynx wget zipUsers can pick and choose packages based on their needs.
Install Okular with extra backends:
sudo apt install -y okular okular-extra-backends
Remove KDE Connect completely:
sudo dpkg --purge kdeconnect
sudo apt remove -y kdeconnect
sudo apt autoremove -y
Note: Okular provides a versatile document viewer with extra backends for better file support, including EPUB for reading novels. KDE Connect is removed in case you don’t need it on a Live USB. The commands to install Okular and remove KDE Connect are included for convenience and were adapted and tested for this Live USB setup.
# Install Apache, PHP, and XML module
sudo apt install -y apache2 php libapache2-mod-php php8.2-xml
# Verify installed PHP packages
apt list --installed php*# Edit Apache ports configuration if you want to change the listening port
sudo nano /etc/apache2/ports.conf
# Example inside ports.conf: Listen 8080
# Set ownership of web files to your user and www-data group
sudo chown -R $USER:www-data /var/www/html
# Create a symbolic link from your web folder to ~/Public/www (optional)
ln -s /var/www/html $HOME/Public/www
# Set directory permissions to 755
sudo find /var/www/html -type d -exec chmod 755 {} \;
# Set file permissions to 644
sudo find /var/www/html -type f -exec chmod 644 {} \;
# Ensure public directory is accessible
chmod 755 $HOME/Public
# Enable Apache mod_rewrite for URL rewriting
sudo a2enmod rewrite
# Restart Apache to apply changes
sudo systemctl restart apache2- $USER is dynamic and ensures commands work for any logged-in user.
- Symbolic link creation is optional; it helps access web files via ~/Public/www.
- Permissions and ownership follow common best practices for a development environment.
- Apache must be restarted for mod_rewrite changes to take effect.
sudo apt install -y nodejs git python3-dev python3-setuptools python3-pip python3-distutils python3.11-dev python3.11-venv virtualenv software-properties-common xvfb libfontconfig1 wkhtmltopdf curlInstall Node.js via NVM:
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.profile
nvm install 18
sudo apt install -y npm
sudo npm install -g yarn live-serverPython adjustments (if needed):
cd /usr/lib/python3.11
sudo mv EXTERNALLY-MANAGED _EXTERNALLY-MANAGED
cdNote: This section is fully optional and intended for users who want a development-ready Live USB. Commands were adapted and tested for this guide, inspired by community instructions from Shashank Shirke, Frappe Discuss.
Customize your shell environment by editing your .bashrc:
# Open .bashrc in your home directory
cd
nano .bashrcAdd your preferred aliases:
# Quick disk info
alias d="lsblk -o NAME,SIZE,MODEL,MOUNTPOINT"
# Clear history and exit
alias h="> ~/.bash_history && history -c && exit"
# Show IP addresses
alias i="hostname -I && ip -br -c addr show"
# Reboot system
alias r="sudo reboot"
# List running services
alias s="systemctl list-units --type=service --state=running"
# Show system and Debian version
alias v="uname -a && cat /etc/debian_version"
# Zip a folder
alias t="zip -r file.zip folder"
# Shutdown system
alias z="sudo shutdown -h now"Customize your prompt (PS1) with colors:
# Green current directory in prompt
PS1='\[\e[1;32m\]${PWD} \$ \[\e[0m\]'Note: Place these lines at the end of your
.bashrcfile to ensure they override previous settings.
After editing, reload .bashrc to apply changes:
source ~/.bashrcOn a Debian 12.x Live USB with persistence, you may see messages or consume resources for services you don’t need, like smartmontools, cups, avahi-daemon, bluetooth, and ModemManager.
sudo systemctl stop cups avahi-daemon bluetooth ModemManager smartmontoolssudo systemctl disable cups avahi-daemon bluetooth ModemManager smartmontoolsNote: This is safe for a Live USB setup. You can re-enable any service later if needed using
sudo systemctl enable <service>.
To manually set the system date and time use:
# sudo timedatectl set-time "YYYY-MM-DD HH:MM:SS"These steps are optional and intended to improve performance and reduce wear on your Debian Live USB. This guide explains how to manually mount temporary files in RAM and enable compressed swap to make your Live USB faster and reduce write cycles.
Mounting /tmp in RAM reduces USB writes and improves speed:
sudo mount -t tmpfs -o size=512M tmpfs /tmpsize=512Msets the maximum size in RAM (adjust as needed).- This mount is temporary and will disappear after reboot unless added to
/etc/fstab.
Mounting /var/log in RAM prevents logs from constantly writing to the USB:
sudo mount -t tmpfs tmpfs /var/log- Logs will disappear after reboot, which is usually acceptable on a Live USB.
- For critical services that require persistent logs, consider syncing selected logs to persistent storage manually.
ZRAM provides compressed swap in RAM, improving performance on systems with limited memory.
If zram-tools is installed:
sudo systemctl enable --now zramswap.service- Once enabled, it automatically starts on each boot.
- If not installed, you can install it via:
sudo apt install zram-toolsYou can create a script to quickly apply all optimizations for the current session:
#!/bin/bash
# Live USB performance & wear optimization
sudo mount -t tmpfs -o size=512M tmpfs /tmp
sudo mount -t tmpfs tmpfs /var/log
if systemctl is-active --quiet zramswap.service; then
echo "zram swap already active."
else
sudo systemctl enable --now zramswap.service
fi
echo "Live USB optimizations applied."- Save this as
liveusb-optimize.shand run with:
chmod +x liveusb-optimize.sh
./liveusb-optimize.shTip: Running it manually helps you understand each step.
/tmpand/var/logmounts disappear on reboot, but ZRAM remains active once enabled.
End of Live USB Optimization Tutorial
This guide is licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0). You are free to share and adapt the material, provided proper credit is given and adaptations are shared under the same license.
- Written, tested, and documented by padiks
- Guidance & formatting help: ChatGPT
- All commands in this guide require a persistent Live USB environment to retain changes.
- Package selection is personal preference; install only what you need.
- For any service changes (Apache, PHP, Node.js), verify paths and permissions according to your setup.
- Users are encouraged to explore additional applications based on their workflow.
This guide is provided as a complete post-install resource. No additional contributions are expected at this time.
Enjoy configuring your Debian Live USB environment!
End of Post-Install Setup Section