우분투 서버 업데이트
우분투 서버에서 root 권한도 있고, 인터넷 접속이 잘 된다면... 이제부터는 원하는 프로그램을 마음대로 설치할 수 있다. 그전에 Windows 환경에서 프로그램을 관리하는 걸 한번 생각해보자.
하나는 "윈도우즈 업데이트"를 통한 프로그램 설치(?)이다. 보통은 기존에 설치된 Windows 운영체제를 위한 보안 업데이트를 하는 경우가 많다. 꼭 Windows 때문이 아니더라도 Microsoft사의 프로그램이 설치되어 있다면 (예. 인터넷 익스플로러, 오피스) 해당 프로그램의 새로운 버젼을 업데이트할 수도 있다.
또 하나는 Microsoft 뿐만 아니라 아래아 한글이나 포토샵, 게임같이 소프트웨어 업체에서 만든 프로그램을 설치하는 경우인데, 설치 실행파일을 실행시켜면 인스톨러가 화면에서 설치를 진행한다. 프로그램을 잘 쓰다가 필요없게 되면 "제어판-프로그램 추가/삭제"에서 삭제를 해주면 되고...
어떤 프로그램은 알아서 업데이트 내용을 확인하여 업데이트에 필요한 파일만 다운받아서 설치를 해주거나 전체 프로그램을 다운받아서 기존 프로그램은 모두 지우고 재설치를 하기도 한다. 어떤 프로그램은 업데이트가 되던지 말던지 무관심으로 일조해서 사용자가 업데이트된 버젼을 확인하고 다운받아서 기존 프로그램은 삭제하고 재설치를 하는 경우도 있다. 어떤 프로그램은 인스톨러가 없어서 그냥 압축만 풀고 아무 디렉토리에나 옮겨놓고 써도 되는 경우도 있다.
우분투 서버는 터미널에서 apt-get 이라는 명령어로 거의 모든 프로그램(패키지)을 관리할 수 있다. "윈도우즈 업데이트"와 같은 것을 우분투 서버에서 한번 진행해보자.
우선 로그인을 해보면 아래와 같은 문구가 뜨는 경우가 있다. 수치는 다를 수 있는데, 15개의 패키지를 업데이트 할 수 있고 보안 업데이트가 2개가 있다는 내용인 것 같다.
Ubuntu 10.04 LTS
Welcome to the Ubuntu Server!
(중간생략)
15 packages can be updated.
2 update are security updates.
su 를 눌러 root 권한을 얻은 상태에서 프롬프트에서 아래와 같이 apt-get update 를 입력해 보자.
Hit http://kr.archive.ubuntu.com lucid Release.gpg
Ign http://kr.archive.ubuntu.com/ubuntu/ lucid/main Translation-en_US
Ign http://kr.archive.ubuntu.com/ubuntu/ lucid/restricted Translation-en_US
Ign http://kr.archive.ubuntu.com/ubuntu/ lucid/universe Translation-en_US
Ign http://kr.archive.ubuntu.com/ubuntu/ lucid/multiverse Translation-en_US
Hit http://kr.archive.ubuntu.com lucid-updates Release.gpg
Ign http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main Translation-en_US
Ign http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/restricted Translation-en_US
Ign http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/universe Translation-en_US
Ign http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/multiverse Translation-en_US
Hit http://kr.archive.ubuntu.com lucid Release
Hit http://kr.archive.ubuntu.com lucid-updates Release
Hit http://kr.archive.ubuntu.com lucid/main Packages
Hit http://kr.archive.ubuntu.com lucid/restricted Packages
Hit http://kr.archive.ubuntu.com lucid/main Sources
Hit http://kr.archive.ubuntu.com lucid/restricted Sources
Hit http://kr.archive.ubuntu.com lucid/universe Packages
Hit http://kr.archive.ubuntu.com lucid/universe Sources
Hit http://kr.archive.ubuntu.com lucid/multiverse Packages
Hit http://kr.archive.ubuntu.com lucid/multiverse Sources
Hit http://kr.archive.ubuntu.com lucid-updates/main Packages
Hit http://kr.archive.ubuntu.com lucid-updates/restricted Packages
Hit http://kr.archive.ubuntu.com lucid-updates/main Sources
Hit http://kr.archive.ubuntu.com lucid-updates/restricted Sources
Hit http://kr.archive.ubuntu.com lucid-updates/universe Packages
Hit http://kr.archive.ubuntu.com lucid-updates/universe Sources
Hit http://kr.archive.ubuntu.com lucid-updates/multiverse Packages
Hit http://kr.archive.ubuntu.com lucid-updates/multiverse Sources
Hit http://security.ubuntu.com lucid-security Release.gpg
Ign http://security.ubuntu.com/ubuntu/ lucid-security/main Translation-en_US
Ign http://security.ubuntu.com/ubuntu/ lucid-security/restricted Translation-en_US
Hit http://archive.canonical.com lucid Release.gpg
Ign http://archive.canonical.com/ lucid/partner Translation-en_US
Ign http://security.ubuntu.com/ubuntu/ lucid-security/universe Translation-en_US
Ign http://security.ubuntu.com/ubuntu/ lucid-security/multiverse Translation-en_US
Hit http://security.ubuntu.com lucid-security Release
Hit http://archive.canonical.com lucid Release
Hit http://security.ubuntu.com lucid-security/main Packages
Hit http://archive.canonical.com lucid/partner Packages
Hit http://security.ubuntu.com lucid-security/restricted Packages
Hit http://security.ubuntu.com lucid-security/main Sources
Hit http://security.ubuntu.com lucid-security/restricted Sources
Hit http://security.ubuntu.com lucid-security/universe Packages
Hit http://security.ubuntu.com lucid-security/universe Sources
Hit http://security.ubuntu.com lucid-security/multiverse Packages
Hit http://security.ubuntu.com lucid-security/multiverse Sources
Reading package lists... Done
apt-get update 명령어는 실제로 설치된 우분투 서버에 업데이트를 진행하는 것이 아니라, 지정되어 있는 인터넷의 패키지 저장창고(repository)에서 업데이트 할만한 패키지가 있는지 목록을 확인한다. 업데이트 해야될 내용이 있는 경우에는 Hit/Ign이 아닌 Get 으로 시작되면서 최신 패키지 목록을 다운받는다. 이미 다운받은 경우에는 다시 받지 않는다.
참고로, 우분투 10.04 는 lucid 라는 이름을 가지고 있고, 패키지 저장창고의 경로는 /etc/apt/sources.list 에서 확인할 수 있다.
최신 패키지 목록을 다운받았다면 apt-get upgrade 명령어를 입력하여 패키지의 실제 내용을 다운받아서 우분투 서버에 반영해 보자.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
linux-headers-server linux-image-server linux-server
The following packages will be upgraded:
apt apt-transport-https apt-utils libc-bin libc6 libglib2.0-0 mountall python-apt
update-manager-core
9 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 8,756kB of archives.
After this operation, 12.3kB of additional disk space will be used.
Do you want to continue [Y/n]?
리눅스 커널(kernel)과 관련된 내용이 표시되고 몇몇 패키지를 업데이트할 것인데 진행할 것인지 몰어본다. [Y/n]? 에서 그냥 엔터를 치면 Y로 인식되면서 계속 진행할 수 있다.
Get:2 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main libc6 2.11.1-0ubuntu7.1 [4,249kB]
Get:3 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main apt 0.7.25.3ubuntu9 [1,818kB]
Get:4 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main apt-utils 0.7.25.3ubuntu9 [238kB]
Get:5 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main libglib2.0-0 2.24.1-0ubuntu1 [1,123kB]
Get:6 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main mountall 2.15 [55.2kB]
Get:7 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main apt-transport-https 0.7.25.3ubuntu9 [80.9kB]
Get:8 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main python-apt 0.7.94.2ubuntu6.1 [187kB]
Get:9 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main update-manager-core 1:0.134.8 [195kB]
Fetched 8,756kB in 2s (3,093kB/s)
Preconfiguring packages ...
(Reading database ... 41919 files and directories currently installed.)
Preparing to replace libc-bin 2.11.1-0ubuntu7 (using .../libc-bin_2.11.1-0ubuntu7.1_amd64.deb) ...
Unpacking replacement libc-bin ...
Processing triggers for man-db ...
Setting up libc-bin (2.11.1-0ubuntu7.1) ...
(Reading database ... 41919 files and directories currently installed.)
Preparing to replace libc6 2.11.1-0ubuntu7 (using .../libc6_2.11.1-0ubuntu7.1_amd64.deb) ...
Unpacking replacement libc6 ...
Setting up libc6 (2.11.1-0ubuntu7.1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
(Reading database ... 41919 files and directories currently installed.)
Preparing to replace apt 0.7.25.3ubuntu7 (using .../apt_0.7.25.3ubuntu9_amd64.deb) ...
Unpacking replacement apt ...
Processing triggers for man-db ...
Setting up apt (0.7.25.3ubuntu9) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
(Reading database ... 41919 files and directories currently installed.)
Preparing to replace apt-utils 0.7.25.3ubuntu7 (using .../apt-utils_0.7.25.3ubuntu9_amd64.deb) ...
Unpacking replacement apt-utils ...
Preparing to replace libglib2.0-0 2.24.0-0ubuntu4 (using .../libglib2.0-0_2.24.1-0ubuntu1_amd64.deb) ...
Unpacking replacement libglib2.0-0 ...
Preparing to replace mountall 2.14 (using .../mountall_2.15_amd64.deb) ...
Unpacking replacement mountall ...
Preparing to replace apt-transport-https 0.7.25.3ubuntu7 (using .../apt-transport-https_0.7.25.3ubuntu9_amd64.deb) ...
Unpacking replacement apt-transport-https ...
Preparing to replace python-apt 0.7.94.2ubuntu6 (using .../python-apt_0.7.94.2ubuntu6.1_amd64.deb) ...
Unpacking replacement python-apt ...
Preparing to replace update-manager-core 1:0.134.7 (using .../update-manager-core_1%3a0.134.8_amd64.deb) ...
Unpacking replacement update-manager-core ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up apt-utils (0.7.25.3ubuntu9) ...
Setting up libglib2.0-0 (2.24.1-0ubuntu1) ...
Setting up mountall (2.15) ...
Setting up apt-transport-https (0.7.25.3ubuntu9) ...
Setting up python-apt (0.7.94.2ubuntu6.1) ...
Processing triggers for python-central ...
Setting up update-manager-core (1:0.134.8) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for python-central ...
위의 내용은 패키지(Package)를 다운받고(Get) 압축을 푼다음(Unpacking) 설정(Setting)까지 일사천리로 진행한 것으로 이해하면 될 것 같다. 보통의 경우에는 패키지를 업데이트하고 나서 서버를 재부팅하지 않아도 된다. 그런데 자세히 보면 뭔가 빠진 듯한 느낌이 든다. 다시한번 apt-get upgrade 를 입력해보자.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
linux-headers-server linux-image-server linux-server
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
리눅스 커널(kenel)이 업그레이드 된 경우에는 서버를 재부팅해야 하는 작업이기 때문에 별도로 apt-get dist-upgrade를 입력해서 업데이트를 진행해야 한다. apt-get upgrade 에서는 keep back 된 상태로 되어 있어서 표시는 되지만 설치가 되지 않는다. 우분투 서버 자체가 버젼업(예 9.04->10.04)이 된 경우에는 do-release-upgrade 를 입력한다.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
linux-headers-2.6.32-22 linux-headers-2.6.32-22-server linux-image-2.6.32-22-server
The following packages will be upgraded:
linux-headers-server linux-image-server linux-server
3 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 41.6MB of archives.
After this operation, 210MB of additional disk space will be used.
Do you want to continue [Y/n]?
다운받을 용량은 41.6MB 이고, 디스크에 차지하는 용량은 210MB 나 된다고 한다. 일단, 계속 진행해보자.
Get:2 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-2.6.32-22 2.6.32-22.33 [9,868kB]
Get:3 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-2.6.32-22-server 2.6.32-22.33 [747kB]
Get:4 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-server 2.6.32.22.23 [3,964B]
Get:5 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-server 2.6.32.22.23 [3,968B]
Get:6 http://kr.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-image-server 2.6.32.22.23 [3,974B]
Fetched 41.6MB in 8s (4,708kB/s)
Selecting previously deselected package linux-image-2.6.32-22-server.
(Reading database ... 41919 files and directories currently installed.)
Unpacking linux-image-2.6.32-22-server (from .../linux-image-2.6.32-22-server_2.6.32-22.33_amd64.deb) ...
Done.
Selecting previously deselected package linux-headers-2.6.32-22.
Unpacking linux-headers-2.6.32-22 (from .../linux-headers-2.6.32-22_2.6.32-22.33_all.deb) ...
Selecting previously deselected package linux-headers-2.6.32-22-server.
Unpacking linux-headers-2.6.32-22-server (from .../linux-headers-2.6.32-22-server_2.6.32-22.33_amd64.deb) ...
Preparing to replace linux-headers-server 2.6.32.21.22 (using .../linux-headers-server_2.6.32.22.23_amd64.deb) ...
Unpacking replacement linux-headers-server ...
Preparing to replace linux-server 2.6.32.21.22 (using .../linux-server_2.6.32.22.23_amd64.deb) ...
Unpacking replacement linux-server ...
Preparing to replace linux-image-server 2.6.32.21.22 (using .../linux-image-server_2.6.32.22.23_amd64.deb) ...
Unpacking replacement linux-image-server ...
Setting up linux-image-2.6.32-22-server (2.6.32-22.33) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.32-22-server
Running postinst hook script /usr/sbin/update-grub.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.32-22-server
Found initrd image: /boot/initrd.img-2.6.32-22-server
Found linux image: /boot/vmlinuz-2.6.32-21-server
Found initrd image: /boot/initrd.img-2.6.32-21-server
Found memtest86+ image: /boot/memtest86+.bin
done
Setting up linux-headers-2.6.32-22 (2.6.32-22.33) ...
Setting up linux-headers-2.6.32-22-server (2.6.32-22.33) ...
Setting up linux-headers-server (2.6.32.22.23) ...
Setting up linux-image-server (2.6.32.22.23) ...
Setting up linux-server (2.6.32.22.23) ...
업데이트 과정은 위에서 진행했던 것과 거의 비슷해 보인다. 중요한 내용을 업데이트했으니 서버를 재기동(reboot)하자. 참고로 우분투 서버를 끄려고 한다면 halt 를 입력하면 된다.
Broadcast message from root@ubuntu
(/dev/pts/0) at 4:28 ...
The system is going down for reboot NOW!
정리하자면 우분투 서버에서 기존에 설치되어 있는 프로그램(패키지)을 업데이트하려면 apt-get update, apt-get upgrade 또는 apt-get dist-upgrade 를 입력해서 진행하고 필요하다면 우분투 서버를 재기동(reboot) 하면 된다. 진행과정이 화면에 표시가 되니까 복잡해 보이는 것이지 정말 간단하지 않은가?
끝.