0

How to setup Linux, Apache, MySQL and PHP on WSL2 (Windows 11)?

I understand I need to use a tool named Docker Desktop, but what do I do after installing it?

1

1 Answer 1

1

How to setup Linux, Apache, MySQL and PHP on WSL2 (Windows 11)?

I agree with @roaima's comment that this is a bit too similar to your other question today. However, the fact that you seem to be asking this twice, in itself, indicates enough of a misunderstanding that it feels a separate answer is needed here.

Installing software in WSL

WSL runs different Linux distributions, but you don't mention in this question which distribution you are using, nor ask about any particular distribution.

If you are running Ubuntu 22.04 under WSL2 (as in your other question), then the method for installing most packages is going to be pretty much the same as it is on most any other installation of Ubuntu 22.04 (whether on a physical machine or a VM).

So if you install the LAMP package group in "normal" Ubuntu 22.04 with:

sudo apt install lamp-server^

... then you'll do the same if you are using Ubuntu 22.04 in WSL. There may be some exceptions to this with WSL based on certain differences, but it's certainly the first thing to try anyway.

If you are using a different distribution in WSL, then you'll use that distribution's package installer (and package group or packages), of course. For instance, on Arch Linux, you'd use something like pacman -S apache php php-apache mysql.

Configuring LAMP in WSL

If this question is about configuring a LAMP stack, then that's going to be outside the scope of any one answer here. In general, Stack Exchange sites assume that you have already tried following some other instructions. If you have a question on a particular step or a problem that you run into, then post a separate question about that specifically.

Again, it's also going to likely vary a bit depending on your distribution.

Docker

I understand I need to use a tool named Docker Desktop, but what do I do after installing it?

Well, you don't need it, no. There's not much reason to install a LAMP server inside Docker unless you are specifically building a Docker image for other purposes already. WSL distributions are themselves running as containers (similar to Docker). Sure, you can run a container-inside-a-container, but there's not much reason to. I know this probably doesn't make much sense to you now, but come back and read it after you've been using WSL and/or Docker for a while.

A "general introduction" to Docker would also be well outside the bounds of any one answer here, but if you do want to learn more about it, you can certainly follow the Getting Started blog post on Docker Desktop or one of a myriad of other tutorials.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .