Install external libraries with command line via SSH

Rating

Many modules use external libraries. The so-called third party software. We place these in the libraries folder of your Drupal installation.

You can do this in the traditional way via FTP, but you can also do this via SSH with a few simple commands.

As an example we take the colorbox module.
Make sure that the colorbox and libraries module are already installed.
Colorbox does not work without the extra colorbox library.
We can check this via status report.

Status rapport error colorbox library

We will install this library via SSH.

Open an SSH session with your server. This can be done via putty (windows) or terminal (mac)
Make sure you are in the root of your drupal website.
If you have not created the libraries folder, first create it with the mkdir libraries command (mkdir is the command for make directory) Navigate to the libraries folder with the command cd libraries (cd is the command for change directory)

Go to the colorbox module page at https://www.drupal.org/project/colorbox   scroll down to the Pendencies

Copy the url of the zip file

Copy the zip url

Now go back to the ssh window and paste the copied url preceded by the command wget. 

In our example, this is: wget https: //github.com/jackmoore/colorbox/archive/1.x.zip and press enter.

wget

This is the result:

Resultaat na wget

The 1.x.zip file has been downloaded to the libraries folder.

Now we have to unzip and rename it.

To unzip use the command unzip.
So in our example: unzip 1.x.zip + enter
Unzip
Unziped

The zip file is now unziped. You can see this by entering the command ls (small letter L + s command for list). This gives you a list of everything in that folder.
Lijst opvragen

We see the zip file 1.X.zip and the folder colorbox-1.x

What remains is to rename the folder to colorbox and (optional) delete the zip file.

Rename the folder with the command mv, which actually stands for move. So with this command you can move files or folders on the server. However, if you stay in the same folder, you rename the file or folder.

In our example: mv colorbox-1.x colorbox (note the space between colorbox-1.x and colorbox)
rename

Visually you do not see anything change, but when you enter the ls command you will see that the folder now has the name colorbox.

Back to the status report

Colorbox installed

Delete the zip file

rm 1.x.zip (rm is the command for remove)