| Both sides previous revision Previous revision Next revision | Previous revision |
| es:kuckucksmuehle:hackerspace:fileserver [2017/01/07 14:06] – [Instalación] palmercado | es:kuckucksmuehle:hackerspace:fileserver [2017/01/08 14:26] (current) – [Instalando el Software] palmercado |
|---|
| FIXME **Esta página no está completamente traducida, aún. Por favor, contribuye a su traducción.**\\ //(Elimina este párrafo una vez la traducción esté completa)// | |
| |
| ====== Servidor de archivos ====== | ====== Servidor de archivos ====== |
| Nosotros usamos 'core' para los usuarios y para los voluntarios (workaway) que se encuentran con nosotros por largos periodos de tiempo. | Nosotros usamos 'core' para los usuarios y para los voluntarios (workaway) que se encuentran con nosotros por largos periodos de tiempo. |
| |
| ====== Install Software ====== | ====== Instalando el Software ====== |
| |
| Next we need to install some software. As the system should serve files to any PC in the network we install samba and for the disk encryption cryptsetup. | Después necesitamos instalar software. Como el sistema puede abastecer de archivos a cualquier PC en la red, instalamos samba y para la encriptación del disco cryptsetup. |
| |
| ''sudo apt-get install samba cryptsetup'' | ''sudo apt-get install samba cryptsetup'' |
| |
| For easy administration ''tmux dstat htop mc'' is installed as well. | Para la facil administración ''tmux dstat htop mc'' esta instalado también. |
| |
| Then we add a user 'echo' to the system and configure a long password together with authorized keys and add the user to the sudoers file. Then we disable the 'pi' user. | Después agregamos al usuario 'echo' al sistema y configurar una costrasena más larga junto con las llaves permitidas y agregamos al usuario a el archivo sudoers. |
| Now we create a directory ''/data'' with the desired shares and set root ownership to those directories. Add a file 'HARDISK_NOT_MOUNTED' in every share, so that users see that something is wrong when the pi rebooted. | Después desactivamos el usuario 'pi'. |
| | Ahora creamos el directorio ''/data'' las acciones deseadas y establecer la propiedad raíz a esos directorios. Agregue un archivo 'HARDISK_NOT_MOUNTED' en cada recurso compartido, para que los usuarios vean que algo está mal cuando se reinicia el pi. |
| |
| Now we need to partition the disk (or use [[https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)|LVM]]). When LVM is used, the following commands are slightly different. | Ahora necesitamos la partición del disco(o usar [[https://es.wikipedia.org/wiki/Logical_Volume_Manager|LVM]]). Cuando el LVM esta en uso, los siguientes comandos son ligeramente diferentes. |
| |
| |
| ====== Prepare Disk ====== | ====== Preparar el disco ====== |
| |
| |
| ''fdisk /dev/sda'' | ''fdisk /dev/sda'' |
| Create a partition for every group of files: core, workaway, public, media and choose the size wisely as changing it afterwards is not easy. | Crear una partición para cada grupo de archivos: core, workaway, público, multimedia y elegir el tamaño sabiamente porque cambiarlo después no es fácil.** Tenga en cuenta que usamos / dev / sda aquí, revisamos dmesg por el nombre del dispositivo actual, de lo contrario,si tu partición y el formato de el dispositivo incorrecto, y perderemos todos sus datos ** |
| **Be aware, we use /dev/sda here, check dmesg for the actual device name, otherwise you partition and format the wrong device and you lose all your data!** | |
| |
| <code> | <code> |
| </code> | </code> |
| |
| When the partitions are ready, we need to run cryptsetup luksFormat for each device and provide a passphrase. Store the passphrase in a secure location that you can access when the fileserver needs a reboot. | Cuando las particiones están listas, necesitamos ejecutar cryptsetup luksFormat para cada dispositivo y proporcionar una contraseña. Guarde la contraseña en una ubicación segura a la que pueda acceder cuando el servidor de archivos necesite un reinicio. |
| |
| <code> | <code> |
| $ cryptsetup luksFormat /dev/sda1 | $ cryptsetup luksFormat /dev/sda1 |
| |
| WARNING! | ATENCIÓN! |
| ======== | ======== |
| This will overwrite data on /dev/sda1 irrevocably. | Esto sobrescribirá los datos irremediablemente en /dev/sda1. |
| |
| Are you sure? (Type uppercase yes): YES | Está seguro? (Escriba en mayúsculas): YES |
| Enter passphrase: | Escriba contrasena: |
| Verify passphrase: | Verifique contrasena: |
| </code> | </code> |
| |
| Repeat this for all partitions. | Repita esto para todas las particiones. |
| |
| Then create a script in /data that contains a line for each partition: | Después cree el script en /data que contiene una línea para cada partición |
| |
| ''/data/unlock_disk.sh'' | ''/data/unlock_disk.sh'' |
| #!/bin/bash | #!/bin/bash |
| |
| echo 'to unlock you need passwords stored on rh' | Echo 'para desbloquear necesita contraseñas almacenadas en rh' |
| echo 'run identity file to get the passphrases for cpublic, ccore, cworkaway and cmedia' | Echo 'ejecutar archivo de identidad para obtener las contrasenas de acceso para cpublic, ccore, cworkaway y cmedia' |
| echo 'the unlock will take multiple minutes' | Echo 'el desbloqueo tomará varios minutos' |
| echo '---' | echo '---' |
| echo 'core' | echo 'core' |
| </code> | </code> |
| |
| Make the script executable and run it as root. It will ask you for the passphrases and create devices in ''/dev/mapper''. | Hacer el script ejecutable y ejecutarlo como root. Se le pedirá las contraseñas y crear dispositivos en ''/dev/mapper''. |
| |
| Now we need to format the devices with a filesystem and set options that unlock all available space on the disk. | Ahora necesitamos dar formato a los dispositivos con un sistema de archivos y establecer opciones que desbloqueen todo el espacio disponible en el disco. |
| |
| <code> | <code> |
| </code> | </code> |
| |
| When the devices are formatted they can be added to the fstab. The noauto is important, otherwise the pi will not boot and drop into a shell - bad thing if you do not have a keyboard and a screen attached: | Cuando los dispositivos estén formateados se pueden agregar a la fstab. El noauto es importante, de lo contrario el pi no arrancará y se hará un shell - malo si no se tiene un teclado y una pantalla adjunta: |
| <code> | <code> |
| /dev/mapper/cpublic /data/public ext4 defaults,noauto 0 0 | /dev/mapper/cpublic /data/public ext4 defaults,noauto 0 0 |
| </code> | </code> |
| |
| Then create a script in /data that contains a line for each partition: | A continuación, cree un script en / data que contenga una línea para cada partición: |
| |
| ''/data/mount_disk.sh'' | ''/data/mount_disk.sh'' |
| </code> | </code> |
| |
| Run the script and see that the filesystems are mounted. Check that they are mounted and correct the ownership for the directories in /data with chmod and chown: | Ejecute el script y vea que los sistemas de archivos están montados. Compruebe que están montados y corrija la posesión de los directorios en / data con chmod y chown: |
| <code> | <code> |
| root@file:~# mount | root@file:~# mount |
| ====== Samba ====== | ====== Samba ====== |
| |
| Now it is time to configure samba, open the file ''/etc/samba/smb.conf'' and add the following entries: | Ahora es tiempo de configurar samba, abra el archivo ''/etc/samba/smb.conf'' y agregue las siguientes sentencias: |
| |
| <code> | <code> |
| |
| [public] | [public] |
| comment = Files accessible to all local and remote users | comment = Archivos accesibles para todos los usuarios, locales y remotos. |
| path = /data/public | path = /data/public |
| browseable = yes | browseable = yes |
| |
| [workaway] | [workaway] |
| comment = Files that are available for users that workaway | comment = Archivos que están disponibles para usuarios workaway |
| path = /data/workaway | path = /data/workaway |
| browseable = yes | browseable = yes |
| |
| [core] | [core] |
| comment = Files that are availabel for instructed users only | comment = Archivos que están disponibles para usuarios instruidos unicamente |
| path = /data/core | path = /data/core |
| browseable = yes | browseable = yes |
| |
| [media] | [media] |
| comment = Files that make audio or video signals, you cannot upload anything, use public share and inform core member. | comment = Archivos que hacen senales de audio o video, no pueden subir(upload) nada, usar el compartir público e informar al miembro core. |
| path = /data/media | path = /data/media |
| browseable = yes | browseable = yes |
| </code> | </code> |
| |
| you should also change the workgroup at the top of the file to 'ecohackerfarm'. | Tambien deberías cambiar de grupo de trabajo al comienzo del archivo a 'ecohackerfarm'. |
| |
| The last step is to set passwords for the users core and workaway: | Los ultimos pasos para colocar los passwords para los usuarios core y workaway: |
| <code> | <code> |
| smbpasswd -a core | smbpasswd -a core |
| ====== Test ====== | ====== Test ====== |
| |
| Put a file ''test.txt'' into each directory in data and ensure its ownership matches (eg /data/workaway/test should be rw for the workaway group). | Ponga un archivo '' test.txt '' en cada directorio en los datos y asegúrese de que su propiedad coincide (por ejemplo, / data / workaway / test debe ser rw para el grupo workaway). |
| |
| Check using a client-system (eg osx) and connect to the server. Connect with no credentials (guest) and check that you cannot use the shares workaway and core, but you can see the testfile in media (but cannot change anything) and you see the file in public (and you can change it). Repeat this for the workaway and the core user. | Compruebe utilizando un cliet-system (por ejemplo, osx) y conéctese al servidor. Conéctese sin credenciales (invitado) y compruebe que no puede utilizar las comparticiones de trabajo y core, pero puede ver el testfile en multimedia (pero no puede cambiar nada) y ve el archivo en público (y puede cambiarlo). Repita esto para el workaway y el usuario principal. |
| |
| When everything is done you should reboot the system to see that the service is comming up nicely. After the reboot the shares are available but the clients should only see the ''HARDDISK_NOT_MOUNTED'' message. Login and execute the scripts ''/data/unlock_disk.sh'' providing the disk-passphrases and ''/data/mount_disk.sh''. Now the clients should see the test.txt again. | Cuando todo esto se hace, debe reiniciar el sistema para ver que el servicio se está levantando muy bien. Después del reinicio, los recursos compartidos están disponibles, pero los clientes sólo deben ver el mensaje '' HARDDISK_NOT_MOUNTED ''. Inicie sesión y ejecute los scripts '' /data/unlock_disk.sh '' proporcionando las contraseñas del disco y '' /data/mount_disk.sh ''. Ahora los clientes deben ver el test.txt de nuevo. |
| |
| ====== Populate with Data ====== | ====== Poblar con datos ====== |
| | |
| | Transferencia de datos a la PI utilizando wifi puede ser bastante lento. Si usted planea poner un Terabyte del material de aprendizaje en él, considere conectar el disco en un PC real con SATA así usted necesitará un décimo del tiempo: |
| |
| Transfer of data to the PI using wifi can be quite slow. If you plan to put a Terrabyte of learning material on it, consider plugging the disk into a real pc with SATA as you will need a 10th of the time: | |
| <code> | <code> |
| WIFI: 1MB/s -> 3.6GB/h, the terrabyte will take 277h to copy | WIFI: 1MB/s -> 3.6GB/h, the terrabyte will take 277h to copy |
| </code> | </code> |
| |
| ====== Publish ====== | ====== Publicar ====== |
| |
| Now your visitors and workaways need to know that there is a fileserver and what to do with it. Write a enduser documentation of about half a page and put it on the wiki and print it out. | Ahora tus visitantes y workaways necesitan saber que hay un servidor de archivos y qué hacer con él. Escriba una documentación del usuario final de aproximadamente la mitad de una página y póngala en el wiki e imprímala. |
| |
| ====== Costs ====== | ====== Costos ====== |
| | Para la instalación descrita necesitas raspberry pi 2+, un adaptador USB-SATA y un disco duro. |
| |
| For the described installation you need a raspberry pi 2+, a USB-SATA adapter and a harddisk. The costs in 2016 were: 35EUR for the PI, 20EUR for the USB-SATA and 71EUR for the 2TB disk. The system uses about 5W of electrical energy and needs to be always on. | El costo en 2016 fue de: 35EUR por el PI, 20EUR por la USB-SATA y 71EUR para el disco duro de 2TB. |
| | El sistema utiliza 5W de energía eléctrica y debe estar siempre prendido. |
| |
| ===== Fileserver ===== | ===== Servidor de Archivos ===== |
| |
| This hackerspace provides a fileserver when you connect to the ''echo-vpn'' network. It its name is ''file'' and it has the ip-address ''192.168.1.32''. It provides media files and public storage for everyone and stores documents only accessible for workaways and the core members. | Este espacio hacker provee un fileserver cuando te conectas a la red ''echo-vpn''. Su nombre es ''file'' y tiene la siguiente ip-address ''192.168.1.32''. Contiene archivos multimedia, almacenamiento público para todos y documentos que solo son accesibles para voluntarios(workaway) y miembros del core. |
| |
| ==== Windoze ==== | ==== Windoze ==== |
| |
| * Open Explorer | * Abrir el eplorador |
| * Browse network | * Busque en la red |
| * find 'echohackerfarm' and 'file' | * Encuentre 'echohackerfarm' y 'file' |
| * connect to the share you want | * Conecte y comparta |
| |
| ==== OSX ==== | ==== OSX ==== |
| |
| * Open Finder | * Abra Finder |
| * Select Connect to Server | * Seleccione conectar al servidor |
| * Enter <code>smb://file</code> | * Ingrese <code>smb://file</code> |
| * select the share you want | * seleccione lo que desea compartir |
| |
| |
| ==== Ubuntu ==== | ==== Ubuntu ==== |
| |
| * Open Files | * Abra Arvhicos |
| * Select Connect to Server | * Seleccione conectar con el servidor |
| * Enter <code>smb://file</code> | * Ingrese <code>smb://file</code> |
| * select the share you want | * Seleccione y comparta lo que desee |
| |
| As workaway, upload any files (photos, documents or similar) you want to share with other workaways or the core-team into the **workaway** share. Upload any file you want to share with the whole world to the **public** share. | Como workaway, cargue cualquier archivo (fotos, documentos o similar) que desee compartir con otros workaways o el core-team en la acción ** workaway **. Cargue cualquier archivo que desee compartir con todo el mundo en el recurso ** public **. |
| |