Logo

How To Install Laravel 11 on Linux?

How To Install Laravel 11 on Linux?

How To Install Laravel 11 on Linux?

Laravel is a powerful and elegant PHP framework that simplifies web development tasks. In this guide, we’ll walk you through the process of installing Laravel on a Linux system, step by step. By the end, you’ll have a fully functional Laravel development environment ready for you to start building your next web application.

Step 1 : Install Apache Web Server

The Apache web server is a crucial component for serving your web applications. To install Apache, follow these steps:

  • Update your package index :
				
					sudo apt update

				
			
  • Install Apache
				
					sudo apt install apache2

				
			
  • Enable and start the Apache service
				
					sudo systemctl enable apache2
sudo systemctl start apache2

				
			

You can verify the installation by opening your web browser and navigating to http://localhost. You should see the Apache2 Ubuntu Default Page.

Step 2 : Install PHP

Laravel is a PHP framework, so we need to install PHP and several necessary extensions. Run the following command :

				
					sudo apt install php libapache2-mod-php php-mbstring php-xmlrpc php-soap php-gd php-xml php-cli php-zip php-bcmath php-tokenizer php-json php-pear

				
			

Step 3 : Install MariaDB

MariaDB is a popular open-source database management system. To install it, follow these steps :

  • Install MariaDB :
				
					sudo apt install mariadb-server

				
			
  • Secure your MariaDB installation
				
					sudo mysql_secure_installation

				
			

Follow the prompts to set up a root password and enhance the security of your database server.

Step 4 : Install Composer

Composer is a dependency management tool for PHP that you’ll need to install Laravel. Here’s how to install Composer : 

  • Download and install Composer :
				
					curl -sS https://getcomposer.org/installer | php

				
			
  • Move the Composer binary to a global location and make it executable :
				
					sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer

				
			

Step 5 : Verify PHP, MariaDB, and Composer Installations

Before proceeding, let’s verify that PHP, MariaDB, and Composer are installed correctly. Run the following commands :

				
					php -v
mysql --version
composer -V

				
			

You should see version information for each of these tools.

Step 6 : Install Laravel Using Composer

Now it’s time to install Laravel. Use Composer to create a new Laravel project :

				
					composer create-project --prefer-dist laravel/laravel app-name

				
			

Replace app-name with the name of your project. Then, navigate to the newly created project directory :

				
					cd app-name

				
			

Step 7 : Run the Laravel Server

To start the development server, run the following command inside your project directory :

				
					php artisan serve
				
			

This command will launch a local development server on port 8000. Open your web browser and go to http://127.0.0.1:8000. You should see the default Laravel welcome page, indicating that your application is up and running.

Conclusion :

You have successfully installed Laravel on your Linux system. Now, you’re ready to start building powerful web applications using this robust PHP framework. Whether you’re developing a small website or a large-scale application, Laravel provides the tools and features you need to create high-quality software efficiently.

Scroll to Top