Ubuntu Server / apt / 패키지 설치, 삭제, 업그레이드하는 명령어

Ubuntu에서 패키지를 관리하는 명령어는 여러 가지가 있습니다. 그 중 널리 사용되는 것은 apt-get과 apt입니다. 아래는 apt를 이용하여 패키지를 설치하고 삭제하고 업그레이드하는 방법입니다. 대부분의 경우 apt-get을 사용해도 작동합니다.

APT 사용법

  • 패키지 목록을 갱신합니다
apt update
  • 모든 패키지를 최신 버전으로 업그레이드합니다.
apt upgrade
  • abc 패키지를 설치합니다. 의존성있는 패키지도 함께 설치합니다.
apt install abc
  • abc 패키지를 삭제합니다. 설정 파일 등은 삭제하지 않습니다.
apt remove abc
  • 더 이상 필요 없는 패키지들을 삭제합니다.
apt autoremove
  • 설정 파일 등도 포함하여 abc 패키지를 삭제합니다.
apt purge abc
  • abc와 관련된 패키지를 검색합니다.
apt search abc
  • abc 패키지의 정보를 출력합니다.
apt show abc
  • 패키지 목록을 출력합니다.
apt list
  • 설치된 패키지 목록을 출력합니다.
apt list --installed
  • 업그레이드 가능한 패키지 목록을 출력합니다.
apt list --upgradable
  • 도움말을 출력합니다.
apt --help
apt 1.6.12 (amd64)
Usage: apt [options] command

apt is a commandline package manager and provides commands for
searching and managing as well as querying information about packages.
It provides the same functionality as the specialized APT tools,
like apt-get and apt-cache, but enables options more suitable for
interactive use by default.

Most used commands:
  list - list packages based on package names
  search - search in package descriptions
  show - show package details
  install - install packages
  remove - remove packages
  autoremove - Remove automatically all unused packages
  update - update list of available packages
  upgrade - upgrade the system by installing/upgrading packages
  full-upgrade - upgrade the system by removing/installing/upgrading packages
  edit-sources - edit the source information file

See apt(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
                                        This APT has Super Cow Powers.

저장소 변경하는 방법

우분투에서 패키지를 업데이트 하거나 설치하면, 미러 서버에서 소프트웨어를 다운로드하여 설치합니다. 그런데, 그 미러 서버가 멀리 있거나 속도가 느리다면, 패키지를 다운로드하는데 많은 시간이 소요됩니다. 속도가 너무 느려서 불편하다면 저장소를 지정하여 속도를 빠르게 할 수 있습니다.

저장소 설정은 /etc/apt/sources.list에서 합니다. 파일을 텍스트 에디터로 열고

http://archive.ubuntu.com/ubuntu

를 모두 변경합니다. 만약 한국이라면

http://mirror.kakao.com/ubuntu

으로 바꿔보세요.

참고로, 지역별 우분투 미러 서버 리스트는 여기서 확인할 수 있습니다.

같은 카테고리의 다른 글
Ubuntu 18.04 / 백신 프로그램 ClamAV 설치 및 사용법

Ubuntu 18.04 / 백신 프로그램 ClamAV 설치 및 사용법

ClamAV ClamAV는 우분투에 사용할 수 있는 백신 프로그램입니다. 패키지에 포함되어 있으므로 쉽게 설치하고 사용할 수 있습니다. 설치 apt install clamav 사용법 데이터베이스 업데이트 데이터베이스 업데이트는 자동으로 됩니다. 만약 수동으로 업데이트를 해야한다면 freshclam 와 같이 명령합니다. 만약 Can't find or parse configuration file /etc/clamav/clamd.conf와 같은 에러가 난다면 대몬을 설치해야 한다고 합니다. apt install clamav-daemon 에러가 나도 바이러스 정의는 업데이트되는 거 같습니다. 꼭 설치해야 ...

Ubuntu / 시간대(time zone) 설정하는 방법

Ubuntu / 시간대(time zone) 설정하는 방법

현재 서버의 시간대 확인 현재 서버에 설정된 시간대는 date 명령어로 확인할 수 있다. root@jb-dev-01:~# date Mon Dec 3 17:03:06 UTC 2018 시간대 설정 방법 1 - dpkg-reconfigure tzdata 시간대를 설정하고 싶다면 다음과 같이 명령한다. dpkg-reconfigure tzdata 한국이라면 Asia를 선택하고 Seoul을 선택합니다. 시간대 설정 방법 2 - tzselect tzselect 명령으로 설정할 수 있다. 번호를 입력하여 시간대를 정한다. root@ubuntu-1804-server:~# tzselect Please identify ...

Ubuntu Server / 업그레이드 하는 방법

Ubuntu Server / 업그레이드 하는 방법

Ubuntu 새 버전이 나오면 어떻게 업그레이드를 할까? 새로 설치하고 다시 설정하는 게 제일 좋지만, 설정할 게 많다면 바로 업그레이드를 할 수도 있다. 업그레이드는 do-release-upgrade 명령어로 한다. do-release-upgrade -h Usage: do-release-upgrade Options: -h, --help show this help message and exit -V, ...

Ubuntu 20.04 Server / 고정 IP 설정하는 방법

Ubuntu 20.04 Server / 고정 IP 설정하는 방법

네트워크 설정 파일은 /etc/netplan 디렉토리 안에 있는 yaml 파일이다. DHCP로 설치했다면, 설정 파일 내용은 다음과 비슷하게 되어 있다. # This is the network config written by 'subiquity' network: ethernets: enp0s3: dhcp4: true version: 2 다음과 같이 수정하고 저장한다. IP 등은 네트워크 환경에 맞게 적절히 ...

Ubuntu Server / root 계정으로 로그인하는 방법, root 계정으로 ssh 접속하는 방법

Ubuntu Server / root 계정으로 로그인하는 방법, root 계정으로 ssh 접속하는 방법

Ubuntu는 설치할 때 일반 사용자 계정만 만듭니다. 관리자 권한이 필요할 때는 sudo를 이용하죠. 그런데 공부를 위해 혼자만 사용하거나, 여러 가지 이유로 보안에 문제가 없는 경우 root 계정으로 로그인해서 작업하는 게 편합니다. root 계정으로 로그인 하는 방법 일반 사용자 계정으로 로그인합니다. 다음과 같이 명령하여 root 계정의 비밀번호를 만들면 root 계정으로 로그인할 수 있습니다. sudo passwd ...

Ubuntu / Webmin / 설치하는 방법

Ubuntu / Webmin / 설치하는 방법

Webmin은 웹브라우저를 통해 시스템 관리를 하는 툴이다. Webmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a ...

Ubuntu Server / PHP 최신 버전으로 업그레이드하는 방법

Ubuntu Server / PHP 최신 버전으로 업그레이드하는 방법

Ubuntu 패키지로 설치한 PHP 버전보다 PHP 최신 버전이 더 높을 수 있습니다. 예를 들어 패키지로 설치한 PHP의 버전은 7.0, 최신 버전은 7.2일 수 있다는 것이죠. 만약 최신 버전의 PHP를 사용해야 한다면 다음의 방법으로 설치할 수 있습니다. PHP를 처음 설치하는 경우 저장소를 추가합니다. add-apt-repository ppa:ondrej/php 패키지 정보를 업데이트합니다. apt-get update PHP를 설치합니다. apt-get install php PHP가 설치되어 있는 경우 저장소를 ...

Ubuntu 18.04 / 메모

Ubuntu 18.04 / 메모

SSH 설정 설정 파일 /etc/ssh/sshd_config 포트 변경하기 다음 코드를 #Port 22 다음처럼 바꾼다. Port 1234 포트 번호는 자신이 원하는 것으로... root 계정 로그인 가능하게 만들기 다음 코드를 #PermitRootLogin prohibit-password 다음처럼 만든다. PermitRootLogin yes 설정 변경 적용하기 service ssh restart

Ubuntu Server / vsftpd로 FTP 서버 구축하기

Ubuntu Server / vsftpd로 FTP 서버 구축하기

vsftpd vsftpd(Very Secure FTP Daemon)는 유닉스와 리눅스에서 사용할 수 있는 가벼운 FTP 서버입니다. 주요 특징은 다음과 같습니다. Virtual IP configurations Virtual users Standalone or inetd operation Powerful per-user configurability Bandwidth throttling Per-source-IP configurability Per-source-IP limits IPv6 Encryption support through SSL integration 설치 vsftpd는 우분투 패키지에 포함되어 있으므로 다음과 같이 명령하여 설치할 수 있습니다. apt install vsftpd 방화벽을 사용 중이라면 다음과 같이 명령하여 포트를 열어줍니다. ufw ...

Ubuntu Server / Nginx, PHP, MariaDB 설치하고 설정하기

Ubuntu Server / Nginx, PHP, MariaDB 설치하고 설정하기

Nginx 설치 Nginx를 설치합니다. apt install nginx 만약 방화벽을 사용하고 있다면 포트를 열어줍니다. ufw allow 'Nginx Full' 서버 주소로 접속했을 때 다음과 같이 나오면 제대로 된 것입니다. 시작, 정지 등 Nginx를 시작합니다. systemctl start nginx Nginx를 멈춥니다. systemctl stop nginx Nginx를 재시작합니다. systemctl restart nginx Nginx를 다시 로드합니다. systemctl reload nginx Nginx를 설치하면 부팅 시 자동으로 시작하게 설정됩니다. 만약 자동 시작을 해제하고 싶다면 다음과 같이 명령합니다. systemctl ...