1. 程式人生 > >ubuntu14.04用apt-mirror 製作ubuntu本地映象源

ubuntu14.04用apt-mirror 製作ubuntu本地映象源

sudo apt-get install apt-mirror

首先修改/etc/apt/mirror.list,使用cn.archive.ubuntu.com的源作映象,即在所有archive.ubuntu.com前加上cn.:gksu gedit /etc/apt/mirror.list,內容如下

############# 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

--------------------- 內容完 ------------------------
然後執行

apt-mirror

出錯:

~$ 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

許可權是 apt-mirror:apt-mirror

修改為當前使用者許可權 sudo chown <you>:<you> /usr/bin/apt-mirror

這裡<you>用當前使用者名稱替換

修改目錄許可權:sudo chmod 777 -R /var/spool/apt-mirror

再執行 apt-mirror , 開始下載映象:(如果沒有裁減,將下載135G)

......

135.0 GiB will be downloaded into archive.
Downloading 119219 archive files using 20 threads...
======================================================================

下面是完整映象ubuntu14.04的mirror.list檔案設定

對於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

deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse
deb http://extras.ubuntu.com/ubuntu trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main

clean http://cn.archive.ubuntu.com/ubuntu

對於amd64,將上面的i386都換成amd64即可。注意建立/var/spool/apt-mirror-amd64目錄及子目錄 mirror skel var 並設定許可權。

==============================================

使用做好的映象源。有兩種方法:1 安裝web服務,類似網上映象;2 直接檔案訪問,簡單,可放入行動硬碟

1, 安裝web服務

安裝apache網站伺服器

sudo apt-get install apache2

預設的網站主目錄為 /var/www/html

建立映象目錄軟連結

sudo ln -s /var/spool/apt-mirror-i386/mirror /var/www/html/ubuntu-mirror-i386

察看目錄

ls /var/www/html/ubuntu-mirror-i386
cn.archive.ubuntu.com  extras.ubuntu.com  security.ubuntu.com

察看本機ip地址

ifconfig

eth0      192.168.0.101

編輯源列表 gksu gedit /etc/apt/sources.list,在http://後面加上192.168.0.101/ubuntu-mirror-i386/,如下

#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

儲存,然後執行

sudo apt-get update 更新源列表

測試,安裝dia圖表製作軟體

sudo apt-get install dia

下載7M多軟體包1秒完成。

2 直接檔案訪問

如果不想安裝web服務,可以直接檔案訪問映象。

修改 /etc/apt/sources.list

將http://192.168.0.101/ubuntu-mirror-i386/全部替換為file:///var/spool/apt-mirror-i386/mirror/即可

儲存,然後執行

sudo apt-get update 更新源列表

此方法可以不建立軟連線

如果映象在移動磁碟,路徑替換為移動磁碟映象就行了

==================================================================

apt-mirror可以隨時ctrl+c退出,重新開始。利用空閒時間建立的ubuntu映象,顯著減少了安裝軟體包的下載時間,提高了效率。

對於當前以T計的磁碟容量,儲存映象早已不是問題。

相關推薦

ubuntu14.04apt-mirror 製作ubuntu本地映象

sudo apt-get install apt-mirror 首先修改/etc/apt/mirror.list,使用cn.archive.ubuntu.com的源作映象,即在所有archive.ubuntu.com前加上cn.:gksu gedit /etc/apt/mi

ubuntu 18.04apt安裝mysql-server

應該 get client add 驗證方式 then ice 重啟 sta mysql5.7安裝完成後普通用戶不能進mysql 原因:root的plugin被修改成了auth_socket,用密碼登陸的plugin應該是mysql_native_password,直接用r

Ubuntu14.04安裝記錄(專用2) ubuntu下解除安裝opencv

6.安裝Ceres庫由於按照書上出現了“E未發現軟體包liblpack-dev的錯誤”,故另參考流程如下https://blog.csdn.net/felaim/article/details/60138647安裝g2o庫7.編譯安裝VTK庫(筆者使用的系統是Ubuntu14.04,為保險起見安裝的

ubuntu本地軟體製作

1.安裝dpkg-dev疊變工具 sudo  apt-get install dpkg-dev 2.當前使用者目錄下建立software目錄 mkdir  ~/software 3.將archives目錄下所有檔案複製到當前使用者的software目錄下 cp

Ubuntu14.04PPTP搭建VPN

採用PPTP搭建VPN,優點是配置簡單快捷。將親身過程記錄下來供親們參考,並將過程中遇到的問題也一一列舉出來解決方式。。。 準備工作 1.先看看你的主機是否支援pptp,返回結果為yes就表示通過。 modprobe ppp-compress-18 && e

ubuntu14.04fstab掛載分割槽寫入許可權問題

安裝ubuntu時分了90G,系統自動分了兩個區。用fstab檔案掛載第二個分割槽後,向裡拷貝檔案時出錯,提示許可權問題。百度了N多次,都是讓改fstab中的option,我把引數試了一圈 還是不行。再後來懷疑是檔案系統格式有問題,又用命令重新格式化   sudo umou

【Linux】ubuntu更改映象地址

目錄 1、首先檢視當前映象源 2、更改映象源(兩種方法:終端和視覺化工具) 2.1在終端中修改映象源: 2.2使用視覺化工具更改映象源 1、首先檢視當前映象源 在終端中: ☞cd /etc/apt ☞ls  ☞sudo vim s

ubuntu更改映象

修改apt源: vim /etc/apt/sources.list 然後修改為下面的內容, 金山雲: deb http://apt.ksyun.cn/ubuntu/ xenial main re

Ubuntu配置映象

源是我們下載軟體的源頭,類似電腦360的那個軟體管理。配置源就是把系統自帶的修改成國內的源,為的是下載速度。 國內的映象源很多,網易163,sohu,阿里雲,中科,清華等。。 先備份Ubuntu自帶的源 sudo cp /etc/apt/

centos7 rhel7怎麼配置本地映象

rhel7 配置本地源教程 1. 先掛載映象ios,參見 http://blog.csdn.net/zkuncn/article/details/78449044  2.我這裡用的阿里映象站 centos7的源,修改源見 http://blog.csdn.net/zk

apt-mirror建立本地ubuntu倉庫

首先,我們要安裝apt-mirror $sudo apt-get install apt-mirror 假設我們將映象等檔案放在 /service/Ubuntu資料夾下: 請事先新建以下資料夾(mirror.list裡面提示要我們事先新建資料夾的): /servi

Ubuntu14.04下安裝 ffmpeg-2.4.13(處理視頻,將視頻保存為圖片序列)

ibm blog 提取 ext aac sta video images bmp 首先在 http://www.ffmpeg.org/olddownload.html 下載 ffmpeg-2.4.13.tar.bz2 ; 然後安裝 yasm 和 libx264: apt

ubuntu14.04 ssh允許root戶遠程登錄

start onf restart tro authent rest sta 服務 sshd vi /etc/ssh/sshd_config #註釋掉 #PermitRootLogin without-password # Authentication: LoginG

Ubuntu 17.10 apt 搭建 lamp 環境、安裝 phpmyadmin、redis 及擴展、mysql 擴展、開啟錯誤提示、配置虛擬主機

www data 4.2 pass ech span grace 參考 配置文件 最終環境: Ubuntu17.10、Apache2.4.27、MySQL5.7.20、PHP7.1 1. 安裝 apache 官方源有,直接安裝: sudo apt-get

Ubuntu 16.04安裝MinGW32(在/etc/apt/sources.list裏添加

.html /etc/ arc edi 執行 return lin 一個 linux Ubuntu 16.04下直接使用命令安裝MinGW32: sudo apt-get install mingw32 但是,會報錯: Unable to locate pack

Ubuntu 16.04 通過 apt 安裝 RabbitMQ

key 普通用戶 pre tor sun left dev 增加 users 添加公鑰wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -更新軟件包su

在服務器上U盤安裝Ubuntu server 16.04 LTS

問題 通過 top www mnt all 容量 差異 bubuko 準備工作: 1.下載ubuntu-16.04.4-server-amd64.iso 註:此文件為服務器版本,同桌面版其實沒有太大差異,只是少了GUI,但是之前嘗試在服務器上安裝desktop版失敗,故該安

Ubuntu非LTS長久支持版不能apt-get更新軟件的問題

linux 更新 Ubuntu非LTS長久支持版不能用apt-get更新軟件源的問題 參考文獻鏈接:http://blog.csdn.net/jscese/article/details/39010273 情況:目前Ubutun版本更新叠代太快~常規版本的維護期都比較短,基本一年以內,只有LTS版本才

每個Ubuntu 18.04戶都應該知道13鍵盤快捷方式!

邊緣 我不 roc 字母 ctrl + c 版本 strong 通過 ffffff 了解鍵盤快捷鍵可以提高你的工作效率。這裏有一些有用的Ubuntu快捷鍵,可以幫助你像專業版一樣使用Ubuntu。 你可以使用鍵盤和鼠標結合的操作系統~~~ 註意:下面提到的鍵盤快捷鍵適用於

怎樣在 Ubuntu 16.04 強制 APT 包管理器使用 IPv4 | Linux 中國

man details 1.8 推出 png bcm 基於 styles 網絡 版權聲明:本文為博主原創文章,未經博主同意不得轉載。 https://blog.csdn.net/F8qG7f9YD02Pe/article/details