서버 구축/우분투 설정

우분투 서버 설정 시 apt 에러 정리

Mr.robot 2 2022. 12. 21. 14:13

이번에 서버용 미니pc를 구매했다. 우분투 서버를 구축하면서 에러 발생한 부분을 정리하고자한다.

 

우선 apt-get update의 경우 서버가 느릴때 다운로드가 엄청 느려진다. 이를 방지하기 위해 국내에 있는 서버를 이용하여 pakage를 다운받아준다.

 

vi /etc/apt/sources.list

위 경로로 들어가

최상단 선택 단축키 (gg)

선택 이하 전체 삭제 (dG) <- g+shift

 

위 vi 명령어로 전부 삭제하고 아래 코드를 집어 넣는다.

deb http://mirror.kakao.com/ubuntu bionic main restricted universe multiverse
deb http://mirror.kakao.com/ubuntu bionic-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse

저장 후 apt-get update 를 하게 되면

 

The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32

 

라는 오류 문구가 뜰 수 있다. 이 문구의 경우 공개키(B4FE6ACC0B21F32) 설정이 되어 있지 않다는 건데 이를 직접 추가해줘야한다.

공개키의 경우 사용자마자 다를 수 있으니 에러에 나오는 문구를 맨뒤에 붙여준다.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 3B4FE6ACC0B21F32

하지만 산넘어 산이라고 apt-get update시 아래와 같은 오류가 또 발생할 것이다.

이 문제의 경우 "우분투 22.04부터 apt-key를 이용하여 저장소용 gpg 키를 추가하는 것을 경고하는 메세지"라고 검색 시 나오더라

 

http://mirror.kakao.com/ubuntu/dists/bionic/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

 

이를 없애는 방법은 하단 링크에서 해결했다.

https://stackoverflow.com/questions/73570418/w-key-is-stored-in-legacy-trusted-gpg-keyring-etc-apt-trusted-gpg-see-the-d

 

W: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details

I have installed gazebo on my ubuntu 22.04 LTS following the steps in https://classic.gazebosim.org/tutorials?tut=install_ubuntu via their alternative installation. I am getting the following error...

stackoverflow.com

간단하게 아래 명령어로 하니  에러가 전부 사라졌다. 

cd /etc/apt

sudo cp trusted.gpg trusted.gpg.d