How to set the ulimit values unlimited in linux

You can put limits on certain resources to help ensure that the most important processes on your servers can keep running and competing processes but you need to anticipate where limits will make sense and where they will cause problems. Some heavy applications like SAP could fail because of the ulimit limits.

For example, sometimes applications get an error about too many files open. Increase the number of open files limit in Linux, you can change the maximum amount of open files. You may modify this number by using the ulimit command.

ulimit command for unlimited

ulimit command for unlimited

 

There are two kinds of limits:

soft limits are simply the currently enforced limits
hard limits mark the maximum value which cannot be exceeded by setting a soft limit

Each operating system has a different hard limit setup in a configuration file /etc/security/limits.conf. These limitations include how many files a process can have open, how large of a file the user can create, and how much memory can be used by the different components of the process such as the stack, data and text segments. To see the limits associated with your login, use the command ulimit -a.

ulimit values in Linux

Use below command to see the current user ulimit values in your machine.

[[email protected] keys]$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 7279
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 4096
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

Set the ulimit values unlimited

Linux

CPU time (seconds): ulimit -t unlimited
File size (blocks): ulimit -f unlimited
Maximum memory size (kbytes): ulimit -m unlimited
Maximum user processes: ulimit -u unlimited
Open files: ulimit -n 8192 (minimum value)
Stack size (kbytes): ulimit -s unlimited
Virtual memory (kbytes): ulimit -v unlimited

IBM AIX

CPU time (seconds): ulimit -t unlimited
File size (blocks): ulimit -f unlimited
Maximum memory size (kbytes): ulimit -m unlimited
Maximum user processes: ulimit -u unlimited
Open files: ulimit -n 8192 (minimum value)
Stack size (kbytes): ulimit -s 8192 (minimum value)
Virtual memory (kbytes): ulimit -v unlimited

Sun Solaris

CPU time (seconds): ulimit -t unlimited
File size (blocks): ulimit -f unlimited
Maximum user processes: ulimit -u unlimited
Memory (kbytes): ulimit -m unlimited
Open files: ulimit -n 8192 (minimum value)
Stack size (kbytes): ulimit -s 8192 (minimum value)
Virtual memory (kbytes): ulimit -v unlimited

HP-UX

CPU time (seconds): ulimit -t unlimited
File size (blocks): ulimit -f unlimited
Memory (kbytes): ulimit -m unlimited
Nofiles (descriptors): ulimit -n 8192 (minimum value)
Stack size (kbytes): ulimit -s 8192 (minimum value)

ulimit options and usages

-a     All current limits are reported
-c     The maximum size of core files created
-d     The maximum size of a process's data segment
-e     The maximum scheduling priority ("nice")
-f     The  maximum  size  of files written by the shell and its
       children
-i     The maximum number of pending signals
-l     The maximum size that may be locked into memory
-m     The maximum resident set size (has no effect on Linux)
-n     The maximum number of open file descriptors (most systems
       do not allow this value to be set)
-p     The pipe size in 512-byte blocks (this may not be set)
-q     The maximum number of bytes in POSIX message queues
-r     The maximum real-time scheduling priority
-s     The maximum stack size
-t     The maximum amount of cpu time in seconds
-u     The  maximum  number  of  processes available to a single
       user
-v     The maximum amount of virtual  memory  available  to  the
       shell

 

 

 

How to Install Ubuntu Desktop GUI on Server

Ubuntu Desktop includes a graphical user interface. In this article, you’ll learn all about the Ubuntu Desktop installation and connect using a remote desktop client. Ubuntu has several desktop environments available in its repositories.

Install Ubuntu Desktop

Install Ubuntu Desktop

The following commands used to install Ubuntu Desktop on Server.

Unity (The Default Desktop)
sudo apt-get install ubuntu-desktop

KDE
sudo apt-get install kubuntu-desktop

LXDE (Lubuntu)
sudo apt-get install lubuntu-desktop

MATE
sudo apt-get install mate-desktop

Gnome
sudo apt-get install ubuntu-gnome-desktop

XFCE (Xubuntu)
sudo apt-get install xubuntu-desktop

Please make sure you have the desktop repositories installed. For example, you need to add gnome repositories.

[email protected]:~$ sudo add-apt-repository ppa:gnome3-team/gnome3-staging
[email protected]:~$ sudo add-apt-repository ppa:gnome3-team/gnome3

And then install it:

[email protected]:~$ sudo apt-get update && sudo apt install gnome gnome-shell
[email protected]:~$ sudo apt install ubuntu-gnome-desktop

Checking availability from default sources

[email protected]:~$ sudo apt-cache policy ubuntu-gnome-desktop
ubuntu-gnome-desktop:
Installed: 0.58.3
Candidate: 0.58.3
Version table:
*** 0.58.3 500
500 http://phx-ad-3.clouds.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
100 /var/lib/dpkg/status
0.58 500
500 http://phx-ad-3.clouds.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages

Install XRDP Package from Ubuntu Repository

xrdp Server is an open-source remote desktop protocol server which uses RDP to present a GUI to the client. It provides a fully functional Linux terminal server, capable of accepting connections from rdesktop, freerdp, and Microsoft’s own terminal server / remote desktop clients.

Install and Enable Xrdp

Login your ubuntu server.

[email protected]:~$ sudo apt install xrdp
xrdp Installation

XRDP Install

You will be then informed about the package size. To proceed with the installation, press Y

Once the installation is done, enable it.

[email protected]:~$ sudo systemctl enable xrdp

When done, you need to install an alternate desktop environment. In our scenario, we are using xfce4

Install xfce4 Desktop environment

[email protected]:~$ sudo apt-get install xfce4

You will be then informed about the package size. To proceed with the installation, press Y

 

Configure xrdp to use xfce desktop environment

you have to configure your Ubuntu server for xrdp to know that the xfce desktop will be used instead of the Unity or Gnome.
To configure this, from the terminal console, you will issue the following command

[email protected]:~$ echo xfce4-session >~/.xsession

Restart the xrdp service by issuing the following command

[email protected]:~$ sudo service xrdp restart

Firewall

You should check the xrdp port 3389 is enabled in firewall. To see current firewall settings use sudo ufw status verbose, or iptables -L.

sudo ufw disable # To disable the firewall
sudo ufw enable # To enable the firewall

Test your Ubuntu Desktop connections using windows remote desktop.

 

 

VMware VM created and deleted list by users using PowerCLI

How to check quickly in VMware vCenter about users who have created or deleted the VMs?

The below PowerCLI script can be fetched using the TaskEvent which has the description VmBeingDeployedEvent or VmBeingClonedEvent and VmRemovedEvent in VMware vCenter 6.

VMware PowerCLI

VMware PowerCLI ConnectConnect your vCenter

> Connect-VIServer vcenter.cloudkb.com

Name Port User 
---- ---- ---- 
vcenter.cloudkb.com 443 VSPHERE.LOCAL\Administrator

 

You can list the virtual machine details which user has removed or deleted and Created, check the vCenter Server Events Logs using PowerCLI command to list all the details.

Use the following powerCLI command to list VM created list.

Get-VIEvent -MaxSamples ([int]::MaxValue) -Start (Get-Date).AddDays(-30) | where {$_.Gettype().Name -eq “VmCreatedEvent” -or $_.Gettype().Name -eq “VmBeingClonedEvent” -or $_.Gettype().Name -eq “VmBeingDeployedEvent”} | %{“{0} created by {1}” -f $_.VM.Name,$_.UserName}

Use the following PowerCLI command to list last 7 days VM deleted Event logs with a username.

Get-VIEvent -MaxSamples ([int]::MaxValue) -Start (Get-Date).AddDays(-7) | where {$_.Gettype().Name -eq “VmRemovedEvent”} | %{“{0} created by {1}” -f $_.VM.Name,$_.UserName}

How to get a list Virtual Machine Snapshots in VMware

This is additional information to get a list of all VM Snapshots for VMs managed by vCenter you can type the following command using PowerCLI.

get-vm | get-snapshot | format-list

The command above will give you the following properties:

Description
Created
Quiesced
PowerState
VM
VMId
Parent
ParentSnapshotId
ParentSnapshot
Children
SizeMB
IsCurrent
IsReplaySupported
ExtensionData
Id
Name
Uid

If you want the VM list with the name of the snapshot, you could simply add these properties after “format-list” as shown below.

get-vm | get-snapshot | format-list vm,name