赞
踩
上传dvd1.iso,dvd2.iso,dvd3iso镜像到系统下
# mkdir /root/ISO
# ls -l debian-10.6.0-amd64-DVD-*
-rw-r--r-- 1 root root 3972317184 Apr 18 08:55 debian-10.6.0-amd64-DVD-1.iso
-rw-r--r-- 1 root root 4686921728 Apr 18 08:55 debian-10.6.0-amd64-DVD-2.iso
-rw-r--r-- 1 root root 4640186368 Apr 18 08:54 debian-10.6.0-amd64-DVD-3.iso
# mkdir /mnt/source{1..3}
mount -o loop /root/ISO/debian-10.6.0-amd64-DVD-1.iso /mnt/source1
mount -o loop /root/ISO/debian-10.6.0-amd64-DVD-2.iso /mnt/source2
mount -o loop /root/ISO/debian-10.6.0-amd64-DVD-3.iso /mnt/source3
# vim /etc/fstab
/root/ISO/debian-10.6.0-amd64-DVD-1.iso /mnt/source1 udf,iso9660 user,loop 0 0
/root/ISO/debian-10.6.0-amd64-DVD-2.iso /mnt/source2 udf,iso9660 user,loop 0 0
/root/ISO/debian-10.6.0-amd64-DVD-3.iso /mnt/source3 udf,iso9660 user,loop 0 0
# vim /etc/apt/sources.list
deb [trusted=yes] file:///mnt/source1 buster contrib main
deb [trusted=yes] file:///mnt/source2 buster contrib main
deb [trusted=yes] file:///mnt/source3 buster contrib main
配置文件中 buster 是debian10的代号,若为其他版本需要改为对应代号
apt update
apt install vim
此文搭建apt源的http Server配置如下
OS: CentOS 7U6,
IP: 192.168.15.10
2.1、 安装Http服务和xml生成工具,由于安装系统时已经顺便安装了相应的安装包,所以此处无须再进行安装。
[root@simonlinux ~]# yum install httpd createrepo
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Repository base is listed more than once in the configuration
Package httpd-2.4.6-88.el7.x86_64 already installed and latest version
Package createrepo-0.9.9-28.el7.noarch already installed and latest version
Nothing to do
2.2、 新建存放yum源文件的目录并将相关文件复制进去
[root@simonlinux smb]# ls -l
-rw-r--r-- 1 root root 3972317184 Apr 18 08:55 debian-10.6.0-amd64-DVD-1.iso
-rw-r--r-- 1 root root 4686921728 Apr 18 08:55 debian-10.6.0-amd64-DVD-2.iso
-rw-r--r-- 1 root root 4640186368 Apr 18 08:54 debian-10.6.0-amd64-DVD-3.iso
[root@simonlinux smb]# mkdir /mnt/source{1..3}
[root@simonlinux smb]# mount -o loop debian-10.6.0-amd64-DVD-1.iso /mnt/source1
mount: /dev/loop0 is write-protected, mounting read-only
[root@simonlinux smb]# mount -o loop debian-10.6.0-amd64-DVD-2.iso /mnt/source2
mount: /dev/loop0 is write-protected, mounting read-only
[root@simonlinux smb]# mount -o loop debian-10.6.0-amd64-DVD-3.iso /mnt/source3
mount: /dev/loop0 is write-protected, mounting read-only
[root@simonlinux ~]# mkdir -p /var/www/html/apt_sosurce/debian/10u6/source{1..3}
[root@simonlinuxt ~]# rsync -avh /mnt/source1 /var/www/html/apt_source/debian/10u6/source1
[root@simonlinux ~]# rsync -avh /mnt/source2 /var/www/html/apt_source/debian/10u6/source2
[root@simonlinux ~]# rsync -avh /mnt/source3 /var/www/html/apt_source/debian/10u6/source3
2.3、启动http服务
[root@simonlinux ~]# systemctl restart httpd [root@simonlinux ~]# systemctl status httpd ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2023-04-19 22:26:29 CST; 7s ago Docs: man:httpd(8) man:apachectl(8) Process: 15983 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS) Main PID: 15989 (httpd) Status: "Processing requests..." Tasks: 8 CGroup: /system.slice/httpd.service ├─15989 /usr/sbin/httpd -DFOREGROUND ├─15990 /usr/libexec/nss_pcache 491523 off ├─15994 /usr/sbin/httpd -DFOREGROUND ├─15995 /usr/sbin/httpd -DFOREGROUND ├─15996 /usr/sbin/httpd -DFOREGROUND ├─15997 /usr/sbin/httpd -DFOREGROUND └─15998 /usr/sbin/httpd -DFOREGROUND Apr 19 22:26:29 simonlinux.com systemd[1]: Starting The Apache HTTP Server... Apr 19 22:26:29 simonlinux.com systemd[1]: Started The Apache HTTP Server.
发现网页端无法打开,将网站端口添加到防火墙规则里并重启防火墙
[root@simonlinux ~]# firewall-cmd --add-port=80/tcp --permanent success [root@simonlinux ~]# systemctl restart firewalld.service [root@simonlinux ~]# firewall-cmd --list-all public (active) target: default icmp-block-inversion: no interfaces: eno1 sources: services: dhcpv6-client ssh ports: 5901-5905/tcp 80/tcp protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
设置http服务开机启动
[root@simonlinux ~]# systemctl enable httpd
# vim /etc/apt/sources.list
deb [trusted=yes] http://192.168.15.10/apt_source/debian/10u6/source1 buster contrib main
deb [trusted=yes] http://192.168.15.10/apt_source/debian/10u6/source2 buster contrib main
deb [trusted=yes] http://192.168.15.10/apt_source/debian/10u6/source3 buster contrib main
配置文件中 buster 是debian10的代号,若为其他版本需要改为对应代号
apt update
apt install vim
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。