DEV Community


Posted on

Laravel on Ubuntu 20 in 9 commands

# Update 
apt update

# Install PHP and all the extensions
sudo apt-get install php7.4-{bcmath,bz2,intl,gd,mbstring,mysql,zip,dom} php -y

# Install composer
curl -sS | php -- --install-dir=/usr/local/bin --filename=composer

# Go to web root
cd /var/www/html

# Copy Laravel your laravel project here (we'll create an new example)
composer create-project laravel/laravel

# Edit the apache config
vi /etc/apache2/sites-enabled/000-default.conf

# Change doc root to laravel
- DocumentRoot /var/www/html # From this
+ DocumentRoot /var/www/html/laravel/public # To This

# Reload apache
service apache2 reload

# Set the proper file permissions
chown -R www-data:www-data /var/www/html/
Enter fullscreen mode Exit fullscreen mode

Discussion (0)