This is a quick guide for those who want to keep a local repository of Debian packages in their machines/servers either for internal consumption or for setting up a public mirror for Debian (very much encouraged to do so).
Read it here
Copy the following bash/shell script lines to a file say, mirror-debian.sh and set its executable bit suitably using chmod command (chmod +x mirror-debian.sh). Ofcourse, you need to install debmirror package as root/sudo using the command, apt-get install debmirror. You may install it using Synaptic package manager also.