How to Install a Program on Your Linux Web Server with SSH/Shell

Sometimes you don’t have access to a control panel, and you need to install a program on your Linux web server. Did you know you can install programs on your web server using SSH?

Note: Some web hosts may not allow you to use SSH to access your Linux server.

First Log Into Your Remote Server with SSH

In order use any commands in a shell on your web server, you first need to login using SSH.

How to Log Into a Remote Server with SSH

Total Time: 2 minutes

  1. In a terminal (called the Command Prompt in Windows), type the following command.

    ssh Username@IP

    Username needs to be the username you want to log into on the remote server. In some cases this username may be root. IP needs to be the IP address of the remote server.

  2. The SSH program will likely ask you for a password before allowing you to log in. Enter the password for the username you chose to log into. (Remember that passwords are case sensitive, and don’t forget if you’ve left caps lock turned on, because there won’t be any warning about this.)

  3. If you are told the password is invalid, press the up arrow on your keyboard to show the ssh Username@IP command again and hit enter. Be sure to only retry this for a few times before taking a few minute’s break, otherwise you could be locked out, depending on how your server is configured.

Install a Program on Your Linux Web Server with SSH

Please note that the below instructions assume your web server is run on Debian, Ubuntu, or another Debian-based Linux distribution. Other distributions may use yum or another command to manage Linux packages instead of apt (short for Aptitude). Don’t worry, if you don’t know which distribution your web server is, it’s probably either Debian or Ubuntu, as those are the most common.

How to Install a Program in the Linux Command-Line

Find the Package Name of the Program You Want to Install

Linux bundles programs in what are called Linux packages. So in order to install a program in Linux, you need to know the exact package name of that program. There are two ways to do this.

1. In a terminal (called the Command Prompt in Windows), type the following command. (Note, | is the pipe key, which is most likely found on the same key as the \ key on your keyboard. On some keyboards the pipe key may look like two vertical bars, one over the other, instead of one long vertical bar.)

sudo apt search PackageName | less

PackageName should be part of the name of the program. For example, if I were looking to install the Nginx server, I might type nginx in place of the above PackageName placeholder. Note that using a one-word search is best, because apt isn’t as smart as Google, and you may miss a package that exists just because you typed one letter that doesn’t exist in the package name you are looking for. (For example, because the Nginx package name is just nginx, if I typed nginx-server or nginx program, I wouldn’t find the Nginx server package I was looking for, even though it does exist.)

(When you are done using less to peruse the available Linux packages, type the Q key on your keyboard.)

2. If you have access to a web browser, you can also find Linux package names by doing a search on your favorite search engine, like below:

linux apt install Program

Where Program is the program you are looking for.

Update Your List of Known Packages in Apt

Next, update your computers list of known packages and package versions. This is an important step, as it will ensure you install the latest version of the program you want to use.

sudo apt update

Note: If you get a notification that says something like “E: Could not open lock file /var/lib/apt/lists/lock – open (13: Permission denied)”, this means you need administrator privileges to run apt and you don’t have it.

Install the Program Using Apt

Installing the program is easy once you know what the package is called.

sudo apt install PackageName

The Aptitude program will figure out if any other packages are needed by the package you want to install, and then ask you if you want to install these too. Just type Y for yes or N for no, and then hit the Enter key.

Once Aptitude finishes processing, you will see the usual terminal prompt, and you are good to start using your new program.

Comments on "How to Install a Program on Your Linux Web Server with SSH/Shell"

Leave the first comment


X

Be in the Know

Subscribe to be in the know about new articles and giveaways, like free Bricks Builder templates. The most I will email you is once every two weeks.