Last-modified: 2021-09-21 (火) 11:12:57 (278d)

WSL2でLaravel

wsl -l -v
wsl --install -d Ubuntu
wsl --set-version Ubuntu 2
wsl --export Ubuntu Ubuntu_php.tar
wsl --import Ubuntu_php %USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState_php\ Ubuntu_php.tar --version 2
wsl --unregister Ubuntu
del Ubuntu_php.tar
wsl -l -v
wsl -d Ubuntu_php -u user
  • 以下wsl内で実行
# Jaistに変更
sudo sed -i'~' -E "s@http://(..\.)?(archive|security)\.ubuntu\.com/ubuntu@http://ftp.jaist.ac.jp/pub/Linux/ubuntu@g" /etc/apt/sources.list
sudo apt -y update && sudo apt -y full-upgrade
sudo apt -y install php php-bcmath php-mbstring php-xml php-zip
# 確認
php -m
# Composer  https://getcomposer.org/download/
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv  composer.phar /usr/local/bin/composer
# 確認
composer -V
composer global require "laravel/installer"
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bash_profile
. .bash_profile
mkdir dev
cd dev
laravel new example
cd example
php artisan serve

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS