How to install Laravel framework on Ubuntu
Laravel is appreciated for cutting down on work and allowing developers to do real work.
In this article, TipsMake will learn how to install and set up the Laravel framework on an Ubuntu system.
Condition
- Ubuntu Linux based system
- Terminal Access
- User account with sudo privileges.
Note : The commands in this tutorial are executed on an Ubuntu 20.04 system. All the methods in the tutorial are valid for any Linux based system.
System updates and upgrades
It is best practice to start any installation with an upgraded and up to date system but that is necessary as Laravel does not work with PHP versions lower than 7.2.
To update and upgrade the system, run the following command.
sudo apt update && apt upgrade -y
Install PHP
To install PHP on the system, run the following apt command.
sudo apt install php
Once the installation is done, check the installed version with the following command.
php -v
Now install the PHP extension with the same version using the following command.
sudo apt install php7.4-mbstring php7.4-xml php7.4-zip
Install curl
Run the following command to install curl if you don't already have it installed.
sudo apt install curl
Install Composer
You need Composer to manage dependencies in Laravel.
To install Composer, run the following command.
ccurl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Run the following command with Composer file path to run without sudo privileges.
sudo chown -R $USER /usr/local/bin/composer/
Install Symfony
Laravel typically uses the Symfony framework, so it's best to install it alongside Laravel.
To install Symfony, run the following command.
composer create-project symfony/skeleton testproj
Change to testproj directory and run the following command
run php -S 127.0.0.1:8000 -t public
Open the following link in a browser to verify the installation.
http://localhost:8000/
Install Laravel
Now that everything is up and running, install Laravel using the following composer command.
composer global require laravel/installer
Add Laravel on the path in .bashrc
After installing Laravel, open the .bashrc file.
nano .bashrc
Then add the following line of code at the end of the file.
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
Press Ctrl + O and Ctrl + X to save and exit.
Next start running the file bashrc.
source ~/.bashrc
Create a new Laravel application
Just run the following command to create an application in Laravel.
laravel new [tên ứng dụng]
Navigate to the application directory and run the following composer command.
cd [name of app] composer install
Now, run the following commands to get the encryption key and access the localhost.
php artisan key:generate --ansi php artisan serve
Note the development server link and open it in the browser.
http://localhost:8001
You can see Laravel in action.
You should read it
- How to install Putty SSH Client on Ubuntu 20.04 LTS
- Instructions on how to install Ubuntu on VirtualBox virtual machine
- Instructions to install Ubuntu directly from the hard drive
- How to install Hyper Terminal in Ubuntu 20.04
- How to install Pip in Ubuntu
- How to Install CyberPanel on Ubuntu 20.04
- Instructions for installing Ubuntu on VMware Workstation - Part 2
- 5 things to do when installing Ubuntu on PC
May be interested
- How to enable .NET FrameWork on Windows 10?currently microsoft has provided links to download .net framework installer on their home page, but for those who do not know how to download software from microsoft, or the internet connection speed is not fast ... then try it. follow the following way.
- Fix error 0x800F081F when installing .Net Framework 3.5error 0x800f081f makes you unable to install .net framework. how to fix x800f081f error? please see the instructions for fixing this error of network administrator, very simple but extremely effective.
- Instructions on how to install Ubuntu on VirtualBox virtual machinehave you ever tried to install ubuntu but the computer doesn't have enough space to run? let's tipsmake.com find out the article to guide how to install ubuntu on this virtualbox virtual machine!
- Instructions to install Ubuntu directly from the hard driveubuntu is one of the most popular linux distributions. if you want to install ubuntu, the simplest way is to use the hard drive. follow the article below to see how to do it.
- How to install Hyper Terminal in Ubuntu 20.04hyper is an open source application supported on all three major platforms: windows, linux, and macos. in this tutorial, tipsmake.com will explain how to install hyper terminal in ubuntu system.
- How to install Pip in Ubuntulinux has a lot of package managers. ubuntu not only has apt but also many programming languages that come with its own package manager. pip stands for python packages packages and allows you to easily install packages from python package index (pypi).
- How to install GIMP on Ubuntu 18.04currently, gimp version 2.10.18.1 has been released and is available to install on ubuntu, linux, and we all know gimp is one of the famous free, cross-platform, open source photo editing software. first, in this article, thuthuat.taimienphi.vn will guide you how to install gimp on ubuntu 18.04.
- How to Install CyberPanel on Ubuntu 20.04cyberpanel is a control panel designed to be user-friendly for non-technical users. cyberpanel is easy to learn as it uses a simple layout that most hosting companies are familiar with.
- Instructions for installing Ubuntu on VMware Workstation - Part 2in the previous section of the article, we jointly established vmware and ubuntu desktop. and the next section below, please continue with the steps to install ubuntu desktop on vmware workstation.
- 5 things to do when installing Ubuntu on PCubuntu is a powerful linux distribution suitable for a wide variety of use cases, ideal for both beginners and seasoned linux users.