Linux
[Linux] local repo 만들기 ubuntu
plastic2113
2023. 10. 10. 14:00
728x90
반응형
1. 패키지 설치
apt install apt-mirror
공식 지원 apt-mirror가 오래되어
git clone https://github.com/Stifler6996/apt-mirror
을 사용하기 위해 원본 백업 후 git에서 가져온 apt-mirror사용
mv /usr/bin/apt-mirror /usr/bin/apt-mirror_backup
cp apt-mirror/apt-mirror /usr/bin/apt-mirror
chmod 755 /usr/bin/apt-mirror
chown root:root /usr/bin/apt-mirror
확인을 위한 apache설치
728x90
2. mirror.list 수정
mirror.list의 [apt_mirror_path]를 base파일을 받을 경로로 수정, 버전에 맞는 list 추가
############# config ##################
#
# set base_path /var/spool/apt-mirror
set base_path [apt_mirror_path]
#
# 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 ##############
# bionic 18.04
deb http://kr.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb http://kr.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://kr.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
# focal 20.04
deb http://vcore.clouds.archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://vcore.clouds.archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://vcore.clouds.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted universe multiverse
# jammy 22.04
deb http://mirror.kakao.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirror.kakao.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirror.kakao.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://mirror.kakao.com/ubuntu jammy-security main restricted universe multiverse
clean http://archive.ubuntu.com/ubuntu
반응형
3. apt-mirror 실행
apt-mirror
4. apache 설정
apache에서 확인할 디렉토리 권한 및 링크 설정
mkdir /var/www/[repo]
chown www-data:www-data /var/www/[repo]/mirror
ln -s [apt_mirror_path]/mirror /var/www/[repo]
/etc/apache2/site-enable/000-default.conf *documentroot /var/www/[repo]
service apache2 restart
5. client 설정
각 버전에 맞게 /etc/apt/source.list 수정
# 18.04
deb http://[local-repo-IP]/mirror/kr.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb http://[local-repo-IP]/mirror/kr.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://[local-repo-IP]/mirror/kr.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://[local-repo-IP]/mirror/security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
# 20.04
deb http://[local-repo-IP]/mirror/vcore.clouds.archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://[local-repo-IP]/mirror/vcore.clouds.archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://[local-repo-IP]/mirror/vcore.clouds.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://[local-repo-IP]/mirror/security.ubuntu.com/ubuntu focal-security main restricted universe multiverse
# 22.04
deb http://[local-repo-IP]/mirror/mirror.kakao.com/ubuntu/ jammy main restricted universe multiverse
deb http://[local-repo-IP]/mirror/mirror.kakao.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://[local-repo-IP]/mirror/mirror.kakao.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://[local-repo-IP]/mirror/mirror.kakao.com/ubuntu jammy-security main restricted universe multiverse
728x90
반응형