Admin dashboard in Laravel | Sign up and Sign in

In this tutorial, I will walk you through the process of cloning a Laravel project from GitHub, GitLab, or Bitbucket, and setting it up on an Ubuntu server from scratch.

Whether you're working with Laravel 6, 7, 8, 9, or 10, this guide will help you get your Laravel application up and running quickly and efficiently.

What You'll Learn:

  • How to clone a Laravel project from a Git repository (GitHub, GitLab, or Bitbucket)

  • How to set up an Ubuntu server for Laravel

  • Step-by-step instructions for configuring and running your Laravel project

Follow the detailed steps below to successfully clone and run your Laravel application on a server.

Prerequisites

Before setting up a Laravel project, ensure the following tools are installed on your system:

  • Git: A version control system for tracking code changes. Download and install Git from git-scm.com, and follow the setup instructions for your OS.

  • PHP: Laravel requires PHP 7.3 or higher. Verify your version using:

    php -v
  • Composer: A dependency manager for PHP. Download it from getcomposer.org and follow the installation guide for your platform.

  • Web Server: Laravel comes with a built-in development server, but Apache or Nginx is recommended for production.

  • Database: Ensure your system has a compatible DBMS (e.g., MySQL, PostgreSQL, or SQLite) if your project requires database interaction.

Steps to Clone and Set Up a Laravel Project

1. Clone the Repository

Open your terminal and navigate to the directory where you want to store the project. Run:

git clone https://gitlab.com/SoengSouy/laravel-9-clone-project-admin-dashboard-sample.git

Replace the URL with your project’s Git repository if it's different.

2. Navigate to the Project Directory

cd <project-directory>

Replace <project-directory> with the folder name of your cloned project.

3. Install Composer Dependencies

composer install

This command installs all required PHP packages.

4. Set Up the Environment File

Create a copy of the example environment configuration:

cp .env.example .env

Edit the .env file and configure your database and other environment settings.

5. Generate the Application Key

php artisan key:generate

This command sets the APP_KEY in your .env file, which is essential for encrypted data.

6. Configure Database Credentials

In your .env file, update the following with your database details:

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_db DB_USERNAME=root DB_PASSWORD=your_password

7. Run Migrations

php artisan migrate

This command will create the necessary tables in your database.

8. Serve the Application

php artisan serve

Your Laravel app should now be accessible at:
http://localhost:8000

Souy Soeng

Souy Soeng

Hi there 👋, I’m Soeng Souy (StarCode Kh)
-------------------------------------------
🌱 I’m currently creating a sample Laravel and React Vue Livewire
👯 I’m looking to collaborate on open-source PHP & JavaScript projects
💬 Ask me about Laravel, MySQL, or Flutter
⚡ Fun fact: I love turning ☕️ into code!

Post a Comment

close