Last active
June 23, 2025 22:10
-
-
Save rederlo/4e20238f3223d7527d048d45539043b1 to your computer and use it in GitHub Desktop.
setup wsl2
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
#!/bin/bash | |
install_dependencies() { | |
echo "Instalando dependências necessárias..." | |
sudo apt update | |
sudo apt install -y software-properties-common network-manager libnss3-tools jq xsel redis-server mysql-server | |
sudo add-apt-repository --yes ppa:ondrej/php | |
sudo apt update | |
sudo apt install zip 7zip unrar | |
sudo apt install -y php8.3 php8.3-cli php8.3-fpm php8.3-mysql php8.3-xml php8.3-mbstring php8.3-curl php8.3-zip php8.3-sqlite3 php8.3-pgsql php8.3-pdo php8.3-gd php8.3-redis | |
sudo apt install -y php8.2 php8.2-cli php8.2-fpm php8.2-mysql php8.2-xml php8.2-mbstring php8.2-curl php8.2-zip php8.2-sqlite3 php8.2-pgsql php8.2-pdo php8.2-gd php8.2-redis | |
sudo apt install -y php8.1 php8.1-cli php8.1-fpm php8.1-mysql php8.1-xml php8.1-mbstring php8.1-curl php8.1-zip php8.1-sqlite3 php8.1-pgsql php8.1-pdo php8.1-gd php8.1-redis | |
} | |
install_composer() { | |
echo "Instalando Composer..." | |
sudo chown -R $(whoami) /usr/local/bin | |
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer | |
if ! grep -qF "\$HOME/.config/composer/vendor/bin" ~/.bashrc; then | |
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc | |
export PATH="$PATH:$HOME/.config/composer/vendor/bin" | |
fi | |
mkdir -p ~/code | |
cd ~/code | |
} | |
install_nvm() { | |
echo "Instalando NVM e Node.js LTS..." | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash | |
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
nvm install --lts | |
update_bashrc | |
} | |
update_bashrc() { | |
# Add aliases to .bashrc | |
{ | |
echo 'alias dev="cd ~/code"' | |
echo 'alias ps="phpstorm64.exe"' | |
echo 'alias cphp="sudo update-alternatives --config php"' | |
echo 'alias use="valet use"' | |
echo 'alias link="valet link"' | |
echo 'alias a="php artisan"' | |
echo 'alias amf="a migrate:fresh"' | |
echo 'alias amfs="a migrate:fresh --seed"' | |
echo 'alias amc="a make:controller"' | |
echo 'alias amm="a make:model -m"' | |
echo 'alias livewire="a make:livewire"' | |
echo 'alias aoc="a optimize:clear"' | |
echo 'alias gclean='\''git branch | grep -v $(git branch --show-current) | xargs git branch -d'\''' | |
echo 'alias gm="git commit -m"' | |
echo 'alias gk="git checkout -b"' | |
echo 'alias gl="git log --all --graph --decorate --oneline --abbrev-commit"' | |
echo 'alias wip='\''git add .;git commit -m '\''wip'\'' > /dev/null'\''' | |
echo 'alias wips='\''git add .;git commit -m '\''wip'\'' > /dev/null;git push'\''' | |
echo "alias cdb='function _cdb(){ mysql -e \"CREATE DATABASE IF NOT EXISTS \$1\"; }; _cdb'" | |
} >> ~/.bashrc | |
source ~/.bashrc | |
} | |
main() { | |
install_dependencies | |
install_composer | |
install_nvm | |
update_bashrc | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment