Guía de tecnologías

Cómo configurar /etc/apt/sources.list para principiantes

3 min read Linux Actualizado 18 Oct 2025
Configurar /etc/apt/sources.list — Guía para principiantes
Configurar /etc/apt/sources.list — Guía para principiantes

TL;DR

Si rompiste tu /etc/apt/sources.list, crea un respaldo, pega una plantilla válida y actualiza apt. Usa Vim para editar, guarda y ejecuta sudo apt-get update. Aquí tienes una plantilla común y pasos claros para restaurar tu lista de repositorios.

Introducción

Manipular la lista de repositorios de Apt puede causar errores al instalar paquetes si se introducen entradas inválidas. Este artículo muestra cómo restaurar y configurar /etc/apt/sources.list paso a paso, con una plantilla lista para pegar, comandos para hacer respaldo y métodos alternativos si trabajas desde Windows o SSH.

Antes de empezar (términos en una línea)

  • sources.list: archivo que contiene las URLs de los repositorios apt.
  • mirror/repositorio: servidor que distribuye paquetes.
  • codename: nombre de la versión de tu distribución (por ejemplo, focal, bionic).

Plantilla de ejemplo

Copia la plantilla completa que aparece abajo y pégala en tu nuevo /etc/apt/sources.list. La plantilla contiene líneas comentadas y ejemplos de repositorios.

| # 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 |

Pasos para restaurar tu sources.list

  1. Copia la plantilla (arriba) al portapapeles.
  2. Haz un respaldo del archivo actual y crea uno vacío:
sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
sudo touch /etc/apt/sources.list
sudo chmod 644 /etc/apt/sources.list
  1. Abre el archivo con tu editor (aquí usamos vim):
sudo vim /etc/apt/sources.list
  1. Pulsa i para entrar en modo insertar.
  2. Pega el contenido del portapapeles (clic derecho en muchos terminales o Ctrl+V según el entorno).
  3. Guarda y cierra: pulsa Esc, escribe :wq y presiona Enter.
  4. Actualiza la lista de paquetes:
sudo apt-get update

Si ves errores durante apt-get update, revisa las líneas que contienen “404” o “GPG” y corrígelas o coméntalas (añadiendo # al inicio).

Alternativas para transferir el archivo

  • Si trabajas por SSH desde Windows, pega directamente en el terminal.
  • Descarga la sources.list generada en otra máquina y transfiérela con scp o ftp:
scp sources.list usuario@tu-servidor:/tmp/
sudo mv /tmp/sources.list /etc/apt/sources.list

Verifica el nombre de la versión (codename)

Antes de usar una plantilla, confirma el nombre de tu versión con:

lsb_release -cs

Sustituye los nombres de versión (por ejemplo, gutsy, hardy) por el que corresponda a tu sistema.

Comprobaciones rápidas (checklist para cada sesión)

  • Hiciste respaldo: /etc/apt/sources.list.old existe.
  • No hay líneas duplicadas ni rutas con errores tipográficos.
  • El codename coincide con tu distribución.
  • Ejecutaste sudo apt-get update sin errores críticos.

Problemas comunes y soluciones

  • Mensajes GPG: importa la clave pública del repositorio o elimina la entrada si es de terceros.
  • Errores 404: cambia a otro mirror o corrige el codename.
  • Permisos: asegúrate de que /etc/apt/sources.list sea legible por root (chmod 644).

Buenas prácticas

  • Siempre haz un respaldo antes de editar.
  • Mantén comentadas las entradas que no entiendes. Puedes descomentarlas más tarde si las necesitas.
  • Prioriza repos oficiales y mirrors cercanos para mayor velocidad.

Mini-metodología (si lo haces en producción)

  1. Hacer respaldo y capturar estado: cp /etc/apt/sources.list /root/sources.list.backup.date
  2. Probar cambios en una máquina de prueba o contenedor.
  3. Implementar cambios y monitorizar apt-get update por 24–48 horas.
  4. Revertir si aparecen errores de paquetes críticos.

Roles y responsabilidades (rápido)

  • Usuario/novato: seguir la sección Pasos para restaurar y reportar errores.
  • Administrador: validar codename, claves GPG y mirrors.
  • Soporte: mantener una plantilla estándar por versión de distribución.

Resumen

Restaurar /etc/apt/sources.list es sencillo: haz respaldo, pega una plantilla válida, confirma el codename y ejecuta sudo apt-get update. Si aparecen errores, revísalos según su tipo (GPG, 404, permisos) y corrígelos o comenta la línea problemática.

Importante: si no estás seguro sobre una entrada, coméntala en lugar de borrarla. Mantén siempre un respaldo hasta que verifiques que el sistema funciona correctamente.

Autor
Edición

Materiales similares

Solución al error caa70004 en Microsoft Teams
Soporte

Solución al error caa70004 en Microsoft Teams

Desactivar escritura gestual en Android
Android

Desactivar escritura gestual en Android

Solución: gdi32full.dll falta en Windows 10
Windows

Solución: gdi32full.dll falta en Windows 10

Foto de perfil personalizada en Netflix
Streaming

Foto de perfil personalizada en Netflix

Convertir .img a archivo flashable para Odin
Android

Convertir .img a archivo flashable para Odin

Cómo hacerse viral en TikTok — Guía práctica
Redes sociales

Cómo hacerse viral en TikTok — Guía práctica