Search This Blog

Showing posts with label nx. Show all posts
Showing posts with label nx. Show all posts

Install nomachine on remote headless virtual machine

  • Install desktop system on the virtual machine
    sudo apt install ubuntu-desktop
  • Install nomachine for linux
  • The system display manager should be stop and disabled, otherwise, the remote desktop screen will be limited low resolution. Use the script below to do so:
    dm=$(basename "$(cat /etc/X11/default-display-manager)")
    sudo systemctl stop $dm
    sudo systemctl disable $dm
    sudo systemctl restart nxserver

Setup Centos Linux VM and enable Nomachine remote desktop

  1. Setup ssh access to the Linux VM:
    ssh ec2-user@centos_vm_2020
  2. Create user account:
    sudo dnf install zsh
    sudo useradd -s /bin/zsh wxyz
    sudo usermod -a -G adm wxyz
    sudo usermod -a -G wheel wxyz
    
  3. Enable ssh public key authentication (add public key to ~/.ssh/authorized.keys):
    sudo su wxyz
    mkdir ~/.ssh
    vim ~/.ssh/authorized_keys
    chmod 700 ~/.ssh/authorized_keys
    
  4. Install GUI desktop:
    sudo dnf groupinstall Workstation
    
  5. Install nomachine:
    cd /tmp
    wget https://download.nomachine.com/download/6.9/Linux/nomachine_6.9.2_1_x86_64.rpm
    sudo rpm -i /tmp/nomachine_6.9.2_1_x86_64.rpm
    
  6. Reboot the VM:
    sudo systemctl set-default multi-user.target
    sudo systemctl isolate multi-user.target
    sudo reboot
    
  7. Install gnome-tweaks:
    sudo dnf install gnome-tweaks
    
    and tweak the desktop environment on CentOS 8.
  8. Enable Nomachine public key authentication (add public key to ~/.NX/config/authorized.crt):
    mkdir -p ~/.NX/config
    touch ~/.NX/config/authorized.crt
    chmod 700 ~/.NX/config/authorized.crt
    

Remote desktop to Ubuntu Linux via x2go


I. Install X2Go server on the remote Ubuntu Linux host

  1. Add the X2Go repository:
    sudo add-apt-repository ppa:x2go/stable
    and confirm this with [Enter]. Then, update the package lists:
    sudo apt-get update
  2. Install the X2Go server:
    sudo apt-get install x2goserver x2goserver-xsession
  3. Install extra bindings depend on what window manager you use:
    • for LXDE:
      sudo aptitude install --reinstall lxde lxsession-logout x2golxdebindings
    • for GNOME:
      sudo apt-get install x2gognomebindings
      GNOME only works for versions earlier than gnome 3.10, better earlier than gnome 3.08
    • for KDE:
      sudo apt-get install plasma-widget-x2go
  4. Test if the service is up and running:
    sudo service --status-all | grep x2go
    If not, try starting it manually:
    sudo service x2goserver start

II. Install X2Go Client on the local computer

  • Windows: Download and install the newest windows client from the X2Go website
  • Linux:
    sudo apt-get install x2goclient
  • Mac OS:

III. Connect to remote Linux host using X2Go client

  • For Mac OS, starts XQuartz first then X2Go client. You need to set the prefences of XQuartz to allow connections:






See also

NoMachine: Setup public key authentication

  • Server side:
    • Edit ~/.nx/config/authorized.crt and append public key to it.
      mkdir -p ~/.nx/config
      vi ~/.nx/config/authorized.crt
      


see also

Install Nomachine NX Server Free Edition on Debian Linux

The Nomachine nxserver free edition has limitation: allows only 2 concurrent user sessions. But it is fine for me to connect to my Linux workstation at work. It is easier to setup than the freenx server. See the guide below:
  1. Run the following commands to download and install nomachine nxclient, nxnode and nxserver packages:
    if [[ $(uname -m)=="x86_64" ]]; then export MARC=amd64; else export MARC=i386; fi
    wget http://web04.nomachine.com/download/3.5.0/Linux/nxclient_3.5.0-7_${MARC}.deb
    sudo dpkg -i nxclient_3.5.0-7_${MARC}.deb
    wget http://web04.nomachine.com/download/3.5.0/Linux/nxnode_3.5.0-9_${MARC}.deb
    sudo dpkg -i nxnode_3.5.0-9_${MARC}.deb
    wget http://web04.nomachine.com/download/3.5.0/Linux/FE/nxserver_3.5.0-11_${MARC}.deb
    sudo dpkg -i nxserver_3.5.0-11_${MARC}.deb
    
  2. Setup your own server private key instead of the nomachine key:
    sudo ssh-keygen -t dsa -f /usr/NX/home/nx/.ssh/id_dsa
    sudo chown nx:nx /usr/NX/home/nx/.ssh/id_dsa
    sudo mv /usr/NX/home/nx/.ssh/authorized_keys2 /usr/NX/home/nx/.ssh/authorized_keys2.old
    sudo cat /usr/NX/home/nx/.ssh/id_dsa.pub >> /usr/NX/home/nx/.ssh/authorized_keys2
    
    You can now use the private key in /usr/NX/home/nx/.ssh/id_dsa for your client to connect to the nxserver.
  3. Secure ssh for NX server by editting /etc/ssh/sshd_config as root:
    • Enable PubkeyAuthentication for all:
      PubkeyAuthentication yes
    • Disable PasswordAuthentication for all:
      PasswordAuthentication no
    • Allows PasswordAuthentication only for the FreeNX users by appending the following line to sshd_config:
      Match Group nxusers 
          PasswordAuthentication yes
      or if you want to allow individual users:
      Match User john alex
          PasswordAuthentication yes