{"id":8849,"date":"2021-08-03T05:46:25","date_gmt":"2021-08-03T05:46:25","guid":{"rendered":"https:\/\/linuxways.net\/?p=8849"},"modified":"2021-08-03T05:46:25","modified_gmt":"2021-08-03T05:46:25","slug":"how-to-install-laravel-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-laravel-on-ubuntu-20-04\/","title":{"rendered":"How to Install Laravel on Ubuntu 20.04"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>Laravel is an open-source PHP framework that helps you develop web applications easily and fastly.<\/p>\n<p>It follows the model-view-controller pattern and works on top of the Symfony framework.<\/p>\n<p>Laravel provides an abundant command-line interface. Below is the guide on how to install Laravel on Ubuntu 20.04.<\/p>\n<h2>Step 1 &#8211; Installing PHP<\/h2>\n<p>Laravel requires PHP 7.2.5 or newer to be installed. Run apt command:<\/p>\n<pre>$ sudo apt update<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"939\" height=\"264\" class=\"wp-image-8850\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-779.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-779.png 939w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-779-300x84.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-779-768x216.png 768w\" sizes=\"auto, (max-width: 939px) 100vw, 939px\" \/><\/p>\n<p>Then run the following command to install PHP:<\/p>\n<pre>$ sudo apt install php<\/pre>\n<p><strong>Install extension:<\/strong><\/p>\n<pre>$ sudo apt install php7.4-mbstring php7.4-xml php7.4-zip<\/pre>\n<h2>Step 2 &#8211; Installing Composer<\/h2>\n<p>You can use curl:<\/p>\n<pre>$ curl -s<a href=\"https:\/\/www.youtube.com\/redirect?event=video_description&amp;redir_token=QUFFLUhqa19HSEw5aTcxd1doYXpOR1dNN0VZQjJMd0JUUXxBQ3Jtc0tudHhXM0I1ck9VR05BTzJNTHZyQkNnY1I5cGFoeHk4Tkkyc25CNHdvS1pNYnpVWS1KTEpzR1k1TXl2clRLckNDc2I5Qjlob1pWcVYwQmZuTEtmRmJ1RUxIREUzN0t4VHBnRG16MEVtd2Vaa3VkWEJfSQ&amp;q=https%3A%2F%2Fgetcomposer.org%2Finstaller\"> https:\/\/getcomposer.org\/installer<\/a> | php<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"941\" height=\"168\" class=\"wp-image-8851\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-780.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-780.png 941w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-780-300x54.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-780-768x137.png 768w\" sizes=\"auto, (max-width: 941px) 100vw, 941px\" \/><\/p>\n<p>Then you move composer.phar to composer by mv command:<\/p>\n<pre>$ sudo mv composer.phar \/usr\/local\/bin\/composer<\/pre>\n<h2>Step 3 &#8211; Installing Laravel<\/h2>\n<p>Run the following command:<\/p>\n<pre>$ composer global require laravel\/installer<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"941\" height=\"286\" class=\"wp-image-8852\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-781.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-781.png 941w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-781-300x91.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-781-768x233.png 768w\" sizes=\"auto, (max-width: 941px) 100vw, 941px\" \/><\/p>\n<h2>Step 4 &#8211; Open the .bashrc file to edit<\/h2>\n<p>$ nano .bashrc<\/p>\n<p>then write:<\/p>\n<pre>export PATH=\"$PATH:$HOME\/.config\/composer\/vendor\/bin\"<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"946\" height=\"624\" class=\"wp-image-8853\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-12.jpeg\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-12.jpeg 946w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-12-300x198.jpeg 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-12-768x507.jpeg 768w\" sizes=\"auto, (max-width: 946px) 100vw, 946px\" \/><\/p>\n<p>Let\u2019s save the file.<\/p>\n<p>Then run the following command:<\/p>\n<pre>$ source ~\/.bashrc<\/pre>\n<h2>Step 5 &#8211; Create a new Laravel app<\/h2>\n<p>Syntax:<\/p>\n<pre>$ laravel new [name of app]<\/pre>\n<p>Here we will create an application named \u201cfood\u201d:<\/p>\n<pre>$ laravel new food<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"404\" class=\"wp-image-8854\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-782.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-782.png 940w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-782-300x129.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-782-768x330.png 768w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/p>\n<p>Go to application directory:<\/p>\n<pre>$ cd food<\/pre>\n<p>Then generate an encryption key:<\/p>\n<pre>$ php artisan key:generate --ansi<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"941\" height=\"84\" class=\"wp-image-8855\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-783.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-783.png 941w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-783-300x27.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-783-768x69.png 768w\" sizes=\"auto, (max-width: 941px) 100vw, 941px\" \/><\/p>\n<p>Then run the following command to get localhost:<\/p>\n<pre>$ php artisan serve<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"87\" class=\"wp-image-8856\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-13.jpeg\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-13.jpeg 940w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-13-300x28.jpeg 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-13-768x71.jpeg 768w\" sizes=\"auto, (max-width: 940px) 100vw, 940px\" \/><\/p>\n<p>Finally, use localhost to access Laravel.<\/p>\n<h2>Conclusion<\/h2>\n<p>You\u2019ve already gone through the details of how to install Laravel on Ubuntu 20.04.<\/p>\n<p>Thanks for reading.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction Laravel is an open-source PHP framework that helps you develop web applications easily and fastly. It follows the model-view-controller pattern and works on top of the Symfony&hellip;<\/p>","protected":false},"author":1,"featured_media":8956,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[457,100],"class_list":["post-8849","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-laravel","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/8849","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=8849"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/8849\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/8956"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=8849"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=8849"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=8849"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}