- 在 CentOS / RHEL 8 上,安裝 Laravel 開發環境!
安裝流程
- 安裝 PHP 套件
# dnf -y module reset php # dnf module enable php:7.4 # dnf module install php
- 切換至資料夾 /opt
# cd /opt
- 安裝 Composer!由 Composer 官網下載檔案,並執行安裝過程:
# 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');"
- 移動 composer.phar 至 /sbin/composer
# mv composer.phar /sbin/composer
- 利用 composer 建立 Laravel 專案
# composer create-project --prefer-dist laravel/laravel phpproject
- 啟動測試:
# cd phpproject # php artisan serve