How to create local apt-get repository in Ubuntu

Step-1 First of  all create a folder. 

root @leolinux-ubuntu~ #   mkdir   /usr/local/mydebs


Step-2 Copy all packages in side the above created folder, In the following example, I have used pen drvice which contains ubuntu packages.

root @leolinux-ubuntu~ #   cp   /media/pendrive/*    /usr/local/mydebs


Step-3 Run the following command to create local repository.

root @leolinux-ubuntu ~ #   cd   /usr/local/mydebs
root @leolinux-ubuntu ~ #   dpkg-scanpackages   .   /dev/null   |   gzip    -9c    >    Packages.gz

 Step-4  Now make entry in sources.list file to use local repository.

root @leolinux-ubuntu ~ #    vim    /etc/apt/sources.list
deb   file:/usr/local/mydebs    /