And though you certainly can do everything from within the well-designed GUI tools, there might come a time when you need to (or just want to) make use of the terminal. One such occasion might be if you’ve deployed Linux as a server without a desktop environment. You might want to have a Linux server on your home LAN to deploy things to, including web servers, file servers, media streaming platforms, and more. When that’s the case, you’ll need to know how to install applications from the command line.  For example, you want to install the Nextcloud cloud-based content management and collaboration platform. Or maybe you want to build an entire website from scratch and serve it up via the Apache web server. You might even want a full LAMP (Linux Apache MySQL PHP) stack on your server. Regardless of why, you’ll need to know how to install those applications from the CLI (command-line interface). I’m going to show you how. Let’s stick with our LAMP stack example to illustrate how to do this on Ubuntu, AlmaLinux, Arch Linux, and openSUSE (which should cover most distributions). Ready? Let’s go.

Installing a LAMP stack on Ubuntu-based distributions

Our first demonstration will be on the user-friendly Ubuntu distribution. Ubuntu uses the APT (Advanced Packaging Tool) package manager and makes installing a full LAMP stack incredibly easy. A basic APT installation looks like this: Where PACKAGENAME is the name of the software you want to install. Before you run the installation, you might want to first update APT with: With APT updated, you’re ready to install the LAMP stack. One of the handy tricks with Ubuntu and the LAMP stack is that you can install it all with a single simple command, which is: If you don’t want to go that route, you can install the packages individually. First install the Apache web server with: Next, install the MySQL database server with: You’ll then install the latest version of PHP with: Of course, you can opt to do it all with the single-line command shown above.

Installing a LAMP stack on AlmaLinux

AlmaLinx is a Red Hat Enterprise Linux-based distribution, and the installation requires you to install each package individually.  First, install the web server with: Next, install the MySQL database server with: Finally, you install PHP with:

Installing a LAMP stack on Arch Linux

Arch Linux is nearly as user-friendly as is either Ubuntu or AlmaLinux. Arch Linux uses the pacman package manager and must first be updated with: Once updated, install Apache with: Next, install the MySQL database server with: Finally, install PHP with: The options used above are:

S - Synchronize packagesy - Download a fresh copy of the master package database.u - Upgrade all out-of-date software

Installing a LAMP server on openSUSE

Finally, we’ll install the LAMP server on openSUSE, which uses the zypper package manager. Update zypper with: Install Apache on openSUSE with: Install the MariaDB database with: Install PHP7 with:

The commonality

Except for Arch Linux, the installation of software is generally handled like so: Where PACKAGEMANAGER is the package manager used by the distribution and SOFTWARE is the name of the software to be installed. The same holds true for removing software, as in: Again, where PACKAGEMANAGER is the package manager used by the distribution and SOFTWARE is the name of the software to be installed. To better illustrate this, you can install the Firefox web browser on each platform like so:

Ubuntu - sudo apt install firefox -yAlmaLinux - sudo dnf install firefox -yopenSUSE - sudo zypper firefox -y

Of course, with Arch Linux, that command would be: And that’s really the basics of installing software from the Linux command line. It really is so easy anyone who can type can install software from the Linux command line.