<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Laravel Archives - LinuxTuto</title>
	<atom:link href="https://www.linuxtuto.com/tag/laravel/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.linuxtuto.com/tag/laravel/</link>
	<description>Linux Sysadmin and DevOps blog</description>
	<lastBuildDate>Sat, 11 May 2024 16:21:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://www.linuxtuto.com/wp-content/uploads/2022/01/cropped-LT_faveicon-32x32.png</url>
	<title>Laravel Archives - LinuxTuto</title>
	<link>https://www.linuxtuto.com/tag/laravel/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">201456972</site>	<item>
		<title>How to Install Laravel on Debian 12</title>
		<link>https://www.linuxtuto.com/how-to-install-laravel-on-debian-12/</link>
					<comments>https://www.linuxtuto.com/how-to-install-laravel-on-debian-12/#respond</comments>
		
		<dc:creator><![CDATA[LinuxTuto]]></dc:creator>
		<pubDate>Wed, 28 Feb 2024 16:00:38 +0000</pubDate>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Laravel]]></category>
		<category><![CDATA[MariaDB]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://www.linuxtuto.com/?p=1707</guid>

					<description><![CDATA[<p>Laravel is a free, open-source PHP web application framework used for web development. It follows the Model-View-Controller (MVC) architectural pattern and provides an elegant syntax...</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-laravel-on-debian-12/">How to Install Laravel on Debian 12</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Laravel is a free, open-source PHP web application framework used for web development. It follows the Model-View-Controller (MVC) architectural pattern and provides an elegant syntax and tools for tasks such as routing, templating, authentication, and more. Laravel aims to make web development tasks more enjoyable and efficient by providing a clean and expressive syntax, along with a set of conventions and tools for common tasks.</p>
<p>Laravel has gained popularity in the PHP development community due to its elegant syntax, developer-friendly features, and active community. It is widely used for building web applications, APIs, and various other web-based projects.</p>
<p>In this tutorial, we will show you how to install Laravel on Debian 12 OS with Nginx web server and MariaDB database server.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Step 1: Update Operating System</span></h2>
<p>The first step is to ensure that your system is up-to-date. You can do this by running the following command:</p>
<pre><code># apt update &amp;&amp; apt upgrade</code></pre>
<p>Also, install necessary packages.</p>
<pre><code translate="no"># apt install sudo nano wget unzip zip</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 2: Install Nginx Web Server</span></h2>
<p>To install Nginx web server, run the following command:</p>
<pre><code># apt install nginx</code></pre>
<p>You can start the Nginx service and configure it to run on startup by entering the following commands:</p>
<pre><code># systemctl start nginx
# systemctl enable nginx</code></pre>
<p>Verify the status of the Nginx service using <strong>systemctl status</strong> command:</p>
<pre><code># systemctl status nginx</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 3: </span><span class="has-inline-color has-vivid-purple-color">Install PHP and PHP extensions</span></h2>
<p>To install PHP and additional PHP modules to support Laravel, run the following command:</p>
<pre><code># apt install php php-cli php-common php-json php-gmp php-fpm php-xmlrpc php-bcmath php-imagick php-curl php-zip php-gd php-mysql php-xml php-mbstring php-xmlrpc php-intl</code></pre>
<p>Verify if PHP is installed.</p>
<pre><code># php -v</code></pre>
<pre><code><strong>Output:</strong>
PHP 8.2.7 (cli) (built: Jun  9 2023 19:37:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies
</code></pre>
<p>After installing all the packages, edit the php.ini file:</p>
<pre><code># nano /etc/php/8.2/fpm/php.ini</code></pre>
<p>Change the following settings per your requirements:</p>
<pre><code>max_execution_time = 300
memory_limit = 512M
post_max_size = 128M
upload_max_filesize = 128M
date.timezone = America/Chicago</code></pre>
<p>To implement the changes, restart the <code>php-fpm</code> service:</p>
<pre><code># systemctl restart php8.2-fpm</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 4: Install MariaDB and create a database</span></h2>
<p>You can <a href="https://www.linuxtuto.com/how-to-install-mariadb-10-7-on-debian-11/">install MariaDB</a> with the following command:</p>
<pre><code># apt install mariadb-server mariadb-client</code></pre>
<p>Start the database server daemon, and also enable it to start automatically at the next boot with the following commands:</p>
<pre><code># systemctl start mariadb
# systemctl enable mariadb</code></pre>
<p>Once the database server is installed, log into the MariaDB prompt:</p>
<pre><code># mysql -u root</code></pre>
<p>To create a database, database user, and grant all privileges to the database user run the following commands:</p>
<pre><code>MariaDB [(none)]&gt; CREATE DATABASE laravel_db;
MariaDB [(none)]&gt; CREATE USER 'laravel_user'@'localhost' IDENTIFIED BY 'Str0ngPa$$word';
MariaDB [(none)]&gt; GRANT ALL ON laravel_db.* TO 'laravel_user'@'localhost';
MariaDB [(none)]&gt; FLUSH PRIVILEGES;
MariaDB [(none)]&gt; EXIT</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 5: Install Composer dependency manager</span></h2>
<p>To install Composer, run the following commands:</p>
<pre><code># curl -sS https://getcomposer.org/installer | php
# mv composer.phar /usr/local/bin/composer</code></pre>
<p>Verify that Composer has been installed successfully by running the following command:</p>
<pre><code># composer --version
Composer version 2.5.8 2023-06-09 17:13:21</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 6: Install Laravel </span></h2>
<p>Navigate to the <code>webroot</code> directory, type:</p>
<pre class="wp-block-preformatted"><code># cd /var/www/html</code></pre>
<p>Now, install Laravel using the composer command, type:</p>
<pre class="wp-block-preformatted"><code># composer create-project laravel/laravel laravelapp</code></pre>
<p>The command creates a new directory called <code>laravelapp</code> and installs all the files and directories for Laravel.</p>
<p>Change the ownership of the Laravel directory to the webserver user and also the permissions:</p>
<pre class="wp-block-preformatted"><code># chown -R www-data:www-data /var/www/html/laravelapp
# chmod -R 775 /var/www/html/laravelapp/storage</code></pre>
<p>Once the installation is done navigate to the installation directory and check the Laravel version:</p>
<pre><code># cd laravelapp</code></pre>
<pre><code># php artisan</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 7: Configure Nginx Web Server for Laravel</span></h2>
<p>Navigate to <code>/etc/nginx/conf.d</code> directory and run the following command to create a configuration file:</p>
<pre><code class="hljs shell"><span class="bash"># nano /etc/nginx/conf.d/laravel.conf</span></code></pre>
<p>Add the following content:</p>
<pre><code>server {
    listen 80;
    listen [::]:80;
    server_name your-domain.com;
    root /var/www/html/laravelapp/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";

    index index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}
</code></pre>
<p>Save the file and Exit.</p>
<p>Check Nginx syntax:</p>
<pre><code># /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
</code></pre>
<p>To implement the changes, restart Nginx webserver:</p>
<pre><code># systemctl restart nginx</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 8: Access your Laravel Application</span></h2>
<p>Open your browser and type your domain e.g <strong>http://your-domain.com</strong></p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-large wp-image-1708" src="https://www.linuxtuto.com/wp-content/uploads/2024/02/laravel_debian12-900x508.webp" alt="Install Laravel on Debian 12" width="900" height="508" srcset="https://www.linuxtuto.com/wp-content/uploads/2024/02/laravel_debian12-900x508.webp 900w, https://www.linuxtuto.com/wp-content/uploads/2024/02/laravel_debian12-300x169.webp 300w, https://www.linuxtuto.com/wp-content/uploads/2024/02/laravel_debian12-768x433.webp 768w, https://www.linuxtuto.com/wp-content/uploads/2024/02/laravel_debian12-1536x866.webp 1536w, https://www.linuxtuto.com/wp-content/uploads/2024/02/laravel_debian12-1222x689.webp 1222w, https://www.linuxtuto.com/wp-content/uploads/2024/02/laravel_debian12-897x506.webp 897w, https://www.linuxtuto.com/wp-content/uploads/2024/02/laravel_debian12-684x386.webp 684w, https://www.linuxtuto.com/wp-content/uploads/2024/02/laravel_debian12.webp 1915w" sizes="(max-width: 900px) 100vw, 900px" /></p>
<h2><span class="has-inline-color has-vivid-purple-color">Comments and Conclusion</span></h2>
<p>That’s it. You have successfully installed Laravel on Debian 12.</p>
<p>For additional help or useful information, we recommend you to check  <a href="https://laravel.com/docs" target="_blank" rel="noopener">the official Laravel documentation.</a></p>
<p>If you have any questions please leave a comment below.</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-laravel-on-debian-12/">How to Install Laravel on Debian 12</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.linuxtuto.com/how-to-install-laravel-on-debian-12/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1707</post-id>	</item>
		<item>
		<title>How to Install Laravel 9 on Debian 11</title>
		<link>https://www.linuxtuto.com/how-to-install-laravel-9-on-debian-11/</link>
					<comments>https://www.linuxtuto.com/how-to-install-laravel-9-on-debian-11/#comments</comments>
		
		<dc:creator><![CDATA[LinuxTuto]]></dc:creator>
		<pubDate>Fri, 11 Feb 2022 15:56:47 +0000</pubDate>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Laravel]]></category>
		<guid isPermaLink="false">https://www.linuxtuto.com/?p=245</guid>

					<description><![CDATA[<p>Laravel is a popular open source web framework built for PHP developer. It’s an MVC framework for building simple to complex web applications using the PHP...</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-laravel-9-on-debian-11/">How to Install Laravel 9 on Debian 11</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Laravel is a popular open source web framework built for PHP developer. It’s an MVC framework for building simple to complex web applications using the PHP programming language, and it strictly follows the MVC (model–view–controller) architectural pattern.</p>
<p>In this tutorial we will show you how to install <strong>Laravel 9 (LTS)</strong> on Debian 11.</p>
<h2><span class="has-inline-color has-vivid-purple-color">System prerequisites</span></h2>
<p>Your system will need to satisfy the requirements below before proceeding.</p>
<ul>
<li>Apache Web server</li>
<li>MySQL/MariaDB</li>
<li>PHP &gt;= 8.0.2 with OpenSSL, PDO, Mbstring, Tokenizer, XML, Ctype and JSON PHP Extensions.</li>
<li>Composer – an application-level package manager for the PHP</li>
</ul>
<h2><span class="has-inline-color has-vivid-purple-color">Update Operating System</span></h2>
<p>Update your <strong>Debian 11</strong> operating system to make sure all existing packages are up to date:</p>
<pre><code>$ sudo apt update &amp;&amp; sudo apt upgrade -y</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Install Apache web server</span></h2>
<p>To install Apache web server, run the following command:</p>
<pre class="wp-block-preformatted"><code>$ sudo apt install apache2</code></pre>
<p>Once installed, Apache should be running. If it&#8217;s not, for whatever reason, start it:</p>
<pre class="wp-block-preformatted"><code>$ sudo systemctl start apache2</code></pre>
<p>Then enable it to start on boot time.</p>
<pre id="block-4782f1be-6f77-4452-9ca3-8890ce349fb7" class="wp-block-code"><code>$ sudo systemctl enable apache2</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Install PHP and PHP extensions for Laravel Application</span></h2>
<p>First and most importantly, Laravel 9 requires the <a href="https://www.linuxtuto.com/how-to-install-php-8-1-on-debian-11/">latest PHP 8.</a></p>
<p>By default, PHP 8.1 is not included in the Debian 11 default repository. So you will need to add the <a href="https://deb.sury.org/" target="_blank" rel="noreferrer noopener">DEB.SURY.ORG</a> repository to APT.</p>
<p>First, install the required packages using the following command:</p>
<pre><code>$ sudo apt-get install ca-certificates apt-transport-https software-properties-common -y</code></pre>
<p>Once all the packages are installed, add a Sury repository to APT using the following command:</p>
<pre><code>$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list</code></pre>
<p>Next, download and add the GPG key with the following command:</p>
<pre><code>$ wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add -</code></pre>
<p>Once you are done, update the repository with the following command:</p>
<pre><code>$ apt-get update -y</code></pre>
<p>Now, you can install the PHP 8.1 using the following command:</p>
<pre><code>$ sudo apt-get install php8.1 libapache2-mod-php php8.1-dev php8.1-zip php8.1-curl php8.1-mbstring php8.1-mysql php8.1-gd php8.1-xml</code></pre>
<p>Verify if PHP is installed.</p>
<pre class="wp-block-code"><code>php -v</code></pre>
<pre class="wp-block-code"><code>Output:
PHP 8.1.2 (cli) (built: Jan 27 2022 12:22:31) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies
</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Install MariaDB and create a database</span></h2>
<p>You can install MariaDB with the following command:</p>
<pre><code>$ sudo apt install mariadb-server mariadb-client</code></pre>
<p><strong>Note:</strong> If you want newer version of MariaDB you can <a href="https://www.linuxtuto.com/how-to-install-mariadb-10-7-on-debian-11/" target="_blank" rel="noopener noreferrer">follow our tutorial here</a>.</p>
<p>Start the database server daemon, and also enable it to start automatically at the next boot with the following commands:</p>
<pre><code>$ systemctl start mariadb
$ systemctl enable mariadb</code></pre>
<p>Once the database server is installed, log into the MariaDB prompt:</p>
<pre><code>$ sudo  mysql -u root -p</code></pre>
<p>To create a database, database user, and grant all privileges to the database user run the following commands:</p>
<pre><code>MariaDB [(none)]&gt; CREATE DATABASE laravel_db;
MariaDB [(none)]&gt; CREATE USER 'laravel_user'@'localhost' IDENTIFIED BY 'Password';
MariaDB [(none)]&gt; GRANT ALL ON laravel_db.* TO 'laravel_user'@'localhost';
MariaDB [(none)]&gt; FLUSH PRIVILEGES;
MariaDB [(none)]&gt; EXIT</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Install Composer</span></h2>
<p>To download Composer, run the following command:</p>
<pre><code>$ curl -sS https://getcomposer.org/installer | php</code></pre>
<p>Next, move the composer file to the<code> /usr/local/bin</code> path.</p>
<pre><code>$ sudo mv composer.phar  /usr/local/bin/composer</code></pre>
<p>Assign execute permission:</p>
<pre><code>$ sudo chmod +x   /usr/local/bin/composer</code></pre>
<p>Verify the Composer version installed:</p>
<pre><code>$ composer --version

Output:
Composer version 2.2.6 2022-02-04 17:00:38</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Install Laravel 9 on Debian 11</span></h2>
<p>Navigate to the <code>webroot</code> directory, type:</p>
<pre class="wp-block-preformatted"><code>$ cd /var/www/html</code></pre>
<p>Now, install Laravel using the composer command, type:</p>
<pre class="wp-block-preformatted"><code>$ sudo composer create-project laravel/laravel laravelapp</code></pre>
<p>The command creates a new directory called <code>laravelapp</code> and installs all the files and directories for Laravel.</p>
<p>Change the ownership of the Laravel directory to the webserver user and also the permissions:</p>
<pre class="wp-block-preformatted"><code>sudo chown -R www-data:www-data /var/www/html/laravelapp
sudo chmod -R 775 /var/www/html/laravelapp/storage</code></pre>
<p>Once the installation is done navigate to the installation directory and check the Laravel version:</p>
<pre><code>$ cd laravelapp</code></pre>
<pre><code>$ php artisan</code></pre>
<figure id="attachment_258" aria-describedby="caption-attachment-258" style="width: 900px" class="wp-caption aligncenter"><img decoding="async" class="wp-image-258" src="https://www.linuxtuto.com/wp-content/uploads/2022/02/LaravelFramework.jpg" alt="Laravel 9.0.2 Framework" width="900" height="134" srcset="https://www.linuxtuto.com/wp-content/uploads/2022/02/LaravelFramework.jpg 818w, https://www.linuxtuto.com/wp-content/uploads/2022/02/LaravelFramework-300x45.jpg 300w, https://www.linuxtuto.com/wp-content/uploads/2022/02/LaravelFramework-768x115.jpg 768w, https://www.linuxtuto.com/wp-content/uploads/2022/02/LaravelFramework-684x102.jpg 684w" sizes="(max-width: 900px) 100vw, 900px" /><figcaption id="caption-attachment-258" class="wp-caption-text">Framework 9.0.2</figcaption></figure>
<h2><span class="has-inline-color has-vivid-purple-color">Configure Apache Web Server for Laravel</span></h2>
<p>Navigate to <code>/etc/apache2/sites-available</code> directory and run the following command to create a configuration file for your Laravel installation:</p>
<pre><code class="hljs shell"><span class="hljs-meta">$</span><span class="bash"> sudo nano /etc/apache2/sites-available/laravel.conf</span></code></pre>
<p>Add the following content:</p>
<pre><code>&lt;VirtualHost *:80&gt;

ServerName your-domain.com

ServerAdmin webmaster@your-domain.com
DocumentRoot /var/www/html/laravelapp/public

&lt;Directory /var/www/html/laravelapp/&gt;
Options +FollowSymlinks
AllowOverride All
Require all granted
&lt;/Directory&gt;

ErrorLog ${APACHE_LOG_DIR}/your-domain.com_error.log
CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined

&lt;/VirtualHost&gt;
</code></pre>
<p>Save the file and Exit.</p>
<p>Enable the laravel virtual host.</p>
<pre><code>$ sudo a2ensite laravel.conf</code></pre>
<p>Restart the Apache web server.</p>
<pre><code>$ sudo systemctl restart apache2</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Access your Laravel Application</span></h2>
<p>Open your browser and type your domain e.g <code>http://your-domain.com</code></p>
<p><img decoding="async" class="size-large wp-image-266 aligncenter" src="https://www.linuxtuto.com/wp-content/uploads/2022/02/Laravel-1024x456.jpg" alt="Laravel 9" width="1024" height="456" srcset="https://www.linuxtuto.com/wp-content/uploads/2022/02/Laravel-1024x456.jpg 1024w, https://www.linuxtuto.com/wp-content/uploads/2022/02/Laravel-300x134.jpg 300w, https://www.linuxtuto.com/wp-content/uploads/2022/02/Laravel-768x342.jpg 768w, https://www.linuxtuto.com/wp-content/uploads/2022/02/Laravel-1536x684.jpg 1536w, https://www.linuxtuto.com/wp-content/uploads/2022/02/Laravel-1222x544.jpg 1222w, https://www.linuxtuto.com/wp-content/uploads/2022/02/Laravel-897x400.jpg 897w, https://www.linuxtuto.com/wp-content/uploads/2022/02/Laravel-684x305.jpg 684w, https://www.linuxtuto.com/wp-content/uploads/2022/02/Laravel.jpg 1910w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<h2><span class="has-inline-color has-vivid-purple-color">Comments and Conclusion</span></h2>
<p>That’s it. You have successfully installed Laravel 9 on Debian 11.</p>
<p>If you have any questions please leave a comment below.</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-laravel-9-on-debian-11/">How to Install Laravel 9 on Debian 11</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.linuxtuto.com/how-to-install-laravel-9-on-debian-11/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">245</post-id>	</item>
	</channel>
</rss>
