Ubuntu 18.04 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 Server / Let’s Encrypt 무료 SSL 인증서 발급 받기

Ubuntu Server에서 Apache Web Server를 사용하는 경우 Let’s Encrypt 인증서 발급 받는 방법이다. Apache용 Certbot 설치 Ubuntu Server 20.04, Ubuntu Server 22.04 snap install core snap refresh core snap install --classic certbot ln -s /snap/bin/certbot /usr/bin/certbot Ubuntu Server 18.04 apt install software-properties-common add-apt-repository universe add-apt-repository ppa:certbot/certbot apt update apt upgrade apt install certbot python3-certbot-apache Ubuntu Server 16.04 add-apt-repository ppa:certbot/certbot apt update apt upgrade apt install python-certbot-apache 인증서 발급 abc.com 인증서 ...

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

ClamAV ClamAV는 리눅스에서 사용할 수 있는 백신 프로그램이다. 우분투 패키지에 포함되어 있으므로 apt 명령으로 쉽게 설치하고 사용할 수 있다. 설치 # apt install clamav 사용법 데이터베이스 업데이트 clamav-freshclam 서비스를 중지한다. # systemctl stop clamav-freshclam freshclam 명령으로 업데이트한다. # freshclam clamav-freshclam 서비스를 시작한다. # systemctl start clamav-freshclam 검사 home 디렉토리와 그 하위 디렉토리를 검사한다. # clamscan -r /home 검사 결과는 다음처럼 나온다. ----------- SCAN SUMMARY ----------- Known viruses: ...

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 22.04 Server / 원격 데스크톱으로 연결하는 방법

Ubuntu 22.04 Server / 원격 데스크톱으로 연결하는 방법

GUI 설치 우분투에 GUI를 설치한다. # apt install ubuntu-desktop-minimal xrdp 설치 xrdp를 설치한다. # apt install xrdp 방화벽 설정 원격 데스크톱은 3389 포트를 사용하므로, 방화벽을 사용하고 있다면 포트를 열어 준다. ufw allow 3389/tcp 원격 데스크톱 연결 원격 데스크톱으로 접속한다. 아래와 같은 창이 뜨는데, 를 클릭한다. 계정 정보를 입력하고 를 클릭하면... 원격지에서 GUI로 우분투를 즐길 수 있다.

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

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

Ubuntu 18.04 Server / phpMyAdmin 설치하는 방법

Ubuntu 18.04 Server / phpMyAdmin 설치하는 방법

phpMyAdmin은 MySQL, MariaDB를 웹브라우저에서 관리할 수 있게 해주는 소프트웨어입니다. Ubuntu 18.04에 phpMyAdmin을 설치하고 설정하는 방법을 알아보겠습니다. 설치 apt install phpmyadmin 설치하는 과정에서 몇 가지 질문을 합니다. 사용하는 웹서버를 선택합니다. 비밀번호를 정하고... 다시 한 번 입력합니다. Yes를 선택하고 진행하면 설치가 끝납니다. 접속 웹브라우저로 서버 주소에 phpmyadmin을 붙여서 접속합니다. MySQL 또는 MariaDB의 사용자명과 암호를 입력해서 로그인하는데... root 계정으로 접속이 불가능할 수도 있습니다. 만약 root으로 ...

Ubuntu 22.04 Server / ZIP 압축 파일 푸는 방법

ZIP 파일을 압축 해제하기 위해서는 unzip 패키지가 필요하다. # apt install unzip xxx.zip 파일을 압축 해제하려면 다음과 같이 명령한다. # unzip xxx.zip 다음과 같이 명령하여 도움말을 볼 수 있다. # unzip -h 결과는 다음과 같다. UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP. Usage: unzip Default ...

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

네트워크 설정 파일은 /etc/netplan 디렉토리 안에 있는 yaml 파일이다. # ll /etc/netplan total 12 drwxr-xr-x 2 root root 4096 Apr 27 23:00 ./ drwxr-xr-x 108 root root 4096 Apr 27 23:06 ../ -rw------- 1 root root 389 Apr 27 23:00 50-cloud-init.yaml DHCP라면 설정 파일이 다음과 비슷하게 되어 있다. # This file is ...

Ubuntu 20.24 Server / Apache, PHP, MariaDB 설치하는 방법

Ubuntu 20.24 Server / Apache, PHP, MariaDB 설치하는 방법

Ubuntu Server에 웹서버 Apache, 웹프로그래밍 언어 PHP, 데이터베이스 MariaDB를 설치하는 방법입니다. 웹서버 운영을 위한 최소한의 설치로, 실제로 서비스할 때는 더 많은 패키지가 필요할 수 있습니다. 설치 Apache, PHP, MariaDB를 설치합니다. php-mysql은 PHP와 MariaDB 연동을 위한 패키지입니다. # apt install apache2 mariadb-server php php-mysql MariaDB 설정 다음과 같이 명령하여 몇 가지 설정을 합니다. # mysql_secure_installation MariaDB의 root 계정 ...

Ubuntu 24.04 Server / root 계정으로 로그인할 수 있게, ssh 접속할 수 있게 설정하는 방법

Ubuntu는 설치할 때 일반 사용자 계정만 만들고, 관리자 권한이 필요할 때는 sudo를 이용한다. 만약 보안에 문제가 없는 경우라면 root 계정으로 로그인하는 게 작업하는 게 편하다. root 계정으로 로그인할 수 있게 설정하는 방법 일반 사용자 계정으로 로그인한다. 다음과 같이 명령하여 root 계정의 비밀번호를 만들면 root 계정으로 로그인할 수 있다. # sudo passwd root root 계정으로 ssh ...