Skip to content

Instantly share code, notes, and snippets.

@tomgrv
Last active July 23, 2023 08:34
Show Gist options
  • Save tomgrv/492088f28588ac73f50ef86a9e7acc64 to your computer and use it in GitHub Desktop.
Save tomgrv/492088f28588ac73f50ef86a9e7acc64 to your computer and use it in GitHub Desktop.
Alpine Linux WSL environnement
### RESTART
#cmd> wsl -t alpine
### INSTALLATION
# Logname linux idem logname windows
su
cd
### REMOTE CODE FOR WSL
apk add libstdc++
### INSTALL SSH
apk add openssh rsync
apk add bash keychain
### INSTALL GIT
apk add git curl git-fast-import git-flow
### INSTALL PHP
#apk add php7 php7-fpm php7-opcache php7-gd php7-mysqli php7-zlib php7-curl php7-mysqli php7-fileinfo php7-dom php7-dom php7-tokenizer php7-xml php7-xmlwriter php7-mbstring php7-bcmath php7-ctype php7-json php7-session php7-simplexml php7-pdo_sqlite
#apk add php81 php81-fpm php81-opcache php81-gd php81-mysqli php81-zlib php81-curl php81-mysqli php81-fileinfo php81-dom php81-dom php81-tokenizer php81-xml php81-xmlwriter php81-mbstring php81-bcmath php81-ctype php81-json php81-session php81-simplexml php81-pdo_sqlite
apk add php82 php82-fpm php82-opcache php82-gd php82-mysqli php82-zlib php82-curl php82-mysqli php82-fileinfo php82-dom php82-dom php82-tokenizer php82-xml php82-xmlwriter php82-mbstring php82-bcmath php82-ctype php82-json php82-session php82-simplexml php82-pdo_sqlite php82-phar php82-zip
### INSTALL COMPOSER
apk add composer
### INSTALL NODE
apk add nodejs npm
### INSTALL PYTHON
apk add python3
### INSTALL DOTNET
apk add icu-libs zlib libintl libcurl
### INSTALL ZSH
apk add zsh
### SYNCHRO DES DROITS
cat <<-EOF >> /etc/wsl.conf
[automount]
enabled = true
options = "metadata,umask=22,fmask=11"
EOF
### PREPARE FOR ZSH
echo auth sufficient pam_shells.so > /etc/pam.d/chsh
### RESTART
#cmd> wsl -t alpine
cd
### SYNCHRO DES CLES SSH https://medium.com/@pscheit/use-an-ssh-agent-in-wsl-with-your-ssh-setup-in-windows-10-41756755993e
cat <<-EOF >> ~/.bashrc
/usr/bin/keychain --quiet --nogui /mnt/c/Users/$LOGNAME/.ssh/id_rsa
source $HOME/.keychain/$HOSTNAME-sh
EOF
### INSTALL DOTNET
curl -OLk https://dot.net/v1/dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh --install-dir /usr/share/dotnet -channel STS -version latest
export DOTNET_ROOT=/usr/share/dotnet >> ~/.bashrc
export PATH=$PATH:/usr/share/dotnet:/usr/share/dotnet/tools >> ~/.bashrc
### INSTALL Git git-filter-repo
curl -OLk https://bootstrap.pypa.io/get-pip.py
chmod +x get-pip.py
python3 get-pip.py
pip3 install git-filter-repo
### CONFIGURE GIT ALIASES
git config --global alias.amend '!sh -c "git diff-index --cached --quiet HEAD || git commit --no-verify --amend -C HEAD" - '
git config --global alias.rewind '!sh -c "git reset --soft HEAD^ --" - '
git config --global alias.renameTag '!sh -c "set -e;git tag $2 $1; git tag -d $1;git push origin :refs/tags/$1;git push --tags" - '
git config --global alias.initFrom '!sh -c "git clone --origin template --branch master --depth 1 -- $1 $2 && cd $2 && git branch -m master template && git checkout -b master && git checkout -b develop" - '
### CONFIGURATION GIT
git config --global credential.helper wincred
git config --global core.autocrlf input
cat <<-EOF >> .gitattributes
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
EOF
### INSTALL OhMyZSH
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
### CONFIGURE OhMyZSH
git config --global --add oh-my-zsh.hide-dirty 1
cat <<-EOF >> ~/.zshrc
source ~/.bashrc
EOF
## UPDATE 3.17 to 3.18
su
apk update
apk upgrade
sed -i s/v3.17/v3.18/g /etc/apk/repositories
apk update
apk upgrade --available && sync
### RESTART
#cmd> wsl -t alpine
wsl --shutdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment