How to download all repository using apt-get?

First of all, this is not a convenient way. Instead of this you should use the method mention here. But as an answer to the question.

  • First create a file which contains names of all the available packages using apt-cache.

    apt-cache  dumpavail |grep -oP "(?<=Package: ).*" >> packagelist
    

    This will create a file packagelist with all the available packages.

  • Now create a simple script to download all the packages present in the file packagelist

    #!/bin/bash
    for package in `cat packagelist`
     do
        apt-get install -y --download-only $package   
     done
    
  • Save it.

  • Make it executable using

    chmod +x your_script_name
    
  • Now open terminal and login as root

    sudo -i
    cd /folder/of/you/script
    ./you_script_name
    

It will download all the available package depending upon your /etc/apt/sources.list in /var/cache/apt/archives directory