도전2022

apt-get help 본문

작업/리눅스

apt-get help

hotdigi 2010. 7. 9. 19:18

http://achoho.egloos.com/4335546

2. apt-get (퍼온글)


우분투를 처음 설치하고는 SSH나 텔넷을 설치하려고 자료를 찾아보는데 apt-get 명령으로 다 하는 것이었다. 그런데 아무리

sudo apt-get install telnetd  

요렇게 쳐봐도 도무지 설치가 되지 않는것이었다.

 

자료를 한참 더 찾아보고 공부해보니 apt-get을 사용하기 전에 설정을 좀 해줘야 한다는 것이다.

말하자면 apt-get 명령을 실행하면 이 명령이 인터넷에서 자료를 가져오는데 이때 참조하는 것이

sources.list 파일이고 여기에 서버들의 주소를 저장해두게 되는 것이다.

그런데 한번 이렇게 쳐보니

sudo vi /etc/apt/sources.list

과연 안에 모든 내용이 주석으로 막혀 있었다. 이러니 명령이 실행이 안되지.

 

## sources.list

## General comments about the sources.list file

#deb http://kr.archive.ubuntu.com/ubuntu feisty main restricted

#deb-src http://kr.archive.ubuntu.com/ubuntu feisty main restricted

.....

.....

 

- #으로 시작되는 줄은 주석이다.

- deb : 이 저장소들은 바이너리나 이미 컴파일된 패키지들을 담고 있다. 대부분의 사용자에게 요구된다.

- deb-src : 이 저장소들은 패키지의 소스 코드를 담고 있다. 개발자들에게 유용하다.

- 주소란엔 주소를 넣는데 미러 사이트목록을 참조하여 넣는다.

- feisty : 배포판의 이름이나 버전.

- main & restricted : 섹션이름이나 컴포넌트. 스페이스로 구분하여 여러 섹션 이름을 사용할 수 있다.

- universe & Multiverse : 추가 소프트웨어 저장소

등의 의미를 가진다고 하고,,

이것은 기본적으로 다음과 같은 형태를 취한다.

 

deb http://host/debian (또는 /ubuntu) distribution section1 section2 section3
deb-src
http://host/debian (또는 /ubuntu) distribution section1 section2 section3

그리고 대개는 다음의 내용이 sources.list 에 기본으로 들어가 있다.

# See sources.list(5) for more information, especialy
# Remember that you can only use http, ftp or file URIs
# CDROMs are managed through the apt-cdrom tool.
deb
http://http.us.debian.org/debian stable main contrib non-free
deb
http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free
deb
http://security.debian.org stable/updates main contrib non-free
# Uncomment if you want the apt-get source function to work
#deb-src
http://http.us.debian.org/debian stable main contrib non-free
#deb-src
http://non-us.debian.org/debian-non-US stable/non-US main contrib non-l‘:rX<qî

 

첫번째 deb는 공식적인 아카이브를 가리키고 두번째는 non-US 아카이브이고 세번째는 데비안 보안 업데이트를 가리킨다. 고 되어있구만... (이 참조 문서는 데비안 것이니 데비안으로 되어있다.)

 

텍스트로 직접 수정해도 되지만 x윈도우의 노틸러스로 수정할 수도 있다.

http://gamza.tistory.com/21 에 설명되어 있다.

위의 것처럼 Daum의 미러로 설정해 보았더니 아래처럼 sources.list의 소스가 수정된다.

 

deb http://ftp.daum.net/ubuntu/ gutsy main universe restricted multiverse

deb-src http://ftp.daum.net/ubuntu/ gutsy universe main multiverse restricted #Added by software-properties

 

마지막으로 source.list 파일을 변경한 후에는

 

sudo apt-get update

 

를 실행하여야 한다. 이렇게 해야 수정한 소스가 적용이 되어서 APT가 사용하게 된다.

 

 

* 공부하는데 참고한 자료.

"APT HOWTO" 데비안 프로젝트

Gustavo Noronha Silva kou@debian.org, 한국어 번역: 양유성 yooseong@debian.org


+ apt-get 의 사용예.

apt-get update <- 최신버전의 패키지 목록을 얻어온다.
apt-get upgrade <- 현재 설치된 모든 패키지를 최신버전과 비교해서 업그레이드

apt-get install [패키지명] <- 패키지설치 apache* 이렇게 와일드문자 입력도 가능
apt-get remove [패키지명] <- 패키지 삭제. 허나 완전히 삭제는 아니다.
apt-get autoremove [패키지명] <- 패키지를 자동 삭제, 의존성이있어서 설치시에 따라설치된것들까지 삭제










apt-get autoremove
gcc 버전을 변경하기 위해서 기존 gcc를 제거하면, 관련된 것들을 모두 지워 주어야 한다.

http://www.debian.org/doc/manuals/debian-faq/ch-uptodate.en.html#s-apt

9.1.2 apt-get, dselect and apt-cdrom

apt-get is an APT-based command-line tool for handling packages, and the APT dselect method is an interface to APT through dselect. Both of these provide a simple, safe way to install and upgrade packages.

To use apt-get, install the apt package, and edit the /etc/apt/sources.list file to set it up, just as for aptitude, Section 9.1.1.

Then run

     apt-get update

followed by

     apt-get dist-upgrade

Answer any questions that might come up, and your system will be upgraded. See also the apt-get(8) manual page, as well as APT, Section 8.1.2.

To use APT with dselect, choose the APT access method in dselect's method selection screen (option 0) and then specify the sources that should be used. The configuration file is /etc/apt/sources.list. See also dselect, Section 8.1.6.1.

If you want to use CDs to install packages, you can use apt-cdrom. For details, please see the Release Notes, section "Setting up for an upgrade from a local mirror".

Please note that when you get and install the packages, you'll still have them kept in your /var directory hierarchy. To keep your partition from overflowing, remember to delete extra files using apt-get clean and apt-get autoclean, or to move them someplace else (hint: use apt-move).

http://www.debian.org/doc/manuals/debian-faq/ch-uptodate.en.html#s-aptitude-upgrade

9.1.1 aptitude

APT is an advanced interface to the Debian packaging system. It features complete installation ordering, multiple source capability and several other unique features, see the User's Guide in /usr/share/doc/apt-doc/guide.html/index.html (you will have to install the apt-doc package).

aptitude is the recommended package manager for Debian GNU/Linux systems. It is a text-based interface to APT using the curses library, and can be used to perform management tasks in a fast and easy way.

Before you can use aptitude, you'll have to edit the /etc/apt/sources.list file to set it up. If you wish to upgrade to the latest stable version of Debian, you'll probably want to use a source like this one:

     http://ftp.us.debian.org/debian stable main contrib non-free

You can replace ftp.us.debian.org with the name of a faster Debian mirror near you. See the mirror list at http://www.debian.org/mirror/list for more information.

More details on this can be found in the sources.list(8) manual page.

To update your system, run

     aptitude update

followed by

     aptitude dist-upgrade

Answer any questions that might come up, and your system will be upgraded. See also aptitude, Section 8.1.3.


http://www.debian.org/doc/manuals/debian-faq/ch-pkgtools.en.html#s-apt-get

8.1.2 APT

APT is the Advanced Package Tool and provides the apt-get program. apt-get provides a simple way to retrieve and install packages from multiple sources using the command line. Unlike dpkg, apt-get does not understand .deb files, it works with the packages proper name and can only install .deb archives from a source specified in /etc/apt/sources.list. apt-get will call dpkg directly after downloading the .deb archives[5] from the configured sources.

Some common ways to use apt-get are:

  • To update the list of package known by your system, you can run:

         apt-get update
    

    (you should execute this regularly to update your package lists)

  • To upgrade all the packages on your system (without installing extra packages or removing packages), run:

         apt-get upgrade
    
  • To install the foo package and all its dependencies, run:

         apt-get install foo
    
  • To remove the foo package from your system, run:

         apt-get remove foo
    
  • To remove the foo package and its configuration files from your system, run:

    설치하다가 문제가 생기거나, 지우다가 문제가 생기거나 하면 다음 명령을 이용하여 완전히 지우고 다시 설치를 시도해보자.

         apt-get --purge remove foo
    
  • To upgrade all the packages on your system, and, if needed for a package upgrade, installing extra packages or removing packages, run:

         apt-get dist-upgrade
    

    (The command upgrade keeps a package at its installed obsolete version if upgrading would need an extra package to be installed, for a new dependency to be satisfied. The dist-upgrade command is less conservative.)

Note that you must be logged in as root to perform any commands that modify the system packages.

The apt tool suite also includes the apt-cache tool to query the package lists. You can use it to find packages providing specific functionality through simple text or regular expression queries and through queries of dependencies in the package management system. Some common ways to use apt-cache are:

  • To find packages whose description contain word:

         apt-cache search word
    
  • To print the detailed information of a package:

         apt-cache show package
    
  • To print the packages a given package depends on:

         apt-cache depends package
    
  • To print detailed information of the versions available for a package and the packages that reverse-depends on it:

         apt-cache showpkg package
    

For more information, install the apt package and read apt-get(8), sources.list(5) and install the apt-doc package and read /usr/share/doc/apt-doc/guide.html/index.html.



http://blog.outsider.ne.kr/346

apt-get(Advanced Packaging Tool)은 우분투(Ubuntu)를 포함안 데비안(Debian)계열의 리눅스에서 쓰이는 팩키지 관리 명령어 도구입니다. 우분투에는 GUI로 되어 있는시냅틱 꾸러미 관리자도 있기는 하지만 이런 저런 개발관련 패키지를 설치할 때는 커맨드기반인 apt-get이 더 편하기도 합니다. sudo는 superuser권한으로 실행하기 위함입니다.



패키지 인덱스 인덱스 정보를 업데이트 : apt-get은 인덱스를 가지고 있는데 이 인덱스는 /etc/apt/sources.list에 있습니다. 이곳에 저장된 저장소에서 사용할 패키지의 정보를 얻습니다.

sudo apt-get update


설치된 패키지 업그래이드 : 설치되어 있는 패키지를 모두 새버전으로 업그래이드 합니다.

sudo apt-get upgrade

의존성검사하며 설치하기

sudo apt-get dist-upgrade


패키지 설치

sudo apt-get install 패키지이름


패키지 재설치

apt-get --reinstall install 패키지이름


패키지 삭제 : 설정파일은 지우지 않음

sudo apt-get remove 패키지이름

설정파일까지 모두 지움

sudo apt-get --purge remove 패키지이름


패키지 소스코드 다운로드

sudo apt-get source 패키지이름


위에서 받은 소스코드를 의존성있게 빌드

sudo apt-get build-dep 패키지이름


패키지 검색

sudo apt-cache  search 패키지이름


패키지 정보 보기

sudo apt-cache show 패키지이름


apt를 이용해서 설치된 deb패키지는 /var/cache/apt/archive/ 에 설치가 됩니다.




'작업 > 리눅스' 카테고리의 다른 글

리눅스에서 JDK 설치  (0) 2010.07.23
MacBook을 이용해서 Ubuntu 설치 할때 확인하고 작업하세요.  (0) 2010.07.22
Linux Benchmarks  (0) 2010.07.09
LMbench  (0) 2010.07.09
리눅스 백업  (0) 2010.07.07