Install all programs from one Manjaro system on another
To install all programs from one Manjaro system on another, you can follow these steps:
Export Package List
On the source Manjaro system:
Open a terminal
Run the following command to export a list of explicitly installed packages:
pacman -Qqe > packages.txt
This will create a file called "packages.txt" containing the names of all explicitly installed packages[1].
Transfer the Package List
Transfer the "packages.txt" file to the target Manjaro system. You can use various methods like USB drive, network transfer, or cloud storage.
Install Packages on Target System
On the target Manjaro system:
Open a terminal
Navigate to the directory containing the "packages.txt" file
Run the following command to install all packages from the list:
sudo pacman -S --needed - < packages.txt
This command will install all packages listed in the file, skipping any that are already installed[1].
Additional Considerations
AUR Packages: The above method only covers official repository packages. For AUR packages, you'll need to install them manually or use an AUR helper like yay[2].
Configuration Files: Remember that this process only installs packages, not their configurations. You may need to transfer configuration files separately.
System Differences: Be aware that some packages might not be compatible if the two systems have different architectures or Manjaro versions.
Updates: After installation, run a system update:
sudo pacman -Syu
Cleaning Up: You might want to remove unnecessary packages on the target system:
sudo pacman -Rns $(pacman -Qtdq)
This process should help you replicate most of the software environment from one Manjaro system to another. However, always review the package list before installation to ensure it's appropriate for the target system[1][2].
While yay doesn't have a direct --needed option like pacman, you can still achieve a similar result using a loop. Here's how you can install packages from a list, skipping those that are already installed:
First, export the list of installed packages from the source system:
yay -Qqe > installed_packages.txt
Transfer the "installed_packages.txt" file to the new Manjaro system.
On the new system, use the following bash script to install packages:
#!/bin/bash
# Function to print a separator line
print_separator() {
echo "========================================"
}
# Function to handle Ctrl+C
ctrl_c() {
echo
echo "Skipping current package..."
return 1
}
# Set up trap for Ctrl+C
trap ctrl_c INT
# Read the file line by line
while IFS= read -r package; do
print_separator
echo "Processing package: $package"
print_separator
if ! yay -Qi "$package" &> /dev/null; then
echo "Installing $package..."
echo "Press Ctrl+C to skip this package."
print_separator
if yay -S --noconfirm "$package"; then
echo "Installation of $package completed."
else
if [ $? -eq 130 ]; then
echo "Installation of $package skipped."
else
echo "Installation of $package failed."
fi
fi
else
echo "$package is already installed. Skipping."
fi
echo # Print an empty line for better readability
done < installed_packages.txt
# Remove the trap
trap - INT
print_separator
echo "All packages processed."
print_separator
This script does the following:
It reads each package name from the "installed_packages.txt" file.
For each package, it checks if it's already installed using yay -Qi.
If the package is not installed, it installs it using yay -S --noconfirm.
If the package is already installed, it skips it and prints a message.
Save this script as "install_packages.sh" and make it executable:
chmod +x install_packages.sh
Then run the script:
./install_packages.sh
Important considerations:
This method will install packages one by one, which may be slower than installing them all at once.
The --noconfirm option is used to avoid prompts, but be cautious as it will automatically accept all default options.
Some AUR packages might still require manual intervention during the build process.
Be aware that not all packages may be compatible with the new system, especially if there are significant differences in hardware or software versions.
This method only installs packages, not their configurations. You'll need to transfer configuration files separately.
By using this approach, you can replicate the functionality of the --needed option while using yay to install packages from both official repositories and the AUR[2].