First of all, read the warning! He says don’t run composer as root! Second, you are probably using Xammp on your local machine, which has the required php libraries by default.
But on your server you are missing ext-dom. php-xml has all the required bundled packages. Thus, you can simply install it by running:
sudo apt-get update
sudo apt install php-xml
Most likely you are missing mbstring too. If you get an error, install this package also with:
sudo apt-get install php-mbstring
Then install:
composer update
composer require cviebrock/eloquent-sluggable
For those who want to install ext-dom on php 7.1 and above, run this command:
sudo apt install php-xml