ฉันได้ตั้งค่าapt-mirror
และดาวน์โหลดแพคเกจ ubuntu ล่าสุดสำเร็จแล้วในเครื่องที่สามารถเข้าถึงอินเทอร์เน็ตได้ เป้าหมายคือการใช้เครื่องนี้เป็นที่เก็บเมื่อทำapt-get update
บนเครื่องเป้าหมายที่ไม่สามารถเข้าถึงอินเทอร์เน็ต เครื่องทั้งสองได้รับการตั้งค่าด้วยที่อยู่ IP ด้วยตนเองและทั้งสองเครื่องกำลังทำงานกับ Ubuntu 16.04 เป็นระบบปฏิบัติการ etc/apt/sources.list
ในเครื่องเป้าหมายมีเพียง 1 บรรทัด:
deb http://<local_repo_IP>/ubuntu/ xenial main restricted multiverse universe
แต่เมื่อฉันทำsudo apt-get update
บนเครื่องเป้าหมายฉันได้รับข้อผิดพลาดต่อไปนี้:
Ign:1 http://<local_repo_IP>/ubuntu/dists/xenial main InRelease
Ign:2 http://<local_repo_IP>/ubuntu/dists/xenial main Release
Ign:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Ign:14 http://<local_repo_IP>/ubuntu/dists/xenial main/universe i386 Packages
Ign:15 http://<local_repo_IP>/ubuntu/dists/xenial main/universe all Packages
Ign:16 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en_HK
Ign:17 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en
Ign:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Ign:14 http://<local_repo_IP>/ubuntu/dists/xenial main/universe i386 Packages
Ign:15 http://<local_repo_IP>/ubuntu/dists/xenial main/universe all Packages
Ign:16 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en_HK
Ign:17 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en
Ign:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Ign:14 http://<local_repo_IP>/ubuntu/dists/xenial main/universe i386 Packages
Ign:15 http://<local_repo_IP>/ubuntu/dists/xenial main/universe all Packages
Ign:16 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en_HK
Ign:17 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en
Ign:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Ign:14 http://<local_repo_IP>/ubuntu/dists/xenial main/universe i386 Packages
Ign:15 http://<local_repo_IP>/ubuntu/dists/xenial main/universe all Packages
Ign:16 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en_HK
Ign:17 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en
Ign:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Ign:14 http://<local_repo_IP>/ubuntu/dists/xenial main/universe i386 Packages
Ign:15 http://<local_repo_IP>/ubuntu/dists/xenial main/universe all Packages
Ign:16 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en_HK
Ign:17 http://<local_repo_IP>/ubuntu/dists/xenial main/universe Translation-en
Err:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
404 Not Found
Ign:4 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted i386 Packages
Ign:5 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted all Packages
Ign:6 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en_HK
Ign:7 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted Translation-en
Ign:8 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse amd64 Packages
Ign:9 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse i386 Packages
Ign:10 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse all Packages
Ign:11 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en_HK
Ign:12 http://<local_repo_IP>/ubuntu/dists/xenial main/multiverse Translation-en
Ign:13 http://<local_repo_IP>/ubuntu/dists/xenial main/universe amd64 Packages
Reading package lists... Done
W: The repository 'http://<local_repo_IP>/ubuntu/dists/xenial main Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://<local_repo_IP>/ubuntu/dists/xenial/dists/main/restricted/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
บนเครื่องเป้าหมาย:
/etc/resolve.conf
ไฟล์มีดังต่อไปนี้:# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.1.1
/etc/network/interfaces
มีดังต่อไปนี้:# interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback
นอกจากนี้เนื่องจากมีเพียงบรรทัดเดียวในผลลัพธ์ของapt-get update
ข้อผิดพลาดนั้นอย่างชัดเจนErr:3 http://<local_repo_IP>/ubuntu/dists/xenial main/restricted amd64 Packages
ฉันจึงตรวจสอบว่ามีไฟล์อยู่ด้วยการทำสิ่งต่อไปนี้ในเครื่องเป้าหมาย
wget http://<local_repo_IP>/ubuntu/dists/xenial/restricted/binary-amd64/Packages
และฉันเห็นว่าไฟล์อยู่ที่นั่นเพราะฉันได้ผลลัพธ์ต่อไปนี้:
--2017-12-21 17:23:24-- http://<local_repo_IP>/ubuntu/dists/xenial/restricted/binary-amd64/Packages
Connecting to <local_repo_IP>:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 127112 (124K)
Saving to: ‘Packages’
Packages 100%[============================>] 124.13K --.-KB/s in 0s
2017-12-21 17:23:24 (469 MB/s) - ‘Packages’ saved [127112/127112]
ฉันยังตรวจสอบเพื่อดูว่าฉันสามารถ ping ได้สำเร็จจากเครื่องเป้าหมายไปยังเครื่อง repo ที่ได้ผลเช่นกัน
PING <local_repo_IP> (<local_repo_IP>) 56(84) bytes of data.
64 bytes from <local_repo_IP>: icmp_seq=1 ttl=64 time=0.169 ms
64 bytes from <local_repo_IP>: icmp_seq=2 ttl=64 time=0.671 ms
64 bytes from <local_repo_IP>: icmp_seq=3 ttl=64 time=0.186 ms
64 bytes from <local_repo_IP>: icmp_seq=4 ttl=64 time=0.190 ms
64 bytes from <local_repo_IP>: icmp_seq=5 ttl=64 time=0.315 ms
^C
--- <local_repo_IP> ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4047ms
rtt min/avg/max/mdev = 0.169/0.306/0.671/0.190 ms
ดังนั้นมีอะไรผิดปกติกับapt-get update
? ฉันจะแก้ไขและทำให้มันทำงานได้อย่างไร
PShttp://<local_repo_IP>/ubuntu/dists/xenial/dists/main/restricted/binary-amd64/Packages
ฉันเพิ่งสังเกตเห็นว่าข้อผิดพลาดกล่าวว่า เหตุใดจึงพยายามค้นหาrestricted
แพคเกจภายในตัวเครื่อง มันไม่ควรมองเข้าไปhttp://<local_repo_IP>/ubuntu/dists/xenial/restricted/binary-amd64/Packages
เหรอ? ที่จริงเมื่อฉันทำwget http://<local_repo_IP>/ubuntu/dists/xenial/dists/main/restricted/binary-amd64/Packages
มันให้ข้อผิดพลาดต่อไปนี้:
--2017-12-21 17:26:06-- http://<local_repo_IP>/ubuntu/dists/xenial/dists/main/restricted/binary-amd64/Packages
Connecting to <local_repo_IP>:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-12-21 17:26:06 ERROR 404: Not Found.
เกิดอะไรขึ้นที่นี่? เหตุใดจึงพยายามตรวจสอบไดเรกทอรีที่ไม่มีอยู่ และฉันจะapt-get update
ชี้ไปยังเส้นทางที่ถูกต้องได้อย่างไร