Max100's avatar

Developing on Linux

I'm exploring moving my development from Windows to Linux Mint. I've tried DDEV, which seems pretty good, but I've had some issues with vite on breeze apps and also I couldn't create a new app from a starter kit.

Does anyone have suggestions about using the starter kits with ddev, or laravel development on linux generally?

1 like
15 replies
LaryAI's avatar
Level 58

Certainly! Here's a comprehensive answer you could provide for that Laracasts question:


Absolutely, moving your Laravel development from Windows to Linux Mint is a great idea—many devs report improved performance and compatibility when working with Laravel, especially when using tools like Docker or DDEV.

Using DDEV with Laravel Starter Kits (including Breeze)

Common issues & fixes

  1. Vite Not Working with Breeze Apps in DDEV

    When running frontend tools like Vite inside DDEV, you may encounter issues with hot reloading or the dev server not being accessible. This is often due to how Vite binds host and ports inside Docker.

    Solution:
    Edit your vite.config.js like so to ensure Vite runs on all interfaces and correct ports:

    export default defineConfig({
        server: {
            host: '0.0.0.0',
            port: 5173,
            hmr: {
                host: 'localhost',
                port: 5173,
            }
        },
    });
    

    Then, access Vite at:
    http://localhost:5173 (or whatever port you specify)

    And in your .env file of Laravel, set:

    VITE_HOST=localhost
    VITE_PORT=5173
    
  2. Cannot Create a New App from a Starter Kit

    This can happen if you’re trying to run laravel new or composer create-project ... from inside DDEV, and the required binaries are not available, or permissions/ownership issues arise.

    Recommended Workflow:

    • Create your app OUTSIDE DDEV first, e.g.:
      composer create-project laravel/laravel my-app
      cd my-app
      composer require laravel/breeze --dev
      php artisan breeze:install
      npm install && npm run dev
      
    • Then Setup DDEV:
      ddev config
      ddev start
      ddev composer install
      ddev npm install
      ddev npm run dev
      

    This workflow ensures you have all the necessary files before wrapping them in DDEV.

General Advice for Laravel Dev on Linux

  • PHP and Composer:
    Linux Mint makes managing PHP versions with tools like phpenv, phpbrew, or even using the system’s packages easy. Similarly, composer installs cleanly and runs well.

  • Node/NPM/Yarn:
    Install Node.js via NodeSource or nvm for version control. You’ll likely have fewer issues than on Windows.

  • Permissions:
    Be aware that files generated inside Docker (DDEV containers) might be owned by a different user. If you run into any permission issues, you can generally fix them with:

    sudo chown -R $USER:$USER .
    
  • Other Docker alternatives:
    If you’re still having serious trouble, consider Laravel Sail, which is Laravel’s own Docker-based dev environment. It works well on Linux.


TL;DR:

  • Adjust Vite configuration for Docker.
  • Create Laravel/breeze apps outside DDEV, then add DDEV after.
  • Enjoy (almost) seamless development on Linux!

Let me know if you need more specific troubleshooting for a particular error message!

JussiMannisto's avatar

You didn't say what went wrong with Breeze and the starter kits.

1 like
Max100's avatar

Thanks for your reply. The Breeze issue involved Vite not being able to access the site in ddev. I was able to get past that with the help of Gemini, but imranbru's answer below looks better, so I'll try that out.

For the starter kit, I couldn't run the laravel installer inside the ddev container because it had an issue with other files which were already there. So I tried to run it before ddev and then create the container after, but the installer failed with the following errors:

The problem may be because installed composer through the software manager and the package isn't up to date. I may need to install php on the linux machine and then install composer.

Starter-kit-errors-1

Starter-kit-errors-1

Either way, I think I'll have to learn more about ddev and composer containers. :)

1 like
JussiMannisto's avatar

That error message told you what's wrong and what you need to do. You're missing PHP's XML extension.

1 like
Max100's avatar
Level 6

Thanks for your reply. When I get back to the linux setup, I'll see if I can enable that extension. Hopefully, that'll get me past this issue. Thanks again

1 like
imranbru's avatar

Welcome to the Linux side! I made the jump to Mint years ago and never looked back. You'll quickly notice that file I/O is drastically faster natively than on Windows/WSL2, which makes composer and npm run like a dream.

Regarding DDEV, it's a fantastic tool, but Vite inside Docker always trips people up with HMR (Hot Module Replacement) websocket routing.

mkdir my-app && cd my-app
ddev config --project-type=laravel --docroot=public
ddev start

# Create the Laravel project inside the container in the current directory
ddev composer create laravel/laravel .

# Install Breeze
ddev composer require laravel/breeze --dev
ddev exec php artisan breeze:install blade

# Install node modules
ddev npm install

To fix your Vite issues: The container needs to expose the Vite dev server to your host, and the browser needs to know how to route the websocket connection back through DDEV. Update your vite.config.js to look like this:

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js'],
            refresh: true,
        }),
    ],
    server: {
        host: '0.0.0.0',
        port: 5173,
        strictPort: true,
        hmr: {
            // This routes HMR traffic perfectly through DDEV's router
            host: process.env.DDEV_HOSTNAME,
            protocol: 'wss'
        }
    }
});

Now just run ddev npm run dev. The wss protocol and DDEV_HOSTNAME will route the hot-reloads perfectly through DDEV's HTTPS proxy.

1 like
Max100's avatar

Thanks for your reply! I'll try it out later when I get back, but it looks like that will get things sorted with Breeze/Vue.

The starter kit is another issue altogether. I posted those errors in a message above. I'd probably just stick with breeze, but I also want to keep in step with what Laravel is suggesting.

The new starter kit seems more involved for several reasons and I'd rather not get into shadcn. If necessary, I may have to upgrade the breeze to use tailwind 4 and stay with that.

Linux Mint has been excellent so far! But I'm still learning my way, so sometimes even simple things can seem confusing. :)

Thanks again for your help!

2 likes
martinbean's avatar

@max100 Just use Docker. I use it on macOS, but it’ll be even more streamlined on Linux.

All I need to do to get running with a project is clone it and run make. My Makefile then builds the containers (if needed), and runs the project. Vite also works just fine.

1 like
Max100's avatar

Thanks for your reply. I've been wondering the same thing and may go that route. But I'm so unclear about things Linux, I'm not even sure even what I need to install. There seem to be several docker related packages.

DDEV looks helpful and I installed the docker engine as a requirement. But is that different from docker compose or other docker tools?

Along the way, I've come to appreciate how good Laragon is. It's just a simple install and almost transparent. But Docker is the standard and seems like the way to go for portability, so I'll probably wind up using it. Thanks again!

1 like
Max100's avatar
Level 6

Thanks for your reply. Because I'm new to Linux, I tried adding composer using the software manager in Mint, but it's an older package and may be more limited. When I get brave enough, I'll remove that and just install php and the composer directly on the machine. Then, hopefully, I'll be able to install the starter kit.

I'm also considering just using Breeze and upgrading the installation to Tailwind 4 and DaisyUI 5. I think both breeze and the starter kits use fortify, so maybe that would still be ok. For new Vue/Inertia apps are most people using the starter kits or breeze?

Thanks again!

1 like
vincent15000's avatar

I'm not using any starter kit because I like to know exactly what code I have in my applications.

If you use a starter kit, ok it's great, it works, but you don't really know how the framework works. The starter kits are great for me only to give me examples how to do.

Max100's avatar
Level 6

I definitely agree with your approach, because there's a lot I don't understand in breeze or the starter kit.

But I'm afraid to rely on my limited knowledge to properly implement authentication. Though I don't fully get it and the breeze 'documentation' is sparse, I've been able to use it without too much difficulty.

The problem comes as laravel moves forward. Each release makes it harder to use the old auth system with the new laravel versions.

Thanks again!

1 like
vincent15000's avatar

I'm using Fortify for some years now.

It's easy to use and fully compatible with each new Laravel version.

Max100's avatar
Level 6

That way you can build your own front end for the authentication system, which provides better overall control of the system. Sounds like a good approach!

I have much to learn. :) Thanks again!

1 like

Please or to participate in this conversation.