Informàtica / Computers

General

X-Window


list comparison config












Debian Mandriva









display manager (login/password)

/etc/X11/default-display-manager /etc/sysconfig/desktop
  • DISPLAYMANAGER=kdm
  • DESKTOP=XBMC
XDM
GDM
KDM
SDDM

WDM SLiM LXDM





/etc/X11/xdm/Xaccess

/usr/share/config/kdm/kdmrc
  • AutoLoginEnable=true
  • AutoLoginUser=user



/etc/lxdm/









New instance of kdm: kdmctl reserve





desktop environment
wp
/etc/X11/wmsession.d/
(available desktop environments at display manager)
  • 01KDE
  • 07IceWM
  • 15XBMC
  • 99MythFrontend

IRIX Interactive Desktop (Indigo Magic) GNOME Xfce KDE CDE

LXDE
  • Etoilé
  • GNUStep
  • ROX
  • UDE
widget toolkit wp



Motif GTK+ Qt
WINGs


window manager xwinman wp
  • ~/.xsession
  • update-alternatives --display x-window-manager

twm (vtwm, tvtwm, CTWM, FVWM) 4Dwm (Sawfish)
Metacity
Xfwm4 KWin
Window Maker Enlightenment

session manager




xsm



ksmserver



LXSession
autostart








Configure desktop -> Advanced ->  Autostart


(LXSession)





~/.xinitrc


  • aplications: ~/.config/autostart/*.desktop
  • scripts: ~/.kde4/Autostart/*.desktop ~/.kde4/share/autostart/*.desktop



  • aplications: ~/.config/autostart/*.desktop





aplicacions
entorns d'escriptori
cde gnome kde xfce
widgets / toolkits
forms / fltk gtk gtk-qt motif / lesstif qt wx-Windows
wxWidgets
gestors de finestres
fvwm MetaCity Enlightment Sawfish Compiz Beryl
gràfics
SDL
directfb x11 (fbdev)
x11 (drivers)
mgl nano-x open gl svgalib
fbdev
vesa
  • intelfb
  • nvidiafb
  • viafb
  • ...
(x11-drivers)



sistemes operatius creuats / màquines virtuals
(mac)
basilisk
()
()
bochs
()
cygwin
(ms-windows)
()
macwindows
()
(ppc-based)
pear pc
(x86)
()
plex86
()
softwindows
(irix)
(x86-based)
vmware
(x86)
openVZ xen
(x86)
kvm
(linux x86)
()
wine / xwine
()
()
DOSBox
()
()
qemu
()
(x86)
VirtualBox
(x86)
sistemes operatius
unix
freebsd gnu/linux hp-ux irix mac os-x netbsd solaris
ms-windows
casa empresa port
3.x, 95, 98, me, xp-he nt, 2000, xp-pe, 2003 ce
FreeDOS apple mac-os be-os os/2 NeXT Step / OpenStep / GNUStep palm os symbian
arquitectura
arm mips ppc sparc
x86
amd intel via

  • Gnome (GTK) (wp)
  • KDE (Qt) (wp)
    • Applications
      • ...
    • Themes
      • ...
  • wine

    • file toto.exe installation
      usage
      to run:

      Mageia

      wine management

      urpmi qtbase5-database-plugin-sqlite q4wine
      win32 programs
      PE32 executable (GUI) Intel 80386, for MS Windows (activate 32 bit repositories)
      urpmi wine wine32
      • WINEPREFIX=~/.toto_win_32 WINEARCH=win32 winecfg
      • WINEPREFIX=~/.toto_win_32 WINEARCH=win32 wine explorer
      • WINEPREFIX=~/.toto_win_32 WINEARCH=win32 wine iexplore
      • WINEPREFIX=~/.toto_win_32 WINEARCH=win32 wine toto.exe
      win64 programs
      PE32+ executable (GUI) x86-64, for MS Windows urpmi wine64
      • WINEPREFIX=~/.toto_win_64 WINEARCH=win64 winecfg
      • WINEPREFIX=~/.toto_win_64 WINEARCH=win64 wine64 explorer
      • WINEPREFIX=~/.toto_win_64 WINEARCH=win64 wine64 iexplore
      • WINEPREFIX=~/.toto_win_64 WINEARCH=win64 wine64 toto.exe
    • Instal·lació / Installation
      • Mageia
        • optional: if you will also want to execute win32 programs, activate 32-bit repository
        • 32-bit 64-bit
          wine32 (those 32-bit binaries that are also used on 64-bit for 32-bit support):
          • /usr/bin/{wine,wine-preloader}
          • /usr/lib/wine/
          wine64 (all 64-bit files (suggests 'wine32')):
          • /usr/bin/{wine64,wine64-preloader}
          • /usr/lib64/wine/
          wine (all other files (requires 'wine32')) (not needed if you install wine64):
          • /etc/rc.d/init.d/wine
          • /usr/bin/{msiexec,notepad,regedit,regsvr32,wineboot,wineconsole,winefile,winemine,winepath,wineserver}
          • /usr/share/doc/wine/
          • /usr/share/wine/
          • /etc/rc.d/init.d/wine
          • /usr/bin/{msiexec,notepad,regedit,regsvr32,wineboot,wineconsole,winefile,winemine,winepath,wineserver}
          • /usr/share/doc/wine/
          • /usr/share/wine/
        • to run win64 programs
          • urpmi wine64
          • Més informació sobre el paquet wine64-2.0.2-1.mga6.x86_64
            This is the Win64 version of Wine. This version can only be used to run
            64-bit Windows applications as is. For running 32-bit Windows applications,
            you need to also install the 'wine32' package from the 32-bit repository.
        • to run win32 programs
          • urpmi wine32
        • gui
          • urpmi qtbase5-database-plugin-sqlite q4wine
      • From source
        • dependencies
          • Mageia
            • activate 32-bit repositories
            • urpmi gcc flex bison
            • urpmi --ignorearch libx11-devel libfreetype2-devel libxrender-devel libxml2-devel libjpeg-devel libglu-devel libalsa2-devel libxslt-devel libgnutls-devel
        • git clone git://source.winehq.org/git/wine.git
        • cd wine
        • ./configure
        • make
        • sudo make install
      • From source using rpmbuild (Mageia):
        • wine + wine-staging (e.g. v4.18 + staging):
          • install wine....src.rpm
          • cd ~/rpmbuild/SOURCES
          • wget https://dl.winehq.org/wine/source/4.x/wine-4.18.tar.xz
          • wget https://dl.winehq.org/wine/source/4.x/wine-4.18.tar.xz.sign
          • wget https://github.com/wine-staging/wine-staging/archive/v4.18/wine-staging-4.18.tar.gz
          • cd ~/rpmbuild/SPECS
          • wine.spec
            • %define mainver 4.18
              #define bugfix 1
              ...
              %define staging 1
              ...
              %define mono_version    4.9.3
              ...
              %{_datadir}/%{name}/%{name}bus.inf
              %{_datadir}/%{name}/%{name}hid.inf
          • rpmbuild -ba wine.spec
          • Problemes / Problems
            • Errors de construcció del RPM:
                  No s'ha trobat el fitxer: /root/rpmbuild/BUILDROOT/wine-4.18-1.mga7.x86_64/usr/lib64/wine/*.cpl.so
                  No s'ha trobat el fitxer: /root/rpmbuild/BUILDROOT/wine-4.18-1.mga7.x86_64/usr/lib64/wine/*.ocx.so
                  No s'ha trobat el fitxer: /root/rpmbuild/BUILDROOT/wine-4.18-1.mga7.x86_64/usr/lib64/wine/*.tlb.so
        • wine-mono
          • install wine-mono....src.rpm
          • cd ~/rpmbuild/SOURCES
          • wget http://dl.winehq.org/wine/wine-mono/4.9.3/wine-mono-4.9.3.tar.gz
          • cd ~/rpmbuild/SPECS
          • wine-mono.spec
            • Version:     4.9.3
              ...
              #Patch0:...
              #Patch1:...
              ...
              #patch0...
              #patch1...
              ...
              #MAKEOPTS=%{_smp_mflags} WINE=%{wine} MSIFILENAME=wine-mono-%{version}.msi ./build-winemono.sh.static
              MAKEOPTS=%{_smp_mflags} WINE=%{wine} MSIFILENAME=wine-mono-%{version}.msi make msi
          • rpmbuild -ba wine-mono.spec
    • Utilització / Usage
      • Win32 programs
        • WINEPREFIX=~/.toto_win_32 WINEARCH=win32 winecfg
          • Aplicacions
            • Versió de Windows: ...
        • WINEPREFIX=~/.toto_win_32 WINEARCH=win32 wine iexplore
        • wine "c://Program Files (x86)/SCARM/scarm.exe"
      • Win64 programs
        • WINEPREFIX=~/.toto_win_64 WINEARCH=win64 winecfg
        • WINEPREFIX=~/.toto_win_64 WINEARCH=win64 wine iexplore
    • Impressió / Print
    • winetricks
    • Wine application database
    • Problemes  / Problems
      • League of legends
      • Wine cannot find the FreeType font library. To enable Wine to use TrueType fonts please install a version of FreeType greater than or equal to 2.0.5.
        • Solució / Solution
          • install libfreetype6,  32-bit version
            • Mageia
              • enable 32-bit repositories
              • urpmi libfreetype6
      • err:module:import_dll Library libgcc_s_sjlj-1.dll (which is needed by L"C:\\windows\\system32\\gecko\\2.21\\wine_gecko\\nspr4.dll") not found
        • Solució / Solution
          • Wine-gecko depends on libgcc
          • Mageia
            • urpmi mingw32-gcc
            • cp /usr/i686-w64-mingw32/sys-root/mingw/bin/libgcc_s_sjlj-1.dll ~/.toto_win_32/drive_c/windows/system32
      • zlib1.dll not found:
      • Access violation at address 00000000 (e.g. with SCARM)
      • 0010:err:winediag:SECUR32_initNTLMSP ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
        • Solució / Solution
          • Mageia
            • urpmi samba-winbind-clients
      • 0017:fixme:ntdll:NtLockFile I/O completion on lock not implemented yet
        • ...
      • when running 32-bit programs with Wine 1:6.0, e.g. WINEPREFIX=~/.toto_win_32 WINEARCH=win32 winecfg
        • 002c:err:module:DelayLoadFailureHook failed to delay load user32.dll.CreateDialogParamW
        • 002c:err:module:DelayLoadFailureHook failed to delay load shell32.dll.SHGetFolderPathW
        • Solució / Solution
          • ...
  • ReactOS

Particions a l'MBR / Partitions on MBR


MBR (/dev/hda) (Master Boot Record / Partition Sector): 512B (C=0, H=0, S=1)
back-up restore MBC particions / partitions (/dev/hdax)
points to boot sector (first 512 bytes of the active partition) name view / edit create filesystem
image
extract create bootloader
(ARCS)
create (format)
check and repair resize create recover
DOS


fdisk /mbr
c:, d:, e: ... ptedit fdisk format


dell restore
Ranish Partition Manager (part244)

Norton Ghost
win32

mkbt -c a: bootsect.bin MBR: fixmbr
VBR: fixboot
NTLDR: boot.ini ptedit32





xosl






Linux
  • install-mbr (mbr)
  • dd if=/dev/hda of=mbr.bin bs=512 count=1
  • dd if=mbr.bin of=/dev/hda bs=512 count=1











id mbr
primary / extended logical
IDE
(PATA)
prim. 0 /dev/hda
/dev/hda[1..4] /dev/hda[5..]
1 /dev/hdb
/dev/hdb[1..4] /dev/hdb[5..]
sec. 0 /dev/hdc
/dev/hdc[1..4] /dev/hdc[5..]
1 /dev/hdd
/dev/hdd[1..4] /dev/hdd[5..]
SCSI
USB
SATA

n /dev/sd[a-p] /dev/sd[a-p][1..]

dist

... gparted LiveCD mandriva
app GNU parted qtparted
gparted Disk Drake YaST
lib

ntfsresize
  • cfdisk /dev/hda
  • fdisk /dev/sdx
  • mkfs -t ext3 /dev/sdb6
  • mkfs.ext4 /dev/sdb6
  • mkdosfs -I /dev/hdax (dosfstools)
  • fsck
  • e2fsck
  • resize2fs
    • -M: shrink
  • xfs_growfs (only grow, no shrink)
dist LiveCD
app partimage Device Image (zsplit)
Irix

dvhtool

controller id
SCSI 0 n /dev/dsk/dks0dns[0..15]

0: root 7 10: volume
1: swap
6: usr
8: volhdr (sash)
15: xfslog
types: efx/xfs, volhdr, raw, xfslog
  • prtvtoc /dev/rdsk/dks0d5s0
  • prtvtoc /dev/rdsk/dks0d5vh
  • fx
  • mkfs /dev/dsk/dks0d5s0
  • fsck



Sistemes operatius / Operating systems

Boot




MBR dev dev
name sector code name partition sector bootloader name part sector
name config


PC BIOS HDD MBR boot (first: 512B) MBC HDD boot / active boot (first: 512B) lilo lilo.conf HDD (any) first
NTLDR boot.ini

floppy
boot




CDROM






USB






SGI











Dreambox first stage
serial






NAND flash (JFFS2) 2nd stage first: 128KB 2nd stage loader
NAND flash boot
CF first
tftp

CF first






Desenvolupament / Development

framework .NET Java Platform

specification implementation specification impl
MS .NET MS .NET compact framework Mono SSCLI Portable .NET

language


(C# compiler)

  • Java

framework libraries
BCL

(partial)

  • JaveME (limited)
  • JavaSE (workstation)
  • JavaEE (server)

intermediate language / bytecode CLI:
CIL MSIL
x x
Java bytecode (.class)
runtime / virtual machine VES
CLR

JVM

OS








Perl

Python

Comercial / Commercial

Virtualització / Virtualisation

  • Comparison of virtual machines (Wikipedia)
  • x86 virtualization (Wikipedia)
  • Virtual Machines are No Security Blanket (Linux Magazine)
  • Virtualization technology (VT)
    • Comproveu que la vostra CPU pot fer virtualització / Check that your CPU is able to do virtualisation:
      • egrep '^flags.*(vmx|svm)' /proc/cpuinfo
        • Intel: vmx
        • AMD: svm
    • Comproveu que la BIOS té la virtualització habilitada / Check that the virtualisation is enabled on BIOS:
      • Security:
        • VT: enabled
    • Carregueu el mòdul del kernel adequat / Load the needed kernel module:
      • Intel (vmx): modprobe kvm_intel
      • AMD (svm): modprobe kvm_amd
  • libvirt
  • QEMU
    • Resizing a QEMU virtual machine, partition, and filesystem (dd)
    • Resizing qemu images (MSWindows copy /b)
    • Usage in Mandriva 2010.0
      • install and start kvm
      • qemu-kvm -hda linux.img -cdrom toto.iso -boot d
    • Qemu 0.8.1 sur Mandriva 2006
    • Creation of disk files
      • 2GB file: qemu-img create linux.img 2G
      • 2GB raw file: dd if=/dev/zero of=linux.img seek=2 obs=1GB count=0
    • Boot from iso image:
      • qemu -boot d -cdrom toto.iso -hda linux.img
    • Mount raw file
    • QEMU Official OS Support List Version (claunia)
    • KVM (extension for QEMU: hardware acceleration)
      • urpmi kvm
      • modprobe kvm_intel
      • Used by Android AVD
      • Incompatible with VirtualBox
        • No s'ha pogut obrir una sessió per a la màquina virtual wct_frontend_ajs.
          VT-x is being used by another hypervisor (VERR_VMX_IN_VMX_ROOT_MODE).
          VirtualBox can't operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot (VERR_VMX_IN_VMX_ROOT_MODE).
          Resultat Codi:NS_ERROR_FAILURE (0x80004005)
          Component:ConsoleWrap
          Interfície:IConsole {872da645-4a9b-1727-bee2-5585105b9eed}
        • Workaround
          • When using VirtualBox, disable hardware virtualisation acceleration (can only be done if hosted os is 32-bit)
        • Solution
      • Nested virtualization (virtual machines inside a virtual machine)
        • echo "options kvm-intel nested=y" | sudo tee /etc/modprobe.d/kvm-intel.conf
  • VM Back
  • VMWare
  • Virtual Box (Oracle)
    • VirtualBox virtual appliances
    • Usage
      • service virtualbox start
      • VirtualBox
    • Command line
    • settings
      • old:
        • ~/.VirtualBox/
          • VBoxSVC.log
      • new:
        • ~/.config/VirtualBox/
          • VBoxSVC.log
    • Nested virtualization
    • Mida de la pantalla / Screen size
    • How to mount a VirtualBox VDI image:
      • modprobe nbd  max_part=16
      • qemu-nbd -c /dev/nbd0 toto.vdi
      • mkdir /mnt/vdi_image
      • mount -t ext4 /dev/nbd0p1 /mnt/vdi_image
      • you will get /dev/nbd0p1
    • Disc / Disk
      • Increase disk size (e.g. from 10GiB to 15GiB, 15360MBytes)
        1. stop virtual machine
        2. from real computer: resize disk
          • list all available disks
            • VBoxManage list hdds
            • VBoxManage list hdds | grep -4 myname
          • resize to 15360MiB (15GiB):
            • VBoxManage modifymedium disk <filename_or_uuid_from_list> --resize 15360
        3. start and connect to virtual machine
        4. resize partition (e.g. resize partition /dev/sda2 so as it uses all available space in disk)
          • lsblk
            • example before resizing partition sda2 to 15GB (15360 MBytes)
              • NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
                sda                  8:0    0   15G  0 disk
                ├─sda1               8:1    0    1G  0 part /boot
                └─sda2               8:2    0   11G  0 part
                  ├─almalinux-root 253:0    0  9,8G  0 lvm  /
                  └─almalinux-swap 253:1    0  1,2G  0 lvm  [SWAP]
                sr0                 11:0    1 1024M  0 rom 
          • fdisk /dev/sda
            • p: print partitions
            • d: delete partition
              • Nombre de partició (1,2, default 2):
            • n: new partition
              • Partition type
                   p   primary (1 primary, 0 extended, 3 free)
                   e   extended (container for logical partitions)
                Select (default p):
              • Nombre de partició (2-4, default 2):
                First sector (2099200-31457279, default 2099200):
                Last sector, +sectors or +size{K,M,G,T,P} (2099200-31457279, default 31457279):

                Created a new partition 2 of type 'Linux' and of size 14 GiB.
                Partition #2 contains a LVM2_member signature.

                Do you want to remove the signature? [Y]es/[N]o: n
            • t 8e: change partition type to "Linux LVM" (if that was the original type)
              • Nombre de partició (1,2, default 2):
                Hex code (type L to list all codes): 8e

                Changed type of partition 'Linux' to 'Linux LVM'.
            • w: write to disk
          • partprobe
          • lsblk
            • example after resizing partition sda2 to 14GB
              • NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
                sda                  8:0    0   15G  0 disk
                ├─sda1               8:1    0    1G  0 part /boot
                └─sda2               8:2    0   14G  0 part
                  ├─almalinux-root 253:0    0  9,8G  0 lvm  /
                  └─almalinux-swap 253:1    0  1,2G  0 lvm  [SWAP]
                sr0                 11:0    1 1024M  0 rom  
        5. (additional step when guest os is using LVM) resize LVM:
          • sudo -i
          • pvresize /dev/sda2
            • Physical volume "/dev/sda2" changed
              1 physical volume(s) resized or updated / 0 physical volume(s) not resized
          • pvs
            • check for some value for PFree (last column)
              • PV         VG        Fmt  Attr PSize   PFree
                /dev/sda2  almalinux lvm2 a--  <14,00g 3,00g
          • lsblk
            • before resizing lvm:
              • NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
                sda                  8:0    0   15G  0 disk
                ├─sda1               8:1    0    1G  0 part /boot
                └─sda2               8:2    0   14G  0 part
                  ├─almalinux-root 253:0    0  9,8G  0 lvm  /
                  └─almalinux-swap 253:1    0  1,2G  0 lvm  [SWAP]
                sr0                 11:0    1 1024M  0 rom 
          • df -hT
            • S. fitxers                 Tipus     Mida En ús Lliure  %Ús Muntat a
              devtmpfs                   devtmpfs  3,8G     0   3,8G   0% /dev
              tmpfs                      tmpfs     3,8G   48K   3,8G   1% /dev/shm
              tmpfs                      tmpfs     3,8G  8,6M   3,8G   1% /run
              tmpfs                      tmpfs     3,8G     0   3,8G   0% /sys/fs/cgroup
              /dev/mapper/almalinux-root xfs       9,8G  9,8G    33M 100% /
              /dev/sda1                  xfs      1014M  337M   678M  34% /boot
              tmpfs                      tmpfs     777M     0   777M   0% /run/user/1969

          • lvextend -l+100%FREE /dev/mapper/almalinux-root
          • lsblk
            • after resizing lvm
              • NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
                sda                  8:0    0   15G  0 disk
                ├─sda1               8:1    0    1G  0 part /boot
                └─sda2               8:2    0   14G  0 part
                  ├─almalinux-root 253:0    0 12,8G  0 lvm  /
                  └─almalinux-swap 253:1    0  1,2G  0 lvm  [SWAP]
                sr0                 11:0    1 1024M  0 rom
                 
        6. resize filesystem
          • ext2/3/4
            • resize2fs /dev/sda2
            • resize2fs /dev/mapper/almalinux-root
            • resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
          • xfs
            • sudo dnf install xfsprogs
            • sudo xfs_growfs -d /
          • df -hT
            • S. fitxers                 Tipus     Mida En ús Lliure  %Ús Muntat a
              devtmpfs                   devtmpfs  3,8G     0   3,8G   0% /dev
              tmpfs                      tmpfs     3,8G   48K   3,8G   1% /dev/shm
              tmpfs                      tmpfs     3,8G  8,6M   3,8G   1% /run
              tmpfs                      tmpfs     3,8G     0   3,8G   0% /sys/fs/cgroup
              /dev/mapper/almalinux-root xfs        13G  9,8G   3,1G  77% /
              /dev/sda1                  xfs      1014M  337M   678M  34% /boot
              tmpfs                      tmpfs     777M     0   777M   0% /run/user/1969
      • Compact a vdi file
        • How to compact VirtualBox's VDI file size?
        • Passos / Steps
          • Guest (virtual)
            • one of the following:
              • dd if=/dev/zero of=/var/tmp/bigemptyfile bs=4096k ; rm /var/tmp/bigemptyfile
              • telinit 1
                mount -o remount,ro /dev/sda1
                zerofree -v /dev/sda1
          • Host (real)
            • VBoxManage modifymedium --compact /path/to/thedisk.vdi
    • VBoxVmService (sf) (autostart VM in MS Windows)
    • Extension pack
      • Update
        • Fitxer -> Comprova si hi ha actualitzacions
      • Installing VirtualBox and extension packs
      • Download
        • from your browser, just click on file: <your_installed_virtualbox_version>/Oracle_VM_VirtualBox_Extension_Pack....vbox-extpack
        • this will open VirtualBox and install it
        • if you installed VirtualBox from system packages, a window asking the root password will be shown; check that the window is not hidden behind VirtualBox main and progress windows
      • Content
        • virtual USB 2.0 device
        • VirtualBox Remote Desktop Protocol (VRDP)
        • Intel PXE boot ROM
        • PCI passthrough
    • VirtualBox Remote Desktop Protocol (VRDP)
    • USB
      1. Install extension pack
      2. Add your user to group vboxusers:
        • # sudo usermod -a -G vboxusers user_name
        • $ newgrp vboxusers
      3. start VirtualBox manager
      4. Activate the device in the VirtualBox instance settings:
        • Paràmetres / USB / add a filter
          • a list with all available usb devices should appear
          • select the wanted ones
      5. USB device can also be activated once the virtual machine is running
        • Devices / USB
          • select the wanted ones
    • Xarxa / Network
    • Muntatge d'un directori de la màquina amfitrió des de la màquina virtual:
      • Màquina amfitrió
        • Dispositius -> Paràmetres de carpeta compartida
          • Afegeix
            • Camí cap a la carpeta:
              • /home/usuari
            • Nom de la carpeta:
              • toto
      • Màquina virtual (Linux)
        • sudo mkdir -p /mnt/tata
        • sudo mount -t vboxsf toto /mnt/tata
    • Same config as an AWS EC2 CentOS instance
      • on virtual machine
        • add user centos:
          • useradd centos
        • configure it as sudoer:
          • echo "centos ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/centos
        • start sshd server:
          • systemctl start sshd.service
      • on local machine
        • install ssh certificate to virtual machine:
          • ssh-copy-id -i ~/.ssh/id_rsa_remoteserver.pub centos@virtualserver
        • connect to virtual machine:
          • ssh -i ~/.ssh/id_rsa_remoteserver.pem centos@virtualserver
    • Problemes / Problemes
      • "VirtualBox can't operate in VMX root mode"
        • rmmod kvm_intel
      • Lenta / Slow
      • Problemes amb el ratolí / Mouse issues
      • No s'ha pogut obtenir l'objecte VirtualBoxClient COM.
        L'aplicació es finalitzarà..
        Subrutina RC:NS_ERROR_ABORT (0x80004004)
        • check with command line:
          • $ VBoxManage list vms
            VBoxManage: error: Failed to create the VirtualBox object!
            VBoxManage: error: Code NS_ERROR_ABORT (0x80004004) - Operation aborted (extended info not available)
            VBoxManage: error: Most likely, the VirtualBox COM server is not running or failed to start.
        • ~/.VirtualBox/VBoxSVC.log
          • 00:00:00.137342 nspr-2   Failed to open "/dev/vboxdrvu", errno=13, rc=VERR_VM_DRIVER_NOT_ACCESSIBLE
            00:00:00.144183 nspr-2   failed to create vboxnet0, error (0xffffffff)
            00:00:00.150341 nspr-2   failed to create vboxnet1, error (0xffffffff)
            00:00:00.158676 nspr-2   failed to create vboxnet2, error (0xffffffff)
            00:00:00.164803 nspr-2   failed to create vboxnet3, error (0xffffffff)
            00:00:00.172484 nspr-2   failed to create vboxnet4, error (0xffffffff)
            00:00:00.179049 nspr-2   failed to create vboxnet5, error (0xffffffff)
        • Solució / Solution
          • sudo usermod -a -G vboxusers my_user
          • newgrp vboxusers
          • mv ~/.VirtualBox ~/.VirtualBox_old
          • update/reinstall Extension Pack
          • you will need to add your VM again
  • FAUMachine

Contenidors / Containers

  • Contenidors
  • Orquestradors
  • Docker
    • Instal·lació / Installation
      • Docker Engine
        • directori amb les imatges / directory with images
          • /var/cache/docker/
        • Binaris
          • Install Docker Engine from binaries
          • Passos per a la instal·lació
            1. wget https://download.docker.com/linux/static/stable/x86_64/docker-24.0.5.tgz
            2. tar xvzf docker-24.0.5.tgz
            3. sudo -i
            4. sudo cp docker/* /usr/local/bin
          • Passos per a l'ús
            1. sudo -i
            2. export PATH=$PATH:/usr/local/bin
            3. dockerd &
        • Fedora
          1. setup repo
            • sudo dnf -y install dnf-plugins-core
            • sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
          2. install
            • sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
        • Mageia
          • sudo urpmi docker
            • Problema
              • echo "FROM hello-world:latest" >toto.Dockerfile
                docker build -f toto.Dockerfile -t toto .
          • sudo urpmi docker-compose (instal·leu el docker compose plugin)
        • Debian (Raspberry Pi)
          • sudo apt install docker.io
          • sudo apt install docker-compose
        • Use docker from non-root user:
          • sudo groupadd docker
            sudo usermod -aG docker $USER
            newgrp docker
      • Docker Desktop (Linux)
        • ...
    • Server
    • Docs
      • Docker overview
      • Diferències entre docker build i docker compose:

        descripció manual reference exemple ús
        Docker build
        defineix en un fitxer (Dockerfile):
        com s'ha de crear (build) una imatge.
        Normalment parteix d'una image estàndard (FROM) i li afegeix configuració específica
        Packaging your software Dockerfile reference Dockerfile
        • # syntax=docker/dockerfile:1
          FROM ubuntu:22.04

          # install app dependencies
          RUN apt-get update && apt-get install -y python3 python3-pip
          RUN pip install flask==2.1.*

          # install app
          COPY hello.py /

          # final configuration
          ENV FLASK_APP=hello
          EXPOSE 8000
          CMD flask run --host 0.0.0.0 --port 8000
        • # syntax=docker/dockerfile:1
          FROM python:3.7-alpine

          # install app dependencies
          RUN apk add --no-cache gcc musl-dev linux-headers
          WORKDIR /code
          COPY requirements.txt requirements.txt
          RUN pip install -r requirements.txt

          # install app
          COPY . .

          # final configuration
          EXPOSE 5000
          ENV FLASK_APP=app.py
          ENV FLASK_RUN_HOST=0.0.0.0
          CMD ["flask", "run"]
        docker build [-f Dockerfile] ...
        Docker compose defineix en un fitxer (docker-compose.yml):
        diversos elements i s'aixecaran diversos contenidors relacionats.
        Indica la imatge de partida, que pot ser una de nostra creada amb docker build.
        Es poden indicar mapatges de directoris, ports i xarxes.
        Docker Compose overview Compose file reference docker-compose.yml
        • services:
            web:
              build: .
              ports:
                - "8000:5000"
              volumes:
                - .:/code
              environment:
                FLASK_DEBUG: "true"
            redis:
              image: "redis:alpine"
        docker compose ...
      • Registre d'imatges / Registry for images
        • Official
        • Private/public registry on AWS
          • ECR: Amazon Elastic Container Registry
          • Push images to registry
            • "View push commands"
              • aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin <id>.dkr.ecr.<region>.amazonaws.com
              • <id>.dkr.ecr.<region>.amazonaws.com
      • CLI



        • docker
          docker-compose
          docker compose



          command CLI options examples command docker-compose.yml
          (Compose file reference)

          informació sobre docker / information about docker:
          • Docker Root Dir: /var/cache/docker
            • on es desen les imatges / where images are stored
          • ...

          docker info



          imatges construcció d'una imatge a partir del Dockerfile /
          build an image from the Dockerfile

          docker build [-f Dockerfile]
          -t image_name:x.y.z .



          etiquetació / tag
          (no augmenta l'espai ocupat; només afegeix una referència a la llista)

          docker tag src_image_name:x.y.z dst_image_name:a.b.c


          etiquetació prèvia a la pujada (push) cap al registre remot
          docker tag image_name:x.y.z <remote_registry>/image_name:x.y.z
          image_name:x.y.z <remote_registry>/image_name:latest



          pujada d'una imatge cap al registre / upload an image to a registry
          docker push <remote_repo>/image_name:x.y.z <remote_repo>/image_name:latest


          llista de les imatges d'un registre remot
          (Three Ways to Check a Docker Image Exists In Registry)






          baixada d'una imatge des del repositori /
          download an image from a registry (default: Docker Hub)

          docker pull <image_name>


          llista de les imatges baixades / list of downloaded images
          • docker images
          • docker image ls




          inspecció d'una imatge / inspect an image
          docker inspect <image_name>


          esborrar una imatge (neteja) / delete an image
          • docker image rm <image_name>:<tag> (si no s'especifica :<tag>, posarà :latest)
          • docker image rm <image_id>




          contenidors creació d'un contenidor / create a container
          docker create



          creació d'un contenidor a partir d'una imatge i execució d'una ordre /
          create a container from an image and execute a command
          (run = pull + create + exec)

          docker run
          • docker run hello-world
          • docker run -it alpine sh
          • docker run -it bash bash
          • docker run -it ubuntu bash
          • docker run -it --rm -d -p 8080:80 --name web nginx
            • http://localhost:8080/
          docker-compose up
          docker compose up

          (by default it will use docker-compose.yml)

          image name
          <image_name>

          image: <image_name>
          command
          <command> <command_options>


          ephemeral container
          --rm


          detach (background)
          -d


          using a specific user
          --user <user_id>:<group_id>


          container name
          --name <container_name>

          container_name: <container_name>
          environment variables
          -e VAR1=value1
          -e VAR2=value2
          -e ...
          -e HOST_PROC=/host/proc


          environment:
           - VAR1=value1
           - VAR2=value2
           - ...
          ports
          -p/--publish <port_in_host>:<port_in_container>
          -p ...


          ports:
           - "<port_in_host>:<port_in_container>"
          volumes
          -v <dir_in_host>:<dir_in_container> -v <dir_in_host>:<dir_in_container>:ro
          -v ...


          volumes:
           - <dir_in_host>:<dir_in_container>
           - ...
          working dir
          -w <dir_in_container>


          network
          --network <network_name>


          image name
          <image_name>

          image: <image_name>
          command
          <command> <command_options>


          detalls d'un contenidor / details of a container



          docker-compose run <service_name> env
          execució (interactiva + tty) d'una ordre en un contenidor existent /
          execute (interactively + tty) a command in an existing container

          docker exec -it
          <container_name> <command> <command_options>



          inici d'un contenidor existent / start an existing container
          docker start <container_name|container_id>


          llista de contenidors existents / list of existing containers
          • docker ps -a
          • docker container ls -a


          docker-compose ps
          traces des d'un contenidor / logs from a container
          docker container logs -f --since 10m
          <container_name|container_id>



          reinici d'un contenidor / restart a container
          docker restart <container_name|container_id>


          connexió amb el contenidor / connect to container
          docker attach <container_name>


          desconnexió del contenidor / disconnect from container
          CTRL+p CTRL+q



          aturada d'un contenidor / stop a container
          docker stop <container_name|container_id>
          • docker-compose down

          supressió d'un contenidor / remove a container
          docker rm <container_name|container_id>


          xarxa xarxa / network list docker network ls




          detalls / details

          inspect bridge|<network_name>




          create
          create <network_name>



        • Problemes / Problems
          • (when docker build) DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
                        Install the buildx component to build images with BuildKit:
                        https://docs.docker.com/go/buildx/
            • Solució / Solution
              • si no troba el plugin docker-buildx farà servir el builder antic, que no és BuildKit, encara que es tingui una versió > 23 de docker
              • install buildx
                • download bin, as plugin:
                  • sudo -i
                  • mkdir -p /usr/local/lib/docker/cli-plugins
                  • cd /usr/local/lib/docker/cli-plugins
                  • wget https://github.com/docker/buildx/releases/download/v0.12.1/buildx-v0.12.1.linux-amd64
                  • chmod +x buildx-v0.12.1.linux-amd64
                  • ln -s buildx-v0.12.1.linux-amd64 docker-buildx
                • Mageia
                  • install it from bin
                • Fedora
                  • ...
                • ...
          • (when docker build) the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled
            • BuildKit
              • temporary solution:
                • DOCKER_BUILDKIT=1 docker build ...
              • permanent solution:
                • /etc/docker/daemon.json
                  • {
                      "features": {
                        "buildkit": true
                      }
                    }
                • sudo systemctl resart docker
          • fatal error: unexpected signal during runtime execution
        • Neteja / Clean-up
          • kill running containers
            • docker kill $(docker ps -aq)
          • delete containers
            • docker rm $(docker ps -aq)
          • delete downloaded images
            • docker rmi $(docker images -q)
          • delete volumes and other resources
            • docker system prune -af --volumes
            • docker system prune
      • ...
    • Problemes / Problems
      • failed to solve: write /var/cache/docker/...: no space left on device
        • ...
      • ERROR: Service 'xxx' failed to build: COPY failed: file not found in build context or excluded by .dockerignore: stat yyyyyy: file does not exist
    • Exemples / Examples
  • Kubernetes
  • ...

Cloud Computing (external virtualisation)


Service model
Recursos oferts /
Offered resources
L'usuari hi instal·la /
User can install
Implementació /
Implementation
Exemples / Examples




Amazon AWS Google other
Software as a Service (SaaS)
Aplicació / Application
-

  • Storage
    • Simple Storage Service (S3)
    • Glacier (backups) (wp)
  • Database
    • RDS (SQL)
    • DynamoDB (NoSQL)
  • Google Apps (wp)
  • Microsoft "Software+Services"
Platform as a Service (PaaS) Sistema Operatiu / Operating system
aplicacions / applications
  • EyeOS

  • Google AppEngine (wp)
  • IBM IT Factory
  • Force.com
Infrastructure as a Service (IaaS) CPU + Emmagatzematge + Xarxa /
CPU + Storage + Network
sistema operatiu / operating system
  • Elastic Compute Cloud (EC2) (Xen)
  • IBM Blue Cloud
  • Sun Grid



OpenStack
AWS

Dashboard Horizon Console
Compute
Compute
Nova
EC2 (Elastic Compute Cloud)


Lambda
A compute service that runs your code in response to events and automatically manages the compute resources for you.
Block storage Cinder ELB (Elastic Block Store)

Image service Glance AMI
Bare metal provisioning Ironic

Storage and content delivery
Object storage
Swift
S3 (Simple Storage Service)



Glacier
A low-cost storage service that provides secure and durable storage for data archiving and backup.


Cloud Front
Provides a way to distribute content to end users with low latency and high data transfer speeds.


Storage Gateway

Database SQL Trove RDS (Relational Database Service)



Elastic Cache



Redshift

NoSQL

DyanamoDB
A scalable NoSQL data store that manages distributed replicas of your data for high availability.
Networking
Networking
Neutron
VPC (Virtual Private Cloud)



Direct Connect

DNS

Route53 A scalable and highly available Domain Name System (DNS) and Domain Name Registration service.
Administration and security
Identity service
Keystone
Directory Service



Trusted Advisor



Config



IAM (Identity and Access Management)
Lets you securely control access to AWS services and resources.


CloudTrail
Provides increased visibility into user activity by recording API calls made on your account.


CloudWatch
Provides monitoring for resources and applications.
Analytics Elastic map reduce Sahara EMR (Elastic Map Reduce)
Lets you perform big data tasks such as web indexing, data mining, and log file analysis.


Kinesis
A managed service that scales elastically for real-time processing of streaming big data.
Orchestration Heat Data Pipeline
A lightweight orchestration service for periodic, data-driven workflows.
Application services Multiple tenant cloud messaging Zaqar SQS (Simple Queue Service)



AppStream



SES (Simple Email Service)



SWF (Simple WorkFlow)
Coordinates all of the processing steps within an application.


Elastic Transcoder
Lets you convert your media files in the cloud easily, at low cost, and at scale.


CloudSearch

Deployment and management

Elastic Beanstalk
An application container for deploying and managing applications.


CloudFormation
Lets you create and update a collection of related AWS resources in a predictable fashion.


CodeDeploy
Lets you fully automate code deployments.


OpsWorks
A DevOps platform for managing applications of any scale or complexity on the AWS cloud.
Mobile services

Cognito
A simple user identity and data synchronization service that helps you securely manage and synchronize app data for your users across their mobile devices.


Mobile Analytics



SNS (Simple Notification Service)
Lets you publish messages to subscribers or other applications.
Enterprise applications

WorkSpaces



WorkDocs



WorkMail


Telemetry
Ceilometer
Billing


OpenStack vs AWS:
OpenStack AWS


Project
Products and services
Dashboard
Horizon


Compute

Nova
EC2 (Elastic Compute Cloud) Compute


EC2 Container Service


AWS Lambda


Auto-scaling


Amazon VPC


Elastic Load Balancing
Bare Metal Provisioning
Ironic

Storage
Object storage
Swift
Amazon S3 Storage and content delivery


Amazon Glacier
Block Storage
Cinder
Amazon EBS
Shared Filesystems
Manila
Amazon EFS


AWS Import/Export


AWS Storage Gateway


Amazon CloudFront
Networking

Neutron
Amazon VPC
Networking


Direct Connect
DNS
Designate
Route53

Neutron/LBaaS
Elastic Load Balancing
Shared services
Identity service Keystone
AWS Identity and Access Management (IAM)
Administration and security


AWS Directory Service


AWS CloudTrail


AWS Config


AWS CloudHSM
Key management
Barbican
AWS Key Management Service
Telemetry service Ceilometer Amazon CloudWatch


AWS Truster Advisor
Image service Glance
AMI

Orchestration service
AWS Elastic Beanstalk
Deployment & Management

AWS OpsWorks
Heat
AWS CloudFormation
Heat/AutoScaling

TripleO (OpenStack on OpenStack)


AWS CodeDeploy
Database service Trove

Amazon RDS
Database
DynamoDB

Aurora (*)

Redshift

ElastiCache

Data processing
Sahara (Hadoop)
Amazon Elastic MapReduce (EMR)
Analytics



Amazon Kinesis



Amazon Redshift



AWS Data Pipeline

Message service
Zaqar
Amazon SQS (Simple Queue Service)
Application Services



Amazon SWF (Simple Workflow Service)



Amazon AppStream



Amazon Elastic Transcoder



Amazon SES (Simple Email Service)



Amazon CloudSearch



Amazon SNS (Simple Notification Service)



Amazon FPS (Flexible Payment Service)



Amazon Cognito
Mobile Services



Amazon Mobile Analytics



Amazon SNS (Simple Notification Service)



Amazon WorkSpaces
Enterprise Applications



Amazon WorkDocs



AWS Support
AWS Support



AWS Trusted Advisor

Marketplace


AWS Marketplace



Alexa Web Information Service
Additional Services

Parcs d'ordinadors / Clusters

Seguretat / Security

Quiosc / Kiosk

  • KDE Kiosk
    • urpmi kiosktool

Execució distribuïda / Distributed execution

Accés remot / Remote access

VPN (Virtual Private Network)


base
name
owner
info
used protocols
implementations
encryption user authentication
packet authentication


compression
server
client




passive attacks (eavesdroppers)

active attack (man-in-the-middle)
replay attacks
plaintext attacks


vpnc (command line)
KVpnc (KDE)
drakvpn (mdv/mga)
Network Manager
(others)
IPSec (kernel)
L2TP over IPsec (Cisco)




HMAC construction





x




FreeSwan















PPTP
Microsoft

  • MPPE
    • 40 bits
    • 128 bits
  • CHAP (MS-CHAP)
  • EAP



  • MPPC (based on LZ)
  • Deflated
  • BSD compression (RFC 1977)


x


TUN/TAP (user-space)
OpenVPN (over OpenSSL/TLS)

  • PKI (X.509 certificates)
  • Clau estàtica / Static key

HMAC construction (wp) sliding window (unique timestamp)




x



VTun










x




Tinc















Cipe















OpenSSH
only valid for one port







x





Distributed software

architecture

protocol
used by / examples
Web Services language message format
implementations IDE




used
descr lang
HTTP methods



pipes, filters









compound documents









RPC: Remote procedure call
operation-oriented CORBA







DCOM Microsoft






DCOP KDE <=3.4






D-BUS (*) xorg, KDE 3.5






Java EE







Java RMI







RPyC (wp) APScheduler







XML-RPC


POST




JasonRPC ?


POST, GET



JSON-RPC 2.0 Shelly






SOAP (Simple Object Access Protocol)
(evolution of XML-RPC)
x
WSDL POST
markup languages
XML
Frameworks
Eclipse WTP
SOA: Service-oriented architecture message-oriented
x






REST: Representational state transfer stateless resources WWW
RESTful (constraints)
WSDL 2.0
GET, POST, DELETE, PUT
Internet media typeJSON, XML, YAML, ...

Enginyeria del programari / Software engineering

http://www.francescpinyol.cat/informatica.html
Primera versió: / First version:
Darrera modificació: 13 d'agost de 2024 / Last update: 13th August 2024

Valid HTML 4.01!

Cap a casa / Back home