building a software development environment in Ubuntu Linux

This assumes you already have Ubuntu installed. This should work in versions 18.04 or 20.04.

The following may wind up being the "just do it" version. You are encouraged to look up various concepts.

I'm also assuming you have the "desktop" version with the graphic interace as opposed to the "server," command-line only version. On the purple Ubuntu desktop, you should have a 3 X 3 dot grid that says "Show Applications" when you hover over it. Click that. You'll see the search bar at the top. Search for "term" or "terminal." The "command line," "command prompt," "terminal," and "shell" all mean the same thing.

I recommand "Terminal" as opposed to "XTerm" or "UXTerm." Click terminal. You should get the "command prompt" itself, which looks something like
[your user]@[your machine name]:~$

Such as
dave@hal9000:~$

The $ has been the traditional UNIX / Linux prompt token for as long as I remember, from 1991. It's just something someone decided on decades ago to mean "You're at the command prompt, and I, the shell, am ready for your commands." Sometimes you'll see the $ printed before a command. That just means that the command is meant for a Linux prompt. You never type the $ at the beginning. It means you should already have one.

A # symbol rather than $ means that you either have to be logged in as root or you "sudo" (explained more below) in Ubuntu Linux. How to log in as root is probably too dangerous for you to know right now. :) Seriously, you can look it up, but I'd be careful. I always use "sudo" myself. Once in a blue moon I have reason to become root at the command line, but I don't even want to go there now.

With that said, it would be relatively hard for you to seriously break anything. Feel free to nose around. Right now you don't know any dangerous commands, and hopefully they are marked as dangerous when you do come across them. Perhaps it's best not to execute commands from untrusted sources for now. But do look up commands. Look at tutorials, etc.

The ~ means that you're in your home directory, but that's a longer story for later.

sudo is "super-user doer" or "sudoer" or one who has the power to do stuff as root. Root is the (original / first / default) administrative user of a Linux system. It's the equivalent of being an Administrator-type user in Billuminati's Scamdemic, Mass Murder, and Pedophilia Funding Operating System / Supervillain OS / SOS.

A command prefixed with "sudo" means to execute the command as root. You'll be asked for your password the first time you enter a given shell window. After that, you won't be asked for a password until you close that shell.

"apt" which a few years ago was "apt-get" is the basic Ubuntu Linux software package management command. I believe as of 18.04/20.04, apt and apt-get are equivalent, but I recommand using "apt" because it's the newer version and "apt-get" will go away at some point. "apt" is the "install software" command for our immediate purposes.

Time to execute your first command. The following updates the package list so that Ubuntu knows what needs updating and what the latest versions are. It does not actually do an update. But you should always do it before doing a bunch of installation.

$ sudo apt update

Again, don't type the $. That just means you should be at the already-existing $ prompt. The result should be something like:

$ sudo apt update
[sudo] password for bob: 
Hit:1 https://brave-browser-apt-release.s3.brave.com stable InRelease          
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]  
[...]
Get:30 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [9,288 B]
Fetched 4,796 kB in 4s (1,340 kB/s)                                   
Reading package lists... Done
Building dependency tree       
Reading state information... Done
9 packages can be upgraded. Run 'apt list --upgradable' to see them.
$ 

It's possible you'll get an error message to the effect of "can't get the lock" or "can't lock file blah blah." You may also get that message during your second or future command. That means that Ubuntu has started an auto-update. On a reasonably fast computer, that may last 5 - 10 minutes. It's best to let it finish. Showing you how to keep track of the progress is another chapter for later. (Unless CERTAIN PEOPLE who have suffered through it want to write that up.)

Now it's time to hit the road. First we'll install the PHP programming language because I've written 200,000 or more lines of PHP code, and I still use it. I can easily document I've written on the order of 100,000, and 200,000 may not be so hard. You're (considering) becoming my apprentice, so probably best to start with what I do.

$ sudo apt install php

Even on a fast machine this may take a minute or two. A "hard" error should be relatively clear if you're looking for it. This command and all others will spit out lots of chatter and maybe even warnings, so it may be hard to sort through. If you start hitting errors, I should probably get on phone and a type-chat program and help.

Now you have something to program with, but now I recommend complying with Kwynn's Software Development Rule #1: Never develop without a debugger. I use Netbeans and xdebug.

sudo apt install netbeans
sudo apt install php-xdebug

Netbeans installs around 1GB of stuff including a Java SDK.

Now things get just a bit more complicated. So far you have installed packages as assembled by Ubuntu / Canonical. Ubuntu decides what versions of different software they'll keep up with for a given version of Ubuntu. In early 2017 I decided that the version of MongoDB that Ubuntu supported wasn't good enough. I don't remember why it wasn't good enough. As of July, 2020, I'm still mainly running Ubu 18.04 but I started my 20.04 buildup, and these notes are built around it. I'm pretty sure that I checked and found that Ubuntu 20.04 is still not "good enough" in terms of MongoDB versions. This is all to say that sometimes you have to do things the somewhat harder way. We're going to install MongoDB's own packages for Ubuntu.

I've been running MongoDB 4.0 for months or years, but I followed the instructions for MongoDB 4.2 in Ubuntu 20.04. Actually, they are instructions for 18.04 but I can confirm they work fine in 20.04. In any event, I believe I have everything you need below, but I am referring to MongoDB's Ubuntu instructions.

First we'll do various encryption key related stuff to designate MongoDB as a trusted source of software. Depending on exactly how much detail you mean, I certainly do not completely understand the following. I like to emphasize to my apprentices that I am not all knowing. I've done these commands lots of times, though, and no grief has come of it.

wget is a command line HTTP(S) call. It's a download command. GNUPg is GNU's Pretty Good Privacy (At least I believe the origin goes back to PGP from the mid 90s if not earlier. It's an encryption tool needed to use the package encryption / verification tools. I believe it was already installed in my case. The last command designates mongodb.org as your source for MongoDB software. Again, that's as opposed to the default Ubuntu / Canonical sources. Bionic Beaver is the English name for 18.04. (20.04 is the Focal Fossa.)

wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
sudo apt-get install gnupg
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list

I usually don't do an "update" if I'm doing a one-off, ad-hoc install, but in this case you must do an update because the whole point is to download MongoDB.org's package list:

sudo apt update

Now we start to deal with a similar problem between what PHP.org keeps up with versus MongoDB's PHP packages. In other words, unfortunately, you don't want to be using either PHP.org's MongoDB software or PHP.org's documentation. I assume php.org will catch up eventually, but it hasn't happened for 3.5 years, so who knows? In any event, begin by uninstalling what comes with PHP:

sudo apt remove php-mongodb

Now we install MongoDB itself from MongoDB's packages. The "-y" "switch" / "argument" / "parameter" means "Yes, do it" was opposed to being prompted whether you want to install x MB.

sudo apt-get install -y mongodb-org

"Composer" is a [... ends here for now]