In this section, I want to copy the cleaned version of Debian distribution. I want to separate the development of my softwares. So, I will create one WSL distribution for one software project.
Look at the name of your distribution you want to export.
wsl -l -v
As you can see in this screenshot, we want to export the clean version of Debian
distribution:
You can run this command below to export the distribution.
- Command:
wsl --export <distribution-name> <exported-file-name>.tar
- Example:
wsl --export Debian debian-clean.tar
The example command above will place the debian-clean.tar
file inside your %USERPROFILE%
directory.
Import your exported distribution from the tar file into WSL.
- Command:
wsl --import <new-distribution-name> <path-where-to-save-distribution> <exported-file-name>.tar
- Example:
wsl --import debian-laravel C:\Users\kith\wsl-distributions\debian-laravel .\debian-clean.tar
Setting the default distribution to the new one will make your new distribution easier to activate by calling the wsl
command in your terminal.
- Command:
wsl --setdefault <distribution-name>
- Example:
wsl --setdefault debian-laravel
Type this command to get inside to your WSL terminal.
- Command:
wsl
Notice that debian uses root user instead your user.
add this to /etc/wsl.conf
[network]
generateResolvConf = false
[boot]
systemd = true
[user]
default = ryumada
you can terminate your Debian distribution by typing these commands
- command
wsl --terminate your-debian-distribution
wsl -d your-debian-distribution
- example
wsl --terminate debian-experiment
wsl -d debian-experiment
Sometimes the basic command in default Debian distribution is missing its dependencies. That's why we need to reinstall this packages.
- command
sudo apt install gnupg2 curl wget vim
See this to see the command to install in a quick way. https://github.com/ilikenwf/apt-fast#quick-install
This step will be useful for you to reduce mistakes. It will always ask you when you want to remove, copy, or move file.
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
source: https://serverfault.com/a/373162
Your Debian distribution is ready to use for development. ๐๐
sources: