Ubuntu에 curl 설치하기: apt와 snap을 활용한 초보자 친화 가이드

1. Beginner’s Guide: How to Install curl on Ubuntu (apt & snap)

What is curl?

curl은 명령줄에서 데이터를 전송할 수 있게 해 주는 오픈 소스 도구입니다. HTTP, HTTPS, FTP 등 다양한 프로토콜을 지원하여 API 요청 전송이나 파일 다운로드 등 여러 용도로 활용할 수 있습니다.

Benefits of Using curl on Ubuntu

Ubuntu에는 기본적으로 curl이 설치되어 있지 않을 수 있습니다. 그러나 curl은 소프트웨어 다운로드와 API 작업에 필수적이므로 초기에 설치해 두면 매우 유용합니다. 또한 curl은 간단한 명령으로 실행할 수 있어 스크립트 자동화에도 적합합니다.

2. Method ①: Install curl Using apt

What is apt?

apt(Advanced Package Tool)는 Ubuntu에서 사용하는 패키지 관리 시스템입니다. Ubuntu 공식 저장소에서 소프트웨어를 설치·업데이트·제거할 수 있게 해 주며, 공식 저장소에는 안정적인 버전의 curl이 제공됩니다.

Steps to Install curl with apt

  1. Update the package list
    sudo apt update
    
  1. Install curl
    sudo apt install curl
    
  1. Verify the installation
    curl --version
    

Pros and Cons of Installing with apt

ProsCons
High stability because it is provided through the official Ubuntu repositoryThe available version may not be the latest
Security updates are applied automaticallyCertain features may be limited depending on the version

3. Method ②: Install curl Using snap

What is snap?

snap은 Ubuntu 및 기타 Linux 배포판에서 사용할 수 있는 최신 패키지 관리 시스템입니다. snap 패키지는 종속성을 독립적으로 관리하므로 시스템 버전 차이에 덜 영향을 받습니다.

Steps to Install curl with snap

  1. Check whether snap is enabled
    snap --version
    
  1. Install curl using snap
    sudo snap install curl
    
  1. Check the snap version of curl
    curl --version
    

Pros and Cons of Installing with snap

ProsCons
Latest version is usually availableRequires snap environment (not installed by default)
Less affected by other system componentsMay take longer to start

4. Basic Usage of curl

curl이 설치되면 아래 기본 명령들을 시도해 보세요.

Retrieve a Web Page

지정한 URL의 HTML 데이터를 가져오는 명령입니다:

curl https://example.com

Download a File

파일을 다운로드하려면 -O 옵션을 사용합니다:

curl -O https://example.com/sample.txt

Send an API Request

API 요청을 보낼 때는 -X 옵션을 사용합니다:

curl -X GET https://api.example.com/data

헤더를 지정하고 JSON 형식으로 데이터를 얻으려면:

curl -X GET https://api.example.com/data -H "Content-Type: application/json"

5. Troubleshooting curl Installation Issues

curl: command not found Error

Solution:

  • Check whether curl is installed:
    which curl
    
  • If not installed, reinstall using sudo apt install curl .

Could not resolve host Error

Solution:

  • Check network connectivity and DNS settings.
  • Verify connection using ping google.com .

If the Version is Outdated

Solution:

  • If you need the latest version, install the snap package.

6. FAQ

Q1: How do I update curl to the latest version?

A1: Wait for the Ubuntu official repository to update, or install the snap version.

Q2: What is the difference between curl and wget?

A2:

  • curl : API 요청을 포함한 다양한 데이터 전송 작업을 지원합니다.
  • wget : 주로 파일 다운로드에 특화되어 있습니다.

Q3: Can curl send HTTPS requests?

A3: Yes, curl supports HTTPS. You can disable certificate checks using the -k option.

7. Summary

이 글에서는 apt 또는 snap을 사용해 Ubuntu에 curl을 설치하는 방법, 기본 curl 명령 사용법, 그리고 흔히 발생하는 오류를 해결하는 방법을 설명했습니다.

Main Takeaways

✅ curl may not be installed by default on Ubuntu
✅ apt is the standard installation method, but snap provides newer versions
✅ curl is useful for API requests and downloading files
✅ Check error messages carefully and apply the appropriate fix

curl은 Ubuntu 작업 시 매우 유용한 도구이므로 미리 설치해 두면 도움이 됩니다.

年収訴求