sudo apt-get install apt-mirror
First modification /etc/apt/mirror.list, cn.archive.ubuntu.com used as the mirror source, i.e., before adding cn.:gksu gedit /etc/apt/mirror.list all archive.ubuntu.com, content as follows
############# config ##################
#
# set base_path /var/spool/apt-mirror
#
# set mirror_path $base_path/mirror
# set skel_path $base_path/skel
# set var_path $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads 20
set _tilde 0
#
############# end config ##############
deb http://cn.archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
#deb http://cn.archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
#deb http://cn.archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
#deb-src http://cn.archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
#deb-src http://cn.archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
clean http://cn.archive.ubuntu.com/ubuntu
--------------------- ------------------------ End content
and run
apt-mirror
Error:
~$ apt-mirror
flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror line 206.
apt-mirror is already running, exiting at /usr/bin/apt-mirror line 209.
ls -l 查看/usr/bin/apt-mirror的权限: drwxr-xr-x 5 apt-mirror apt-mirror 4096 11\u6708 10 12:37 apt-mirror
Permissions are apt-mirror: apt-mirror
Modifying the current user permissions sudo chown <you>: <you> / usr / bin / apt-mirror
Here <you> replaced with the current user name
Review directory permissions: sudo chmod 777 -R / var / spool / apt-mirror
Then run apt-mirror, start downloading the image :( If you do not cut, will download 135G)
......
135.0 GiB will be downloaded into archive.
Downloading 119219 archive files using 20 threads...
======================================================================
Here is the complete image file ubuntu14.04 mirror.list settings
For i386
############# config ##################
#
set base_path /var/spool/apt-mirror-i386
#
set mirror_path $base_path/mirror
set skel_path $base_path/skel
set var_path $base_path/var
set cleanscript $var_path/clean.sh
set defaultarch i386
set postmirror_script $var_path/postmirror.sh
set run_postmirror 0
set nthreads 20
set _tilde 0
#
############# end config ##############
deb http://cn.archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse
Security main Trusty-http://security.ubuntu.com/ubuntu the deb Restricted
the deb-http://security.ubuntu.com/ubuntu Trusty the src-Security main Restricted
the deb http://security.ubuntu.com/ubuntu trusty- Universe Security
the deb-http://security.ubuntu.com/ubuntu Trusty the src-Security Universe
the deb http://security.ubuntu.com/ubuntu Trusty-Security Multiverse
the deb the src-http://security.ubuntu.com/ubuntu Security-Multiverse Trusty
the deb http://extras.ubuntu.com/ubuntu main Trusty
the deb Trusty main http://extras.ubuntu.com/ubuntu the src-
Clean http://cn.archive.ubuntu.com/ubuntu
for amd64 the above are replaced amd64 i386 can. Note that the establishment of / var / spool / apt-mirror -amd64 directory and subdirectories mirror skel var and set permissions.
==============================================
Make use of mirror source. There are two ways: 1 installation web service, similar to Internet mirror; 2 direct file access, simple, removable hard disk can be placed
1, the installation web service
Install apache web server
sudo apt-get install apache2
The default Web site home directory is / var / www / html
Create mirror directory soft link
sudo ln -s /var/spool/apt-mirror-i386/mirror /var/www/html/ubuntu-mirror-i386
View Catalog
ls /var/www/html/ubuntu-mirror-i386
cn.archive.ubuntu.com extras.ubuntu.com security.ubuntu.com
View local ip
ifconfig
eth0 192.168.0.101
Edit the source list gksu gedit /etc/apt/sources.list, at http: // followed by 192.168.0.101/ubuntu-mirror-i386/, as follows
#deb cdrom:[Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta i386 (20150805)]/ trusty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty universe
deb http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://192.168.0.101/ubuntu-mirror-i386/cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb http://192.168.0.101/ubuntu-mirror-i386/security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://192.168.0.101/ubuntu-mirror-i386/security.ubuntu.com/ubuntu trusty-security main restricted
deb http://192.168.0.101/ubuntu-mirror-i386/security.ubuntu.com/ubuntu trusty-security universe
deb-src http://192.168.0.101/ubuntu-mirror-i386/security.ubuntu.com/ubuntu trusty-security universe
deb http://192.168.0.101/ubuntu-mirror-i386/security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://192.168.0.101/ubuntu-mirror-i386/security.ubuntu.com/ubuntu trusty-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://192.168.0.101/ubuntu-mirror-i386/extras.ubuntu.com/ubuntu trusty main
deb-src http://192.168.0.101/ubuntu-mirror-i386/extras.ubuntu.com/ubuntu trusty main
Save and then execute
sudo apt-get update Update Source List
Testing, installation dia diagramming software
sudo apt-get install dia
Download 7M more than 1 second to complete the package.
2 direct file access
If you do not want to install the web service, you can directly access the image file.
Modify /etc/apt/sources.list
The http://192.168.0.101/ubuntu-mirror-i386/ replace all file: /// var / spool / apt-mirror-i386 / mirror / can
Save and then execute
sudo apt-get update Update Source List
If the mirror replaced removable disk, a removable disk image path on the line
==================================================================
apt-mirror can ctrl + c to exit at any time and start again. Use of free time to build the ubuntu mirror, significantly reducing installation package download time and improve efficiency.
For the current count of T disk capacity, memory mirroring longer a problem.