advanced linux system administration. topic 0. lab 1 ... ·...
TRANSCRIPT
![Page 1: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/1.jpg)
Advanced Linux System Administra3on
Pablo Abad Fidalgo
Departamento de Ingeniería Informá2ca y Electrónica
Este tema se publica bajo Licencia:
Crea2ve Commons BY-‐NC-‐SA 4.0
Lab 1. Ge=ng Started. Linux installa3on (virtualiza3on)
José Ángel Herrero Velasco
![Page 2: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/2.jpg)
Session Index
• Previous: Lab & Virtualiza8on.
• Assignment 1: Installing Debian 7.
• Assignment 2: Snapshots.
• Assignment 3: Course VM.
![Page 3: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/3.jpg)
Previous: Lab & Virtualiza8on
• Laboratory Hardware. • Processor: Intel core i5. • Memory: 8GB DDRAM. • Windows 7.
• Laptop / Home PC. • Hardware ¿? • SoBware ¿?
Recommended: Memory >= 2GB
Virtualization Layer (Vbox)
• Virtual Laboratory – AbstracDon from assigned machine. – Simple rollback from SoBware errors. – Portable environment (Combine work at lab and
home).
![Page 4: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/4.jpg)
Previous: Virtualiza8on • Interfaces:
– Key aspect to deal with the complexity of a modern computer. – Interface hides implementaDon details (mult instrucDon
provided by ISA, no need to know how mulDplicaDon is implemented in HW): Employed both in HW and SW.
• Examples:
Sparc
Solaris
Solaris apps.
x86
Linux
Linux apps
x86
Windows
Windows apps.
![Page 5: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/5.jpg)
Previous: Virtualiza8on • Disadvantages of Interfaces:
– SoBware compiled for a specific ISA cannot be executed in a HW with different ISA. How can a Solaris (Sparc) binary run in a x86?
– Even with the same ISA, OS can differ. Can linux applicaDons run under Windows in a x86 machine?
Solaris OS
Solaris apps
x86 x86
Windows apps.
Linux
![Page 6: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/6.jpg)
OS
Applications
Hardware "Machine"
Previous: Virtualiza8on • Solu8on: Virtualiza8on:
– Add a SoBware layer which allows to overcome the limitaDons of Interfaces.
![Page 7: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/7.jpg)
Previous: Virtualiza8on • Solu8on: Virtualiza8on:
– Add a SoBware layer which allows to overcome the limitaDons of Interfaces.
OS
Applications
Virtualizing Software
Hardware "Machine"
![Page 8: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/8.jpg)
Previous: Virtualiza8on • Solu8on: Virtualiza8on:
– Add a SoBware layer which allows to overcome the limitaDons of Interfaces.
Virtual Machine
OS
Applications Guest
VMM
Host
OS
Applications
Virtualizing Software
Hardware "Machine"
![Page 9: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/9.jpg)
Previous: Virtualiza8on
Virtualization Layer
Host
Guests
![Page 10: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/10.jpg)
Previous: Virtualiza8on
• VirtualBox: – IniDally developed by Sun, currently supported by Oracle, under GPL license.
– MulDplaXorm Host (Linux, Osx, Windows...).
– MulDplaXorm Guest (Linux, Osx, Windows...).
• More flexible than other free alternaDves: – Vmware Player.
• Always employ the last version: 5.1.14.
![Page 11: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/11.jpg)
Session Index
• Previous: Lab & Virtualiza8on.
• Assignment 1: Installing Debian 7.
• Assignment 2: Snapshots.
• Assignment 3: Course VM.
![Page 12: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/12.jpg)
Assignment 1: Installing Debian 7
• Step 1: Define a new virtual machine in VirtualBox: – Type: Linux/Debian (64 bits). – ½ Physical Memory (min. 2 GB), ½ logic processors.
– 10 GB disk (Dynamic VDI).
– Start Machine: • What happens?
![Page 13: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/13.jpg)
Assignment 1: Installing Debian 7
• Step 2: Get a copy of the OS you want to employ (Debian): – Debian 7 (wheeze). – InstallaDon from image (ISO).
– Minimal ISO: • During installaDon process, we will connect to Debian servers (repositories) to download components on demand.
https://www.debian.org/distrib/
![Page 14: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/14.jpg)
Assignment 1: Installing Debian 7
• Step 3: Boo8ng the VM from the downloaded ISO: – Mount the ISO downloaded, acDng the CD unit of the virtual
machine.
– ConfiguraDon → Storage → Controller: IDE → CD/DVD Unit.
![Page 15: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/15.jpg)
Assignment 1: Installing Debian 7
• Step 4: Installa8on process: – Boot the Virtual Machine, which triggers the installaDon process.
– Graphic Install. – Password superuser: root. – Mirror Bp: Spain (choose one from the list), no proxy:
• Recommended: cdn.debian.net.
– CollecDons to install: NONE. – Once installaDon is complete, boot the machine and try to
access with your user and password.
![Page 16: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/16.jpg)
Session Index
• Previous: Lab & Virtualiza8on.
• Assignment 1: Installing Debian 7.
• Assignment 2: Snapshots.
• Assignment 3: Course VM.
![Page 17: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/17.jpg)
Assignment 2: Snapshots • Could be defined as a “photograph” of the Virtual System state at a
certain moment, stored in disk by Vbox.
• Crea8on: – You can generate a copy of the current state whenever you want. – If you create a snapshot when the machine is running, Main memory
state is also copied to disk ( << snapshot Size). – Advice: Always create snapshots aBer turning off the machine.
TASK 1 TASK 2 TASK 3 TASK 4 TASK 5
Sn-initial Sn-1 Sn-2 Sn-3 Sn-4 Sn-5
time
![Page 18: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/18.jpg)
Assignment 2: Snapshots • Restore:
– Restoring means going back in Dme. Any change made aBer a snapshot can be reverted.
– The snapshots store incremental changes (in separated files).
– The iniDal state can be restored eliminaDng the differenDal changes.
TASK 1 TASK 2 TASK 3 TASK 4 TASK 5
Sn-initial Sn-1 Sn-2 Sn-3 Sn-4
time
![Page 19: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/19.jpg)
Assignment 2: Snapshots • Restore:
– Restoring means going back in Dme. Any change made aBer a snapshot can be reverted.
– The snapshots store incremental changes (in separated files).
– The iniDal state can be restored eliminaDng the differenDal changes.
TASK 1 TASK 2 TASK 3 TASK 4 TASK 5
Sn-initial Sn-1 Sn-2 Sn-3 Sn-4
time
![Page 20: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/20.jpg)
Assignment 2: Snapshots • Restore:
– Restoring means going back in Dme. Any change made aBer a snapshot can be reverted.
– The snapshots store incremental changes (in separated files).
– The iniDal state can be restored eliminaDng the differenDal changes.
TASK 1 TASK 2 TASK 3 TASK 4 TASK 5
Sn-initial Sn-1 Sn-2 Sn-3 Sn-4
time
RESTORE
![Page 21: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/21.jpg)
Assignment 2: Snapshots • Restore:
– Restoring means going back in Dme. Any change made aBer a snapshot can be reverted.
– The snapshots store incremental changes (in separated files).
– The iniDal state can be restored eliminaDng the differenDal changes.
TASK 1 TASK 2 TASK 3 TASK 4
Sn-initial Sn-1 Sn-2 Sn-3 Sn-4
time
RESTORE
![Page 22: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/22.jpg)
Assignment 2: Snapshots • Removing snapshot:
– Removing an intermediate snapshot does not affect Virtual Machine state, it only frees host files that Vbox employed to store data about that snapshot.
TAREA 2 TAREA 3 TASK 4 TASK 5
Sn-initial Sn-1 Sn-2 Sn-3 Sn-4 Sn-5
time
TASK 1
![Page 23: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/23.jpg)
Assignment 2: Snapshots • Removing snapshot:
– Removing an intermediate snapshot does not affect Virtual Machine state, it only frees host files that Vbox employed to store data about that snapshot.
TAREA 2 TAREA 3 TASK 4 TASK 5
Sn-initial Sn-1 Sn-3 Sn-4 Sn-5
time
TASK 1
![Page 24: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/24.jpg)
Assignment 2: Snapshots • Removing snapshot:
– Removing an intermediate snapshot does not affect Virtual Machine state, it only frees host files that Vbox employed to store data about that snapshot.
TASK 4 TASK 5
Sn-initial Sn-1 Sn-3 Sn-4 Sn-5
time
TASK 2 + 3 TASK 1
![Page 25: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/25.jpg)
Assignment 2: Snapshots • With your VM turned off, create a snapshot named “ini#al”.
• Power on your VM, and create a file with the following command: cat /proc/cpuinfo > file1
• Turn off the machine and create another snapshot: “file1”.
• Power on again and run the command passwd to change your user password. Power off and create a snapshot named “passwd”.
initial
file1
passwd
Current state
![Page 26: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/26.jpg)
Assignment 2: Snapshots • Remove the snapshot “file1”. ABer that, check out what happened
with the file file1 if we restore the snapshot passwd. Can you find that file?
• Finally, restore the iniDal state of the machine. Check that the password has returned to its previous value. What happens with snapshot passwd aBer restoring to iniDal state?
initial
file1
passwd
Current state
![Page 27: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/27.jpg)
Session Index
• Previous: Lab & Virtualiza8on.
• Assignment 1: Installing Debian 7.
• Assignment 2: Snapshots.
• Assignment 3: Course VM.
![Page 28: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/28.jpg)
Assignment 3: Course VM • Once Debian has been installed on your Virtual Machine… Discard
it.
• We will make use of a VM specially created and opDmized for this course: – Common starDng point for everybody.
– Includes part of the tools employed in lab.
– OpDmized to work with VirtualBox.
• The link below contains a folder labeled VM, where you will find a tar.gz file with the Machine for this course:
hmps://www.ce.unican.es/OCW/SI/VM/core-‐32_SI.tar.gz
• Download and uncompress the file. Copy the contents in the folder where you want to work.
• Add the VM to Vbox and create a snapshot of the iniDal state.
![Page 29: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/29.jpg)
Assignment 3: Course VM • Migra8ng a Virtual Machine between two PCs:
– Useful in case of working simultaneously at Lab and at home.
– Also useful to prevent HW failures (what if your laptop breaks?).
Virtualization Layer (Vbox)
![Page 30: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/30.jpg)
Assignment 3: Course VM • Folder organiza8on for a Virtual Machine in Vbox:
Virtual_Machine
logs: messages with info about installation, errors, etc. (~500KB).
Snapshots: folder with incremental disk files (vdi/vmdk) containing the differences between two snapshots (Size??).
Virtual Disk Image: (vdi or vmdk) Disk Image. Large size (1-2GB).
VirtualBox Machine Definition: Xml file with the definition/configuration of the VM (8KB).
![Page 31: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/31.jpg)
VM
logs
Sshots
Assignment 3: Course VM • Step 1: Replicate the Base VM:
– We must copy all the VM files from one PC to the other one. This way, both PCs have the same iniDal image.
– Large amount of data, but fortunately this only has to be done once.
Virtualization Layer (Vbox)
![Page 32: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/32.jpg)
VM
logs
Sshots
Assignment 3: Course VM • Step 1: Replicate the Base VM:
– We must copy all the VM files from one PC to the other one. This way, both PCs have the same iniDal image.
– Large amount of data, but fortunately this only has to be done once.
Virtualization Layer (Vbox)
![Page 33: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/33.jpg)
VM
logs
Sshots
VM
logs
Sshots
Assignment 3: Course VM • Step 1: Replicate the Base VM:
– We must copy all the VM files from one PC to the other one. This way, both PCs have the same iniDal image.
– Large amount of data, but fortunately this only has to be done once.
Virtualization Layer (Vbox)
![Page 34: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/34.jpg)
VM
logs
Sshots
VM
logs
Sshots
Assignment 3: Course VM • Step 2: Migra8ng your work between hosts:
– Once the iniDal copy has been made, only the migraDon of a few files is required to maintain the same state in both hosts.
– Procedure: Work in lab → Create snapshot → Copy [.vbox + Snapshots] → Overwrite these files in laptop → Keep on working…
Virtualization Layer (Vbox)
![Page 35: Advanced Linux System Administration. Topic 0. Lab 1 ... · AdvancedLinuxSystemAdministraon(PabloAbadFidalgo(DepartamentodeIngenieríaInformácayElectrónica EstetemasepublicabajoLicencia:](https://reader030.vdocuments.site/reader030/viewer/2022040912/5e877613f046f563075071ff/html5/thumbnails/35.jpg)
Assignment 3: Course VM • Migra8on test:
– Let’s try to migrate the VM prepared for this course. You don’t need to perform step 1 in this case ( You all have the same base machine installed). In your PC, power on the Course VM and create two new folders (mkdir), labeling them with your first and second surnames. Power off the VM and create a snapshot.
– Copy the required files in a pendrive and exchange the PC with your classmate.
– In your new PC, overwrite the files with the ones in the pendrive, power on the VM and check if you are able to see the folders created previously.