Thursday, May 7, 2020

How to install GUI in Ubuntu

Introduction
By default, Ubuntu Server does not include a Graphical User Interface (GUI). A GUI takes up system resources (memory and processor) that are used for server-oriented tasks. However, certain tasks and applications are more manageable and work better in a GUI environment.

Prerequisites

  • A server running Ubuntu Linux Server
  • Access to a user account with sudo or root privileges
  • The apt-get package manager, included by default

$ sudo -s
# sudo apt-get update && sudo apt-get upgrade
# sudo apt-get install tasksel
# tasksel
Select "Ubuntu Desktop" by pressing "space bar" key and press "ENTER".

Conclusion

There are many GUI desktops available for Ubuntu Server. Most can be installed using the apt-get package manager or the tasksel tool, as detailed in this guide.

If you’ve worked extensively with conventional operating systems, it can be challenging to have to work in a command-line interface. Fortunately, Ubuntu – like many Linux systems – is open-source, thus there are many GUIs available.

How to Install KVM in Ubuntu

KVM (Kernel-based Virtual Machine) is an open source full virtualization solution for Linux like systems, KVM provides virtualization functionality using the virtualization extensions like Intel VT or AMD-V.  Whenever we install KVM on any linux box then it turns it into the hyervisor by loading the kernel modules like kvm-intel.ko( for intel based machines) and kvm-amd.ko ( for amd based machines).

KVM allows us to install and run multiple virtual machines (Windows & Linux). We can create and manage KVM based virtual machines either via virt-manager graphical user interface or virt-install & virsh cli commands.

In this article we will discuss how to install and configure KVM hypervisor on Ubuntu server.

Login to your server and perform the following steps:-

Step 1:- Pre-installation checklist

Check that your CPU supports hardware virtualization

To run KVM, you need a processor that supports hardware virtualization. Intel and AMD both have developed extensions for their processors, deemed respectively Intel VT-x (code name Vanderpool) and AMD-V (code name Pacifica). To see if your processor supports one of these, you can review the output from this command:

egrep -c '(vmx|svm)' /proc/cpuinfo

If 0 it means that your CPU doesn't support hardware virtualization.

If 1 or more it does - but you still need to make sure that virtualization is enabled in the BIOS.

By default, if you booted into XEN kernel it will not display svm or vmx flag using the grep command. To see if it is enabled or not from xen, enter:

cat /sys/hypervisor/properties/capabilities

You must see hvm flags in the output.

Alternatively, you may execute:

kvm-ok 

which may provide an output like this:

INFO: /dev/kvm exists
KVM acceleration can be used

If you see :

INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used

You can still run virtual machines, but it'll be much slower without the KVM extensions.

NOTE: You may see a message like "KVM acceleration can/can NOT be used". This is misleading and only means if KVM is *currently* available (i.e. "turned on"), *not* if it is supported.

Use a 64 bit kernel (if possible)

Running a 64 bit kernel on the host operating system is recommended but not required.

  1. To serve more than 2GB of RAM for your VMs, you must use a 64-bit kernel (see 32bit_and_64bit). On a 32-bit kernel install, you'll be limited to 2GB RAM at maximum for a given VM.

  2. Also, a 64-bit system can host both 32-bit and 64-bit guests. A 32-bit system can only host 32-bit guests.

To see if your processor is 64-bit, you can run this command:

egrep -c ' lm ' /proc/cpuinfo

If 0 is printed, it means that your CPU is not 64-bit.

If 1 or higher, it is. Note: lm stands for Long Mode which equates to a 64-bit CPU.

Now see if your running kernel is 64-bit, just issue the following command:

uname -m

x86_64 indicates a running 64-bit kernel. If you use see i386, i486, i586 or i686, you're running a 32-bit kernel.

Note: x86_64 is synonymous with amd64.



Step 2:- Installation of KVM

Paste the following commands in PuTTY or similar SSH application:-

$ sudo su
$ apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
# adduser 'id -un' libvirtd
# apt-get install virt-manager
# virt-manager


Tuesday, May 5, 2020

How to Install Windows on Ubuntu?

Linux-to-Windows-with-QEMU


For detailed reading visit www.kwikserver.com
A Shell Script to Auto install Windows Server on your Linux System. [Right now, it supports 2012 R2 < evaluation/180 days trial > copy]
Script would use QEMU-KVM portable software for Virtualization purpose. Since QEMU is a portable s/w, so it can reside in temporary RAM.
Actually script is semi-automatic. All Linux commands part(such as downloading Windows ISO image, gathering system info, choosing disk/partition, managing RAM , attaching required windows s/w in CDROM) would be handled by script automatically.
And rest of the windows part(clicking, selecting, setting Administrator password ) need to be done manually by any Free VNC windows software.
After Windows Installation completed, you would find a Power Shell script under CD-ROM, called "EnableRDP.ps1". By running it you would be able to enable Remote Desktop on your Windows server, so after that you would be able to connect your Windows server through Windows "Remote Desktop Application" App :)
I also attached Firefox App on CD-ROM, install that, so you don't need to face "Internet Explorer" horrible setting experience!

Requirements

A VNC software such as RealVNC : https://www.realvnc.com/en/connect/download/viewer/
A VPS or Dedicated server with Ubuntu OS Installed.
At least 30GB Free disk space in your system.
Virtualization of your VPS or Server must be enabled. Run below coammnd :
echo $(egrep '^flags.*(vmx|svm)' /proc/cpuinfo | wc -l)
if output is greater than 0, then Virtualization is enabled :D
Either should have access of root user OR run with su (super user)

Optional

If you want to use your own Windows ISO copy.
Then download official copy from https://www.microsoft.com/en-in/evalcenter/evaluate-windows-server-2012-r2 and upload it to your extra server & create a direct url and then replace LINE NO. 39 & 41 of mediabots_Ubuntu-to-Windows.sh with your DIRECT LINK
Script Line No. 39 :-
sudo wget -P /mediabots http://51.15.226.83/WS2012R2.ISO
Script Line No. 41 :-

How to Run the Script

Just run below five commands one after another :
sudo -s
mkdir /media/script && mount -t tmpfs -o size=1m tmpfs /media/script
wget -P /media/script https://raw.githubusercontent.com/mediabots/Linux-to-Windows-with-QEMU/master/mediabots_Linux-to-Windows.sh
chmod +x /media/script/*
/media/script/mediabots_Linux-to-Windows.sh


How to install XRDP on Ubuntu?

Introduction

xrdp is a Remote Desktop Protocol (RDP) Server, allowing RDP clients to be presented an X windows desktop to the user.

Installation

Simple setup with no user logged into console

This is a simple setup without using TLS and certificates. Also, it requires that no person is logged into the console when attempting to connect.
With Ubuntu 18.04 first install xrdp:
sudo apt-get -y install xrdp
Next, one may adjust the configuration file:
sudo nano /etc/xrdp/xrdp.ini
Set encryption level to high:
encrypt_level=high
Next, allow just RDP through the local firewall:
sudo ufw allow 3389/tcp
Next, create a polkit configuration file:
sudo nano /etc/polkit-1/localauthority.conf.d/02-allow-colord.conf
and input inside it:
polkit.addRule(function(action, subject) {
if ((action.id == “org.freedesktop.color-manager.create-device” || action.id == “org.freedesktop.color-manager.create-profile” || action.id == “org.freedesktop.color-manager.delete-device” || action.id == “org.freedesktop.color-manager.delete-profile” || action.id == “org.freedesktop.color-manager.modify-device” || action.id == “org.freedesktop.color-manager.modify-profile”) && subject.isInGroup(“{group}”))
{
return polkit.Result.YES;
}
});
Finally, restart xrdp and you should be able to connect:


sudo /etc/init.d/xrdp restart

How to install VNC on Ubuntu

Access your server using a free simple SSH client program called Putty located at:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Follow these commands:

$ sudo apt update
$ sudo apt install xfce4 xfce4-goodies
$ sudo apt install tightvncserver
$ vncserver
$ vncserver -kill :1
$ mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
$ nano ~/.vnc/xstartup
(paste the following in the xstartup file and write out)

#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
(Ctrl+O+Enter button to save)
(Ctrl+X button to Exit)

$ sudo chmod +x ~/.vnc/xstartup
$ vncserver
$ sudo nano /etc/systemd/system/vncserver@.service
(paste the following in the window and write out)

[Unit]
Description=Start TightVNC server at startup
After=syslog.target network.target

[Service]
Type=forking
User=yourname
Group=yourname
WorkingDirectory=/home/yourname

PIDFile=/home/yourname/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=multi-user.target

(Ctrl+O+Enter button to save)
(Ctrl+X button to Exit)

$ sudo systemctl daemon-reload
$ sudo systemctl enable vncserver@1.service
$ vncserver -kill :1
$ sudo systemctl start vncserver@1
$ sudo systemctl status vncserver@1

Joyful June Offer

Because time is the new currency and peace of mind is precious.