Last active
January 20, 2025 10:59
-
-
Save AndreaCovelli/fde03da1360e91432f8ebac003c68563 to your computer and use it in GitHub Desktop.
Setup alpine on wsl 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Add alpine distro to wsl2 | |
| ------------------------- | |
| https://alpinelinux.org/downloads/ (Mini root filesystem) | |
| wsl --import alpine c:\Users\<username>\alpine "file-name" (current directory downloads) | |
| wsl -d alpine | |
| apk update && apk upgrade | |
| apk add alpine-conf nano | |
| setup-user | |
| apk add sudo | |
| echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel | |
| adduser <username> wheel | |
| myUsername=<username> | |
| echo -e "[user]\ndefault=$myUsername" >> /etc/wsl.conf | |
| wsl --terminate alpine | |
| wsl -d alpine | |
| apk add gcc musl-dev bash bash-doc bash-completion ncurses | |
| // bash config | |
| source /etc/bash/bash_completion.sh && cat /etc/bash/bash_completion.sh | |
| bash | |
| nano /etc/passwd // change to /bin/bash from /bin/sh both for root and local users | |
| nano ~/.bashrc | |
| // content of ~/.bashrc | |
| alias update='apk update && apk upgrade' | |
| export HISTTIMEFORMAT="%d/%m/%y %T " | |
| export PS1='\u@\h:\W \$ ' | |
| alias l='ls -CF' | |
| alias la='ls -A' | |
| alias ll='ls -alF' | |
| alias ls='ls --color=auto' | |
| source /etc/bash/bash_completion.sh | |
| export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ " | |
| // | |
| cat ~/.bashrc >> ~/.bash_profile | |
| ------------------------- | |
| References: | |
| https://learn.microsoft.com/en-us/windows/wsl/use-custom-distro | |
| https://wiki.alpinelinux.org/wiki/Setting_up_a_new_user | |
| https://ostechnix.com/add-delete-and-grant-sudo-privileges-to-users-in-alpine-linux/ | |
| https://learn.arm.com/learning-paths/laptops-and-desktops/wsl2/import/ | |
| https://www.cyberciti.biz/faq/alpine-linux-install-bash-using-apk-command/ | |
| https://www.cyberciti.biz/faq/how-to-upgrade-alpine-linux-3-4-to-3-5-xx/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment