Adobe Commerce Composer Quick Reference

Adobe Commerce - Composer Quick Reference Guide

Placeholders — Replace Before Running

Replace these placeholders in all commands below with your actual values:

Placeholder Description Example
<SSH_KEY> Path to your SSH private key (.pem) ~/dev-zamp-ec2.pem
<SSH_USER> SSH username for the server ubuntu
<SERVER_HOST> Public IP or hostname of the server 54.123.45.67
<MAGENTO_ROOT> Magento root directory on the server /var/www/html/magento2
<WEB_USER> Web server user www-data (Ubuntu), apache (Amazon Linux)
<LOCAL_ZIP_PATH> Full path to the zip on your local machine /mnt/c/builds/ceretax-extension-1.0.0.zip

Option A — Install on a Remote Server (EC2)

Use this when Magento runs on a remote server and you are running commands from your local machine (WSL/Linux/macOS).

Step 1: Upload the zip to the server (run from WSL/local terminal)

Transfer the zip file from your local machine to the server.

scp -i <SSH_KEY> <LOCAL_ZIP_PATH> <SSH_USER>@<SERVER_HOST>:/tmp/

Step 2: SSH into the server (run from WSL/local terminal)

Connect to the remote server.

ssh -i <SSH_KEY> <SSH_USER>@<SERVER_HOST>

Step 3: Set up the package directory (run on the server)

Create a directory for Composer packages and copy the zip into it.

sudo mkdir -p /opt/packagessudo cp /tmp/ceretax-extension-1.0.0.zip /opt/packages/

Step 4: Register the package with Composer (run on the server)

Navigate to Magento root and tell Composer where to find the package.

cd <MAGENTO_ROOT>sudo composer config repositories.ceretax artifact /opt/packages

If you get this error: The file "./composer.json" is not writable.

Fix: Use sudo instead of sudo -u <WEB_USER> for Composer config and require commands.

Step 5: Install the package (run on the server)

Install the CereTax module via Composer.

sudo composer require ceretax/module-tax-connector:1.0.0

Step 6: Fix file ownership (run on the server)

Composer runs as root, so fix ownership back to the web server user.

sudo chown -R <WEB_USER>:<WEB_USER> vendor/ composer.json composer.locksudo chown -R <WEB_USER>:<WEB_USER> vendor/ceretax/sudo chmod -R 755 vendor/ceretax/

Step 7: Enable the module (run on the server)

Register the module with Magento.

sudo -u <WEB_USER> php bin/magento module:enable Ceretax_TaxConnector

Step 8: Run database migrations (run on the server)

Create CereTax database tables and columns.

sudo -u <WEB_USER> php bin/magento setup:upgrade

Step 9: Fix permissions again (run on the server)

setup:upgrade may regenerate files owned by root. Fix permissions before compiling.

sudo chown -R <WEB_USER>:<WEB_USER> vendor/ceretax/sudo chmod -R 755 vendor/ceretax/

If you get this error: Warning: file_get_contents(...vendor/ceretax/...): Permission denied

Fix: Run the ownership fix commands above, then retry di:compile.

Step 10: Compile and deploy (run on the server)

Compile dependency injection.

sudo -u <WEB_USER> php bin/magento setup:di:compile

Deploy static content (CSS, JS, templates).

sudo -u <WEB_USER> php bin/magento setup:static-content:deploy -f

Flush all caches.

sudo -u <WEB_USER> php bin/magento cache:flush

Step 11: Verify (run on the server)

Check the module is enabled.

sudo -u <WEB_USER> php bin/magento module:status | grep Ceretax

Check Composer sees the package.

sudo -u <WEB_USER> composer show ceretax/module-tax-connector

Option B — Install on Your Existing System (Local Server)

Use this when Magento is running on the same machine where you have terminal access. No SSH or SCP needed.

Step 1: Set up the package directory

Create a directory and copy the zip file into it.

sudo mkdir -p /opt/packagessudo cp <LOCAL_ZIP_PATH> /opt/packages/

Note: The zip can be anywhere on the machine. Just copy it into /opt/packages/ (or any directory you choose).

Step 2: Register and install via Composer

Navigate to Magento root, register the artifact repo, and install.

cd <MAGENTO_ROOT>sudo composer config repositories.ceretax artifact /opt/packagessudo composer require ceretax/module-tax-connector:1.0.0

Step 3: Fix file ownership

Restore correct ownership after Composer installs as root.

sudo chown -R <WEB_USER>:<WEB_USER> vendor/ composer.json composer.locksudo chown -R <WEB_USER>:<WEB_USER> vendor/ceretax/sudo chmod -R 755 vendor/ceretax/

Step 4: Enable module and run Magento setup

Enable the module.

sudo -u <WEB_USER> php bin/magento module:enable Ceretax_TaxConnector

Run database migrations.

sudo -u <WEB_USER> php bin/magento setup:upgrade

Fix permissions (in case setup:upgrade created root-owned files).

sudo chown -R <WEB_USER>:<WEB_USER> vendor/ceretax/sudo chmod -R 755 vendor/ceretax/

Compile dependency injection.

sudo -u <WEB_USER> php bin/magento setup:di:compile

Deploy static content.

sudo -u <WEB_USER> php bin/magento setup:static-content:deploy -f

Flush all caches.

sudo -u <WEB_USER> php bin/magento cache:flush

Step 5: Verify

Check the module is enabled.

sudo -u <WEB_USER> php bin/magento module:status | grep Ceretax

Check Composer sees the package.

sudo -u <WEB_USER> composer show ceretax/module-tax-connector

Important Notes

Note: Keep the zip file in /opt/packages/. Composer needs it there whenever you run composer install or composer update (e.g. after adding other packages).

Note: If you get permission errors at any point during di:compile or setup:upgrade, always run the ownership fix first:

sudo chown -R <WEB_USER>:<WEB_USER> vendor/ceretax/sudo chmod -R 755 vendor/ceretax/