...
tar -xzvf <.tar.gz compressed extension>
Then run "composer require worldpay/worldpay-lib-php" in your Magento root directory.
Now go to your Magento root directory, say it's named magento2, and execute the following commands:
composer require worldpay/worldpay-lib-php
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
...