Translated to Spanish the day16 file
Signed-off-by: Manuel Vergara <manuel@vergaracarmona.es>
This commit is contained in:
parent
34ee1946a9
commit
1197a66172
@ -1,156 +1,188 @@
|
||||
## Managing your Linux System, Filesystem & Storage
|
||||
## Gestión de tu sistema Linux, sistema de archivos y almacenamiento
|
||||
|
||||
So far we have had a brief overview of Linux and DevOps and then we got our lab environment set up using Vagrant [(Day 14)](day14.md), we then touched on a small portion of commands that will be in your daily toolkit when in the terminal and getting things done [(Day 15)](day15.md).
|
||||
Hasta ahora hemos tenido una toma de contacto con Linux y DevOps. Tenemos nuestro entorno de laboratorio configurado con Vagrant [(Día 14)](day14.md) y tocamos una pequeña porción de comandos que estarán en nuestro kit de herramientas diarias para nuestras cositas en la terminal [(Día 15)](day15.md).
|
||||
|
||||
Here we are going to look into three key areas of looking after your Linux systems with updates, installing software, understanding what system folders are used for and we will also take a look at storage.
|
||||
Hoy vamos a mirar en áreas clave a cuidar en los sistemas Linux con las actualizaciones, la instalación de software en general. También intentaremos explicar un poco sobre las carpetas del sistema y como se utilizan. Por último, echaremos un vistazo al almacenamiento.
|
||||
|
||||
## Managing Ubuntu & Software
|
||||
## Gestión de Ubuntu y el Software
|
||||
|
||||
The first thing we are going to look at is how we update our operating system. Most of you will be familiar with this process in a Windows OS and macOS, this looks slightly different on a Linux desktop and server.
|
||||
Lo primero que vamos a ver es cómo actualizar nuestro sistema operativo. Quizá estes familiarizado con este proceso en un sistema operativo Windows y macOS. Es ligeramente distinto en un Desktop o un servidor Linux.
|
||||
|
||||
We are going to be looking at the apt package manager, this is what we are going to use on our Ubuntu VM for updates and software installation.
|
||||
Vamos a ver el gestor de paquetes apt, que es el que utilizaremos en nuestra MV Ubuntu para las actualizaciones y la instalación de software.
|
||||
|
||||
Generally, at least on dev workstations, I run this command to make sure that I have the latest available updates from the central repositories, before any software installation.
|
||||
Generalmente, en las distribuciones derivadas de Debian, se ejecuta este comando para asegurarse de tener las últimas actualizaciones de los repositorios centrales, antes de cualquier instalación de software que pudiera provocar un conflicto de dependencias.
|
||||
|
||||
`sudo apt-get update`
|
||||
```shell
|
||||
sudo apt-get update
|
||||
```
|
||||
|
||||

|
||||
|
||||
Now we have an updated Ubuntu VM with the latest OS updates installed. We now want to get some software installed here.
|
||||
Ahora tenemos una MV Ubuntu actualizada con las últimas actualizaciones del sistema operativo instaladas. Ahora queremos instalar algún software.
|
||||
|
||||
Let's choose `figlet` which is a program that generates text banners.
|
||||
Vamos a elegir `figlet` que es un programa que genera banners de texto.
|
||||
|
||||
If we type `figlet` in our terminal you are going to see that we do not have it installed on our system.
|
||||
Si escribimos `figlet` en nuestro terminal vais a ver que no lo tenemos instalado en nuestro sistema.
|
||||
|
||||

|
||||
|
||||
You will see from the above though that it does give us some `apt` install options that we could try. This is because in the default repositories there is a program called figlet. Let's try `sudo apt install figlet`
|
||||
Sin embargo, verás que nos da algunas opciones de instalación `apt` que podríamos probar. Esto es porque en los repositorios por defecto hay un programa llamado figlet. Probemos con `sudo apt install figlet`.
|
||||
|
||||

|
||||
|
||||
We can now use our `figlet` app as you can see below.
|
||||
Instalado. Ahora ya lo podemos usar como puedes ver a continuación.
|
||||
|
||||

|
||||
|
||||
If we want to remove that or any of our software installations we can also do that via the `apt` package manager.
|
||||
Si queremos eliminar esa o cualquier otro software también podemos hacerlo a través del gestor de paquetes `apt`.
|
||||
|
||||
`sudo apt remove figlet`
|
||||
```shell
|
||||
sudo apt remove figlet
|
||||
```
|
||||
|
||||

|
||||
|
||||
There are third party repositories that we can also add to our system, the ones we have access to out of the box are the Ubuntu default repositories.
|
||||
⚠️ _Ten cuidado con borrar cosas que no debes. Normalmente, las distribuciones te avisarán, puedes borrar todos los programas incluidos los que aparentemente no usas, pero en realidad son dependencias de otros._
|
||||
|
||||
If for example, we wanted to install vagrant on our Ubuntu VM we would not be able to right now and you can see this below on the first command issued. We then add the key to trust the HashiCorp repository, then add the repository to our system.
|
||||
Si quieres asegurarte de borrar el programa y todas sus dependencias puedes usar la opción `--purge`:
|
||||
|
||||
```shell
|
||||
sudo apt --purge remove figlet
|
||||
```
|
||||
|
||||
Podremos añadir repositorios de terceros, a los que tendremos acceso además de los repositorios por defecto de Ubuntu y de los oficiales.
|
||||
|
||||
Si por ejemplo, quisiéramos instalar vagrant en nuestra MV de Ubuntu no podríamos ahora mismo y esto lo podéis ver a continuación en el primer comando emitido. Añadimos la clave para confiar en el repositorio de HashiCorp, y luego añadimos el repositorio a nuestro sistema.
|
||||
|
||||

|
||||
|
||||
Once we have the HashiCorp repository added we can go ahead and run `sudo apt install vagrant` and get vagrant installed on our system.
|
||||
Una vez que tenemos el repositorio de HashiCorp añadido podemos seguir adelante y ejecutar `sudo apt install vagrant` y conseguir instalarlo en nuestro sistema.
|
||||
|
||||

|
||||
|
||||
There are so many options when it comes to software installation, different options for package managers, built into Ubuntu we could also use snaps for our software installations.
|
||||
Hay tantas opciones cuando se trata de la instalación de software, existen diferentes opciones de gestores de paquetes. Por ejemplo, en Ubuntu también podríamos utilizar snaps para nuestras instalaciones de software.
|
||||
|
||||
Hopefully, this gives you a feel about how to manage your OS and software installations on Linux.
|
||||
Esperemos que esto te dé una idea de cómo gestionar tu sistema operativo y las instalaciones de software en Linux.
|
||||
|
||||
## File System Explained
|
||||
## Explicación del sistema de archivos
|
||||
|
||||
Linux is made up of configuration files, if you want to change anything then you change these configuration files.
|
||||
Linux está hecho de archivos de configuración, si quieres cambiar algo entonces cambias estos archivos de configuración. ¡Una maravilla!
|
||||
|
||||
On Windows, you have C: drive and that is what we consider the root. On Linux we have `/` this is where we are going to find the important folders on our Linux system.
|
||||
En Windows, tienes la unidad C: y eso es lo que consideramos la raíz. En Linux tenemos `/`, aquí es donde vamos a encontrar las carpetas importantes de nuestro sistema Linux.
|
||||
|
||||

|
||||
|
||||
- `/bin` - Short for binary, the bin folder is where our binaries that your system needs, executables and tools will mostly be found here.
|
||||
- `/bin` - Abreviatura de binario, en esta carpeta es donde se encuentran los binarios que nuestro sistema necesita, los ejecutables y las herramientas.
|
||||
|
||||

|
||||
|
||||
- `/boot` - All the files your system needs to boot up. How to boot up, and what drive to boot from.
|
||||
- `/boot` - Todos los archivos que tu sistema necesita para arrancar, los que indican cómo arrancar y los que definen desde qué unidad arrancar.
|
||||
|
||||

|
||||
|
||||
- `/dev` - You can find device information here, this is where you will find pointers to your disk drives `sda` will be your main OS disk.
|
||||
- `/dev` - Aquí puedes encontrar información de dispositivos, es donde encontrarás punteros a tus unidades de disco `sda` será tu disco principal del SO.
|
||||
|
||||

|
||||
|
||||
- `/etc` Likely the most important folder on your Linux system, this is where the majority of your configuration files are.
|
||||
- `/etc` Probablemente la carpeta que más navegarás de Linux. Es donde están la mayoría de archivos de configuración.
|
||||
|
||||

|
||||
|
||||
- `/home` - this is where you will find your user folders and files. We have our vagrant user folder. This is where you will find your `Documents` and `Desktop` folders that we worked in for the commands section.
|
||||
- `/home` - Aquí es donde encontrarás tus carpetas y archivos de usuario. Tenemos nuestra carpeta de usuario vagrant. Es donde te encontrarás las carpetas para tu Ubuntu Desktop como los `Documentos`, las `Descargas` y el `Escritorio`.
|
||||
|
||||

|
||||
|
||||
- `/lib` - We mentioned that `/bin` is where our binaries and executables live, and `/lib` is where you will find the shared libraries for those.
|
||||
- `/lib` - Hemos mencionado que `/bin` es donde viven nuestros binarios y ejecutables, pues en `/lib` es donde encontrarás las librerías compartidas para estos.
|
||||
|
||||

|
||||
|
||||
- `/media` - This is where we will find removable devices.
|
||||
- `/media` - Aquí es donde encontraremos los dispositivos extraíbles.
|
||||
|
||||

|
||||
|
||||
- `/mnt` - This is a temporary mount point. We will cover more here in the next storage section.
|
||||
- `/mnt` - Este es un punto de montaje temporal. Cubriremos más sobre este en el siguiente apartado de almacenamiento, tienen bastante miga.
|
||||
|
||||

|
||||
|
||||
- `/opt` - Optional software packages. You will notice here that we have some vagrant and virtual box software stored here.
|
||||
- `/opt` - Paquetes de software opcionales. Notarás que tenemos algunos programas de vagrant y virtual box almacenados aquí.
|
||||
|
||||

|
||||
|
||||
- `/proc` - Kernel & process information, similar to `/dev`
|
||||
- `/proc` - Información del kernel y de los procesos, similar a `/dev`. Es un sistema de archivos virtual que se crea sobre la marcha cuando el sistema arranca y se disuelve cuando se apaga. Me parece uno de los más importantes para trabajar si quieres dedicarte a la filosofía DevOps. La magía de la contenerización se entiende mejor si trabajas con el sistema de archivos que contiene `/proc`.
|
||||
|
||||
Contiene información útil sobre los procesos que se están ejecutando en ese momento, y se considera un centro de control e información para el núcleo. Puedes configurar directamente el kernel desde aquí, pues proporciona un medio de comunicación entre el espacio del kernel y el espacio del usuario.
|
||||
|
||||
En este [tutorial](https://prefapp.github.io/formacion/cursos/docker/es/#/./01_que_e_un_contedor_de_software/01_procesos_e_kernel) puedes trabajar con `/proc`
|
||||
|
||||

|
||||
|
||||
- `/root` - To gain access you will need to sudo into this folder. The home folder for root.
|
||||
- `/root` - Para acceder a esta carpeta necesitarás sudo. Es la carpeta home para root.
|
||||
|
||||

|
||||
|
||||
- `/run` -Placeholder for application states.
|
||||
- `/run` - Marcador de posición para los estados de la aplicación.
|
||||
|
||||

|
||||
|
||||
- `/sbin` - Sudo bin, similar to the bin folder but these tools are intended for elevated superuser privileges on the system.
|
||||
- `/sbin` - Sudo bin, similar a la carpeta bin pero estas herramientas están pensadas para privilegios elevados de superusuario en el sistema.
|
||||
|
||||

|
||||
|
||||
- `/tmp` - temporary files.
|
||||
- `/tmp` - archivos temporales.
|
||||
|
||||

|
||||
|
||||
- `/usr` - If we as a standard user have installed software packages it would generally be installed in the `/usr/bin` location.
|
||||
- `/usr` - Si como usuario estándar hemos instalado paquetes de software, generalmente se instalarán en la ubicación `/usr/bin`.
|
||||
|
||||

|
||||
|
||||
- `/var` - Our applications get installed in a `bin` folder. We need somewhere to store all of the log files this is `/var`
|
||||
- `/var` - Nuestras aplicaciones se instalan en una carpeta `bin`. Necesitamos un lugar para almacenar todos los archivos de registro, este es `/var`.
|
||||
|
||||

|
||||
|
||||
## Storage
|
||||
## Almacenamiento
|
||||
|
||||
When we come to a Linux system or any system we might want to know the available disks and how much free space we have on those disks. The next few commands will help us identify and use and manage storage.
|
||||
Cuando llegamos a un sistema Linux o a cualquier sistema podemos querer saber los discos disponibles y cuánto espacio libre tenemos en esos discos. Los siguientes comandos nos ayudarán a identificar, utilizar y gestionar el almacenamiento.
|
||||
|
||||
- `lsblk` List Block devices. `sda` is our physical disk and then `sda1, sda2, sda3` are our partitions on that disk.
|
||||
- `lsblk` Lista los dispositivos de bloque. `sda` es nuestro disco físico y luego `sda1, sda2, sda3` son nuestras particiones en ese disco.
|
||||
|
||||

|
||||
|
||||
- `df` gives us a little more detail about those partitions, total, used and available. You can parse other flags here I generally use `df -h` to give us a human output of the data.
|
||||
- `df` nos da un poco más de detalle sobre las particiones: el total, el usado y el disponible. Puedes usar opciones interesante como `df -h` para darnos una salida humana de los datos.
|
||||
|
||||

|
||||
|
||||
If you were adding a new disk to your system and this is the same in Windows you would need to format the disk in disk management, in the Linux terminal you can do this by using the `sudo mkfs -t ext4 /dev/sdb` with sdb relating to our newly added disk.
|
||||
Si usted estuviera añadiendo un nuevo disco a su sistema, y esto es lo mismo en Windows, necesitarías formatear el disco en la administración de discos. En la terminal de Linux puedes hacerlo usando
|
||||
```shell
|
||||
sudo mkfs -t ext4 /dev/sdb
|
||||
```
|
||||
Nos deberemos asegurar que sdb es realmente nuestro disco recién añadido y el que queremos formatear, porque es lo que hará, borrarlo y darle un formato ext4 al disco.
|
||||
|
||||
We would then need to mount our newly formatted disk so that it was useable. We would do this in our `/mnt` folder previously mentioned and we would create a directory there with `sudo mkdir NewDisk` we would then use `sudo mount /dev/sdb newdisk` to mount the disk to that location.
|
||||
A continuación, tendríamos que montar nuestro disco recién formateado para poderlo utilizar. Esto lo hacemos en nuestra carpeta `/mnt` que mencionamos anteriormente. Creamos un directorio allí con
|
||||
```shell
|
||||
sudo mkdir /mnt/NewDisk
|
||||
```
|
||||
Para montar el disco en esa ubicación usaremos el siguiente comando.
|
||||
|
||||
It is also possible that you will need to unmount storage from your system safely vs just pulling it from the configuration. We can do this with `sudo umount /dev/sdb`
|
||||
```shell
|
||||
sudo mount /dev/sdb newdisk
|
||||
```
|
||||
|
||||
If you did not want to unmount that disk and you were going to be using this disk for a database or some other persistent use case then you want it to be there when you reboot your system. For this to happen we need to add this disk to our `/etc/fstab` configuration file for it to persist, if you don't it won't be useable when the machine reboots and you would manually have to go through the above process. The data will still be there on the disk but it won't automount unless you add the configuration to this file.
|
||||
También es posible que necesites desmontar el almacenamiento del sistema de forma segura. Lo podemos hacer con
|
||||
```shell
|
||||
sudo umount /dev/sdb
|
||||
```
|
||||
|
||||
Once you have edited the `fstab` configuration file you can check your workings with `sudo mount -a` if no errors then your changes will now be persistent across restarts.
|
||||
Si no quieres desmontar ese disco y vas a usarlo para, por ejemplo, una base de datos o algún otro uso persistente, querrás que esté ahí cuando reinicies tu sistema. Para que persista necesitamos añadir este disco a nuestro archivo de configuración `/etc/fstab`. Si no lo haces no estará dispobible cuando la máquina se reinicie y tendrás que pasar por el proceso manual de nuevo. Los datos seguirán estando en el disco pero no se montará automáticamente a menos que añadas la configuración al archivo mencionado.
|
||||
|
||||
We will cover how you would edit a file using a text editor in a future session.
|
||||
Una vez que hayas editado el archivo de configuración `fstab` ppodrás comprobar su funcionamiento con `sudo mount -a`. Si no hay errores significa que los cambios serán persistentes a través de los reinicios.
|
||||
|
||||
## Resources
|
||||
Veremos cómo editar un archivo usando un editor de texto en una futura sesión.
|
||||
|
||||
## Recursos
|
||||
|
||||
- [Learn the Linux Fundamentals - Part 1](https://www.youtube.com/watch?v=kPylihJRG70)
|
||||
- [Linux for hackers (don't worry you don't need to be a hacker!)](https://www.youtube.com/watch?v=VbEx7B_PTOE)
|
||||
- [Webminal](https://www.webminal.org/)
|
||||
|
||||
See you on [Day17](day17.md)
|
||||
Nos vemos el [Día 17](day17.md).
|
||||
|
Loading…
Reference in New Issue
Block a user