User Tools

Site Tools


neuroimagen:virtual

Maquina virtual Windows para ejecutar MATLAB

Instalacion en brick03

Ningun virtualbox o vmware. Voy a montar el kvm hypervisor de redhat que es lo que va a ir sin problemas en centos 7.

Tengo que instalar VNC server (para instalacion grafica de win),

[root@brick03 ~]# yum install tigervnc-server
...... OK!
[root@brick03 ~]# yum install fluxbox
...... OK!

instalar qemu y libvirtd,

[root@brick03 ~]# grep -E '(vmx|svm)' /proc/cpuinfo
..... OK!
[root@brick03 ~]# yum install qemu-kvm qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer bridge-utils
...... OK!

Configurar la tarjeta de red en NAT,

[root@brick03 ~]# brctl show
bridge name	bridge id		STP enabled	interfaces
virbr0		8000.5254004132a2	yes		virbr0-nic

[root@brick03 ~]# virsh net-update default add ip-dhcp-host "<host mac='52:54:00:c9:aa:55' name='Windows' ip='192.168.122.21' />" --live --config

[root@brick03 ~]# cat /etc/libvirt/hooks/qemu
#!/bin/bash

# IMPORTANT: Change the "VM NAME" string to match your actual VM Name.
# In order to create rules to other VMs, just duplicate the below block and configure
# it accordingly.
if [ "${1}" = "Windows" ]; then

   # Update the following variables to fit your setup
   GUEST_IP=192.168.122.21
   GUEST_PORT=3389
   HOST_PORT=3389

   if [ "${2}" = "stopped" ] || [ "${2}" = "reconnect" ]; then
	/sbin/iptables -D FORWARD -o virbr0 -d  $GUEST_IP -j ACCEPT
	/sbin/iptables -t nat -D PREROUTING -p tcp --dport $HOST_PORT -j DNAT --to $GUEST_IP:$GUEST_PORT
   fi
   if [ "${2}" = "start" ] || [ "${2}" = "reconnect" ]; then
	/sbin/iptables -I FORWARD -o virbr0 -d  $GUEST_IP -j ACCEPT
	/sbin/iptables -t nat -I PREROUTING -p tcp --dport $HOST_PORT -j DNAT --to $GUEST_IP:$GUEST_PORT
   fi
fi

[root@brick03 ~]# service libvirtd restart

[root@brick03 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:bootps

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             192.168.122.21      
ACCEPT     all  --  anywhere             192.168.122.0/24     ctstate RELATED,ESTABLISHED
ACCEPT     all  --  192.168.122.0/24     anywhere            
ACCEPT     all  --  anywhere             anywhere            
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootpc

quitar procesadores de slurm,

[root@detritus ~]# vim /etc/slurm/slurm.conf
....
NodeName=brick03 CPUs=40 State=UNKNOWN NodeAddr=172.26.2.43 Weight=1
....

reiniciar el cluster,

[root@detritus ~]# service slurm stop
stopping slurmctld:                                        [  OK  ]
slurmctld is stopped
stopping slurmd:                                           [  OK  ]
slurmd is stopped
[root@detritus ~]# for x in $(seq 3);do ssh brick0${x} systemctl stop slurmd.service; done
[root@detritus ~]# for x in $(seq 3);do scp /etc/slurm/slurm.conf brick0${x}:/etc/slurm/slurm.conf; done
slurm.conf                                                    100% 1615     1.6KB/s   00:00    
slurm.conf                                                    100% 1615     1.6KB/s   00:00    
slurm.conf                                                    100% 1615     1.6KB/s   00:00    
[root@detritus ~]# for x in $(seq 3);do ssh brick0${x} systemctl start slurmd.service; done
[root@detritus ~]# service slurm start
starting slurmctld:                                        [  OK  ]
starting slurmd:                                           [  OK  ]
[root@detritus ~]# sinfo
PARTITION AVAIL  TIMELIMIT  NODES  STATE NODELIST
devel*       up   infinite      4   idle brick[01-03],detritus
cuda         up   infinite      2   idle brick01,detritus

VNC

En brick03, preparar el vnc,

# cp /lib/systemd/system/vncserver\@.service  /etc/systemd/system/vncserver@:1.service
# vim /etc/systemd/system/vncserver@:1.service
........
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l osotolongo -c "/usr/bin/vncserver %i"
PIDFile=/home/osotolongo/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

Ejecutar el VNC server, FIXME

[root@brick03 ~]# systemctl daemon-reload
[root@brick03 ~]# systemctl enable vncserver@:1.service        
Created symlink from /etc/systemd/system/multi-user.target.wants/vncserver@:1.service to /usr/lib/systemd/system/vncserver@.service.
[root@brick03 ~]# systemctl start vncserver@:1.service 
[root@brick03 ~]# netstat -natup | grep vnc           
tcp        0      0 0.0.0.0:5901            0.0.0.0:*               LISTEN      154795/Xvnc         
tcp        0      0 0.0.0.0:6001            0.0.0.0:*               LISTEN      154795/Xvnc         
tcp6       0      0 :::5901                 :::*                    LISTEN      154795/Xvnc         
tcp6       0      0 :::6001                 :::*                    LISTEN      154795/Xvnc   

En localhost, establecer un tunel por ssh

osotolongo@daisy:~> ssh -p 20024 -v -C -L 5901:localhost:5901 matlab.fundacioace.org
OpenSSH_7.9p1, OpenSSL 1.1.0i-fips  14 Aug 2018
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 25: Applying options for *
debug1: Connecting to matlab.fundacioace.org [62.36.3.162] port 20024.
debug1: Connection established.
debug1: identity file /home/osotolongo/.ssh/id_rsa type 0
debug1: identity file /home/osotolongo/.ssh/id_rsa-cert type -1
debug1: identity file /home/osotolongo/.ssh/id_dsa type -1
debug1: identity file /home/osotolongo/.ssh/id_dsa-cert type -1
debug1: identity file /home/osotolongo/.ssh/id_ecdsa type -1
debug1: identity file /home/osotolongo/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/osotolongo/.ssh/id_ed25519 type -1
debug1: identity file /home/osotolongo/.ssh/id_ed25519-cert type -1
debug1: identity file /home/osotolongo/.ssh/id_xmss type -1
debug1: identity file /home/osotolongo/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to matlab.fundacioace.org:20024 as 'osotolongo'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: zlib@openssh.com
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: zlib@openssh.com
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:0itqxv8vcQwGmofPXP6eulawngT/hSBAD4CFyXxQZhk
debug1: Host '[matlab.fundacioace.org]:20024' is known and matches the ECDSA host key.
debug1: Found key in /home/osotolongo/.ssh/known_hosts:6
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /home/osotolongo/.ssh/id_rsa RSA SHA256:U3Viy0xxpMXJDdKXhQdpRm9Vq5ZVdxHrjTpeBFVHrzE
debug1: Will attempt key: /home/osotolongo/.ssh/id_dsa 
debug1: Will attempt key: /home/osotolongo/.ssh/id_ecdsa 
debug1: Will attempt key: /home/osotolongo/.ssh/id_ed25519 
debug1: Will attempt key: /home/osotolongo/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/osotolongo/.ssh/id_rsa RSA SHA256:U3Viy0xxpMXJDdKXhQdpRm9Vq5ZVdxHrjTpeBFVHrzE
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/osotolongo/.ssh/id_dsa
debug1: Trying private key: /home/osotolongo/.ssh/id_ecdsa
debug1: Trying private key: /home/osotolongo/.ssh/id_ed25519
debug1: Trying private key: /home/osotolongo/.ssh/id_xmss
debug1: Next authentication method: password
osotolongo@matlab.fundacioace.org's password: 
debug1: Enabling compression at level 6.
debug1: Authentication succeeded (password).
Authenticated to matlab.fundacioace.org ([62.36.3.162]:20024).
debug1: Local connections to LOCALHOST:5901 forwarded to remote address localhost:5901
debug1: Local forwarding listening on ::1 port 5901.
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 5901.
debug1: channel 1: new [port listener]
debug1: channel 2: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Last login: Mon Feb 25 22:56:08 2019 from 92.red-83-38-106.dynamicip.rima-tde.net
-------- freesurfer-Linux-centos6_x86_64-dev-20160813-5b25567 --------
Setting up environment for FreeSurfer/FS-FAST (and FSL)
FREESURFER_HOME   /usr/local/freesurfer
FSFAST_HOME       /usr/local/freesurfer/fsfast
FSF_OUTPUT_FORMAT nii.gz
SUBJECTS_DIR      /usr/local/freesurfer/subjects
MNI_DIR           /usr/local/freesurfer/mni
FSL_DIR           /usr/local/fsl
[osotolongo@brick03 ~]$

Ahora lanzar el cliente vnc, pero enlazando a localhost,

contraseña, lanzamos un xterm, hacemos su y arrancamos el virt-manager.

guindous

Crear una maquina virtual, asignando la memoria, las CPU, el tamaño de disco, etc. La red debe ser el default. Windows se instala bastante bien. Configurar la red con DHCP. Activar Windows OK.

Hala, windoze en todo su esplendor,

A partir de aqui, estoy perdido. Instalo teamviewer y lo dejamos en manos de Lisot que son los que saben de esto

neuroimagen/virtual.txt · Last modified: 2020/08/04 10:58 by 127.0.0.1