Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
우분투(ubuntu)의 apt 기본 미러를 다음 카카오(kakao), 네오위즈(neowiz), harukasan 으로 변경
#!/bin/sh
SL=/etc/apt/sources.list
PARAM="r:hm:dna"
KAKAO=mirror.kakao.com
NEOWIZ=ftp.neowiz.com
HARU=ftp.harukasan.org
function usage {
echo "USAGE: $0 [OPTION] ";
echo -e "\r\n-b : make backup file";
echo "-r[sources.list] : specify source list file (default ${SL})"
echo "-m[mirror-url] : speficy mirror site url"
echo "-k : use kakao mirror (${KAKAO})"
echo "-n : use neowiz mirror (${NEOWIZ})"
echo "-a : use harukasan mirror (${HARU})"
exit 0;
}
REPOS=${KAKAO}
while getopts $PARAM opt; do
case $opt in
r)
echo "-r option was supplied. OPTARG: $OPTARG" >&2
SL=$OPTARG;
;;
m)
echo "Using mirror repository(${OPTARG})." >&2
REPOS=${OPTARG}
;;
k)
echo "Using Kakao repository(${KAKAO})." >&2
REPOS=${KAKAO}
;;
n)
echo "Using neowiz repository(${NEOWIZ})." >&2
REPOS=${NEOWIZ}
;;
a)
echo "Using harukasan repository(${HARU})." >&2
REPOS=${HARU}
;;
h)
usage;
;;
esac
done
echo "using repository(${REPOS})"
## change mirror
sed -i.bak -re "s/([a-z]{2}.)?archive.ubuntu.com|security.ubuntu.com/${REPOS}/g" ${SL}
## check
apt update
@realmovestar

This comment has been minimized.

Copy link

commented Dec 11, 2018

이건 어떨까요 (sed -i option)
sed -E -e 's/(us.)?archive.ubuntu.com/ftp.daumkakao.com/g' -e 's/security.ubuntu.com/ftp.daumkakao.com/g' -i.org ${SL}

@GODGANG4885

This comment has been minimized.

Copy link

commented Feb 7, 2019

다음 카카오 서버 주소가 mirror.kakao.com으로 바꼈네요
sudo sed -i -re 's/([a-z]{2}.)?archive.ubuntu.com|security.ubuntu.com/mirror.kakao.com/g' /etc/apt/sources.list

@lesstif

This comment has been minimized.

Copy link
Owner Author

commented Feb 14, 2019

의견 주신대로 카카오 서버 주소 바꾸고 여러 미러 지정하는 옵션도 추가 했습니다.

카카오 사용

sudo bash ./change-ubuntu-mirror.sh -k

neowiz 사용

sudo bash ./change-ubuntu-mirror.sh -n
@saeparan

This comment has been minimized.

Copy link

commented Mar 8, 2019

굳굳

@lesstif

This comment has been minimized.

Copy link
Owner Author

commented Mar 21, 2019

CentOS 미러 변경은 yum-mirror-change.php를 참고하세요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.