Guia de tecnologias

Configurar sources.list do APT — Guia para iniciantes

3 min read Linux Atualizado 18 Oct 2025
Configurar sources.list do APT — Guia rápido
Configurar sources.list do APT — Guia rápido

Introdução

Este guia mostra, passo a passo e em linguagem simples, como restaurar ou recriar o arquivo sources.list do APT no Ubuntu/Debian quando ele foi alterado ou ficou inválido. Definição rápida: sources.list é o ficheiro que indica ao APT onde baixar pacotes e atualizações.

Pré-requisitos

  • Acesso root ou sudo na máquina alvo.
  • Conexão de rede para baixar pacotes e listas.
  • Um editor de texto no sistema (vim, nano) ou acesso via SSH/terminal.

Gerar um novo sources.list

  1. Abra o gerador Source-O-Matic: http://www.ubuntu-nl.org/source-o-matic/
  2. Preencha os três campos (versão, espelho/servidor e componentes) e gere o sources.list.
  3. Copie o conteúdo gerado para a área de transferência (clipboard).

Observação: se o seu Ubuntu for uma versão muito antiga (EOL), troque os espelhos padrão por old-releases.ubuntu.com antes de usar ou, se o gerador não suportar, ajuste manualmente as URLs.

Exemplo de sources.list gerado

| # deb cdrom:[Ubuntu 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy main restricted # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy main restricted ## Major bug fix updates produced after the final release of the ## distribution. # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## universe WILL NOT receive any review or updates from the Ubuntu security ## team. # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy universe # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy universe # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates universe # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy multiverse # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy multiverse # Line commented out by installer because it failed to verify: # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse # Line commented out by installer because it failed to verify: # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy-updates multiverse ## Uncomment the following two lines to add software from the 'backports' ## repository. ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb http://ie.archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse # deb-src http://ie.archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. This software is not part of Ubuntu, but is ## offered by Canonical and the respective vendors as a service to Ubuntu ## users. deb http://archive.canonical.com/ubuntu hardy partner deb-src http://archive.canonical.com/ubuntu hardy partner # Line commented out by installer because it failed to verify: # deb http://security.ubuntu.com/ubuntu gutsy-security main restricted # Line commented out by installer because it failed to verify: # deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted # Line commented out by installer because it failed to verify: # deb http://security.ubuntu.com/ubuntu gutsy-security universe # Line commented out by installer because it failed to verify: # deb-src http://security.ubuntu.com/ubuntu gutsy-security universe # Line commented out by installer because it failed to verify: # deb http://security.ubuntu.com/ubuntu gutsy-security multiverse # Line commented out by installer because it failed to verify: deb http://archive.ubuntu.com/ubuntu/ hardy main universe restricted multiverse deb http://archive.ubuntu.com/ubuntu/ hardy-updates universe main restricted multiverse deb http://security.ubuntu.com/ubuntu/ hardy-security universe main restricted multiverse # deb-src http://security.ubuntu.com/ubuntu gutsy-security multiverse # deb http://download.tuxfamily.org/syzygy42 gutsy avant-window-navigator # deb-src http://download.tuxfamily.org/syzygy42 gutsy avant-window-navigator # deb http://archive.ubuntustudio.org/ubuntustudio edgy main |

O bloco acima é um exemplo. Use o conteúdo que você gerou no Source-O-Matic em vez de copiar este exemplo, a menos que você saiba que ele corresponde à sua versão.

Substituir o arquivo sources.list (passo a passo)

  1. Faça backup do arquivo atual:
sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
  1. Crie um novo arquivo vazio e abra-o no editor (aqui usamos o vim):
sudo touch /etc/apt/sources.list
sudo vim /etc/apt/sources.list
  1. No vim: pressione i para entrar no modo de inserção; cole (Ctrl+V ou botão direito, dependendo do terminal) o conteúdo do clipboard; pressione ESC, digite :wq e Enter para salvar e sair.

Importante: se você estiver em uma sessão SSH a partir de Windows, colar pelo botão direito costuma funcionar; em outros casos, use o atalho do terminal.

  1. Atualize as listas de pacotes:
sudo apt-get update
  1. Se desejar, atualize os pacotes instalados:
sudo apt-get upgrade

Alternativas e quando isso pode falhar

  • Repositório removido por ser EOL: versões antigas do Ubuntu podem ter seus pacotes movidos para old-releases.ubuntu.com. Se o apt retornar 404, confirme o espelho usado.
  • Problemas de rede/DNS: confirme conectividade (ping, curl) antes de concluir que o sources.list está errado.
  • Chaves GPG/assinatura: erros de verificação podem indicar que faltam chaves ou há problemas temporários no mirror; revisar mensagens de erro do apt é essencial.

Checklist por função

  • Administrador:
    • Backup do sources.list original.
    • Verificar versão do sistema (lsb_release -a ou /etc/os-release).
    • Testar apt-get update e revisar erros.
  • Usuário:
    • Providenciar acesso ao conteúdo do novo sources.list (copiar/colar).
    • Confirmar com o administrador antes de habilitar repositórios ‘partner’ ou ‘multiverse’.

Comandos úteis (resumo rápido)

  • Backup: sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
  • Criar: sudo touch /etc/apt/sources.list
  • Editar: sudo vim /etc/apt/sources.list (ou sudo nano …)
  • Atualizar índices: sudo apt-get update
  • Atualizar pacotes: sudo apt-get upgrade

Notas importantes

  • Nunca habilite repositórios não confiáveis sem entender os riscos de licenciamento e segurança.
  • Mantenha um backup do arquivo antigo até confirmar que tudo funciona.

Resumo

Gerar um novo sources.list via Source-O-Matic e substituir /etc/apt/sources.list é a maneira mais rápida de recuperar um APT quebrado. Sempre faça um backup, verifique a versão do seu Ubuntu/Debian e confirme se o mirror é compatível (ou use old-releases se necessário).

Importante: se após sudo apt-get update você ainda receber erros, copie a mensagem completa e verifique se é problema de URL (404), chave GPG ou conexão de rede.

Autor
Edição

Materiais semelhantes

Desativar digitação por gestos no Android
Android

Desativar digitação por gestos no Android

Corrigir gdi32full.dll ausente no Windows 10
Windows 10

Corrigir gdi32full.dll ausente no Windows 10

Foto de perfil personalizada no Netflix — Guia rápido
Tutoriais

Foto de perfil personalizada no Netflix — Guia rápido

Converter .img para arquivo flashável do Odin
Android

Converter .img para arquivo flashável do Odin

Como fazer um vídeo viral no TikTok
Marketing

Como fazer um vídeo viral no TikTok

Formatar SD para FAT32 no Mac — 3 métodos fáceis
Tutoriais

Formatar SD para FAT32 no Mac — 3 métodos fáceis