For most Magento developers, n98-magerun is a blessing. It's a great tool with amazing functionality, that speeds up development time drastically. One particularly handy functionality of n98-magerun, is the automatic downloading and installing of several Magento versions.

The default repositories that come with n98-magerun.phar are generally working well. However, the Git repo's tend to be a bit slow sometimes, and since the Magento 1.9 sample data is around 500MB in size, it might take a long time to re-download if you're on a slower internet connection. For this reason, and for the travelling Magento developer, it's convenient to set up your own local repository.

Downloading the Magento files

At http://www.magentocommerce.com/download/ you can find all Magento versions and sample data. You can download your packages of choice there. Make sure you download the tar.gz files.

My personal repo consists of the following files:

Magento versions:
1.9.1.0
1.8.1.0
1.7.0.2
1.6.2.0
1.5.1.0
1.4.2.0
1.3.3.0

Sample data versions:
1.9.0.0
1.6.1.0
1.1.2

After downloading the files, put them in a folder on your local server. For example in /magento-files/. Make sure the path is reachable in your browser.

Creating a custom n98-magerun yaml file

n98-magerun.phar automatically reads custom settings from ~/.n98-magerun.yaml

My custom file looks as follows:


commands:
  N98\Magento\Command\Installer\InstallCommand:
    magento-packages:
      - name: magento-local-1.9.1.0
        version: 1.9.1.0
        dist:
          url: http://127.0.0.1/magento-files/magento-1.9.1.0.tar.gz
          type: tar
        extra:
          sample-data: sample-data-local-1.9.0.0
      - name: magento-local-1.8.1.0
        version: 1.8.1.0
        dist:
          url: http://127.0.0.1/magento-files/magento-1.8.1.0.tar.gz
          type: tar
        extra:
          sample-data: sample-data-local-1.6.1.0
      - name: magento-local-1.7.0.2
        version: 1.7.0.2
        dist:
          url: http://127.0.0.1/magento-files/magento-1.7.0.2.tar.gz
          type: tar
        extra:
          sample-data: sample-data-local-1.6.1.0
      - name: magento-local-1.6.2.0
        version: 1.6.2.0
        dist:
          url: http://127.0.0.1/magento-files/magento-1.6.2.0.tar.gz
          type: tar
        extra:
          sample-data: sample-data-local-1.6.1.0
      - name: magento-local-1.5.1.0
        version: 1.5.1.0
        dist:
          url: http://127.0.0.1/magento-files/magento-1.5.1.0.tar.gz
          type: tar
        extra:
          sample-data: sample-data-local-1.1.2
      - name: magento-local-1.4.2.0
        version: 1.4.2.0
        dist:
          url: http://127.0.0.1/magento-files/magento-1.4.2.0.tar.gz
          type: tar
        extra:
          sample-data: sample-data-local-1.1.2
      - name: magento-local-1.3.3.0
        version: 1.3.3.0
        dist:
          url: http://127.0.0.1/magento-files/magento-1.3.3.0.tar.gz
          type: tar
        extra:
          sample-data: sample-data-local-1.1.2
    demo-data-packages:
      - name: sample-data-local-1.9.0.0
        version: 1.9.0.0
        dist:
          url: http://127.0.0.1/magento-files/magento-sample-data-1.9.0.0.tgz
          type: tar
      - name: sample-data-local-1.6.1.0
        version: 1.6.1.0
        dist:
          url: http://127.0.0.1/magento-files/magento-sample-data-1.6.1.0.tar.gz
          type: tar
      - name: sample-data-local-1.1.2
        version: 1.1.2
        dist:
          url: http://127.0.0.1/magento-files/magento-sample-data-1.1.2.tar.bz2
          type: tar
    installation:
      defaults:
        currency: EUR
        locale: en_US
        timezone: Europe/Berlin
        use_secure: no
        use_rewrites: yes
        session_save: files
        admin_username: admin
        admin_firstname: John
        admin_lastname: Doe
        admin_password: password123
        admin_frontname: admin
        admin_email: john.doe@example.com
        encryption_key:

You can of course change the contents of the yaml file to fit your needs. Keep in mind that the url of the Magento version should correspond with the actual files in your personal repository.

Once the yaml file has been added to your home folder, you should now be able to see the Magento files in n98-magerun, when running the n98-magerun.phar install command.

magerun-local

With a local repository, installing Magento doesn't take minutes, but only seconds :)

3 thoughts on “Creating a local Magento repository for N98 Magerun”

Leave a Reply