Objective

Deployment of XenServer virtual machine using command line.

Requirements

Privileged access to XenServer's command line as well as configured ISO image storage containing an ISO image of the Linux distribution you wish to install.

Difficulty

MODERATE

Instructions

Deploy VM template and gather information

In this guide we will be creating a new Ubuntu Linux based virtual machine. However, the below procedure will fit any decent Linux distribution as along as it is supported by XenServer, meaning that the template for the Linux distribution you would like to install is part of the XenServer's repertoire. Let's first search XenServer's database for a template name.

In this case we are looking for Ubuntu 16.04:
# xe template-list | grep name-label | grep -i 16.04
          name-label ( RW): Ubuntu Xenial Xerus 16.04

Objective

The Virtual Machine creation using template provisioner may spawn unnamed VDI disks. Usually, the VID description states Created by template provisioner at most. Example:
uuid ( RO)                : 093e128a-2632-43bd-bb45-8f864bc69d6f
          name-label ( RW): 0
    name-description ( RW): Created by template provisioner
             sr-uuid ( RO): 3ef7b35b-5d39-7414-0c91-bbb281b9a521
        virtual-size ( RO): 21474836480
            sharable ( RO): false
           read-only ( RO): false
The objective is to set a proper name and description to VDI disk.

Installing WINE

Since there are multiple available versions of WINE, there are different ways to install it as well. Of course, each distribution also packages and ships WINE differently, and most only ship one or two versions of it. Thankfully, there are third party repositories available, and, when all else fails, WINE can be compiled from source. Unless you’re running Gentoo, source should probably be the last resort, since it’s obviously harder to maintain, but it can work in cases where you want a custom WINE build that isn’t packaged for your distro.

Introduction

The ability to monitor the temperatures of key components is important, whether you’re gaming, overclocking, or doing something more businesslike and running a critical server. Linux includes modules in the kernel that allow it to access onboard sensors within components. Though, that alone is not enough.

There is a program that does work in conjunction with those modules to display the readings of those sensors in the userspace. That program is lm_sensors. Lm_sensors allows users to get a readout of sensor readings in the command line and interfaces with several graphical front ends that make displaying temperatures in real time automatic and easy.

Installation

Lm_sensors is in nearly every distro’s repositories. In most cases, installation is as simple as a single command. Since it lm_sensors is a daemon, it will need to be started in all distributions, but the Debian based ones, which start it automatically.

Ubuntu

$ sudo apt-get install lm-sensors

Debian

# apt-get install lm-sensors

Objective

Here we assume that you have already created VM's device to link to desired ISO image you wish to boot from. The objective is to instruct XenServer's host virtual machine to boot from ISO CD/DVD image instead of default VDI disk. Failure to do so may result in following error message:
The bootloader returned an error
msg: Unable to find partition containing kernel

Objective

Suppose that we have included a new item to our Xenserver's storage repository such as the newly downloaded ISO images. XenServer would not list this item immediately and thus this requires a manual action to include this new item into XenServer's storage repository list. The objective is to rescan XenServer's storage repository thus make all new items available for use.

Requirements

Administrative Local or Remote command line access to XenServer is required to complete this task.

Objective

Iptables rules are by default not persistent after reboot. The objective is to make iptables rules persistent after reboot.

Requirements

Privileged remote or physical access to your Ubuntu or Debian Linux system is required to complete this task.

Difficulty

EASY

Instructions

iptables-persistent installation

In order to make your iptables rules persistent after reboot install iptables-persistent package using apt-get tool:
# apt-get install iptables-persistent

Introduction

One of the main concerns for people making the switch to Linux is how to run the programs that they’ve become accustomed to on other operating systems, mainly Windows. For most, there are one or two programs of games that aren’t available on Linux, and that puts a major hold on adopting Linux full time. Thankfully, WINE can help to solve this problem. introduction to wine on linux

WINE is a piece of software for Unix-like systems, including Linux, OSX, and the BSDs, that allows you to run native Windows applications. WINE stands for, WINE Is Not an Emulator. That’s because it isn’t. WINE isn’t a full Windows install or some kind of VM. It is a compatibility layer that essentially translates Windows binaries. This extends to graphics libraries like DirectX 9, which is converted to OpenGL. WINE allows Linux users to run many popular Windows applications and games at similar performance to if they were running on Windows itself.

Objective

Our objective is to check a disk space usage of one or more local XenServer repositories using Linux shell command line.

Requirements

Remote SSH access to XenServer is required to complete this task.

Difficulty

EASY

Instructions

SSH Login Login

First step is to gain a privileged access to you XenServer using SSH:
$ ssh root@XENSERVER

View cache

A configured domain name service ( DNS ) server such as Bind may store previously resolved domain names to a local cache. By default the cached records will be stored for 7 days. The cache can be reused for future domain name resolutions. First, let's see how we can view all cached domain name resolutions:
# rndc dumpdb -cache
The above command will dump bind's cache into /var/cache/bind/named_dump.db. In case you cannot locate this file after you have executed the above command then check your server's configuration files to reveal the location of cache dump file. To view cached dns records simply cat or grep the resulting dump file. For example:
# grep gnu.org /var/named/data/cache_dump.db
gnu.org.                86358   NS      ns1.gnu.org.
                        86358   NS      ns2.gnu.org.
                        86358   NS      ns3.gnu.org.
ns1.gnu.org.            86358   A       208.118.235.164
ns2.gnu.org.            86358   A       87.98.253.102
ns3.gnu.org.            86358   A       46.43.37.70

Let's assume that that you are playing with iptables and wish to remove rules which are no longer valid, required or incorrect. One way of accomplishing this task would be to save all rules using iptables-save command, open the output file, remove all rules and use iptables-restore to apply new rules. Another and perhaps easier way is to list all available rules along with rule line numbers. For example:
# iptables -L --line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination         
1    DROP       all  --  anywhere             10.0.0.0/8          
2    DOCKER     all  --  anywhere             anywhere            
3    ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
4    ACCEPT     all  --  anywhere             anywhere            
5    ACCEPT     all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         

Chain DOCKER (1 references)
num  target     prot opt source               destination         
1    ACCEPT     tcp  --  anywhere             172.17.0.3           tcp dpt:https
2    ACCEPT     tcp  --  anywhere             172.17.0.4           tcp dpt:http
3    ACCEPT     tcp  --  anywhere             172.17.0.5           tcp dpt:4000
4    ACCEPT     tcp  --  anywhere             172.17.0.7           tcp dpt:mysql
5    ACCEPT     tcp  --  anywhere             172.17.0.7           tcp dpt:http
6    ACCEPT     tcp  --  anywhere             172.17.0.6           tcp dpt:3142

The Linux Cron time-based scheduler by default does not execute jobs with shorter intervals than 1 minute. This config will show you a simple trick how to use Cron time-based scheduler to execute jobs using seconds interval. Let's start with basics. The following cron job will be executed every minute:
* * * * * date >> /tmp/cron_test
The above job will be executed every minute and insert a current time into a file /tmp/cron_test. Now, that is easy! But what if we want to execute the same job every 30 seconds? To do that, we use cron to schedule two exactly same jobs but we postpone the execution of the second jobs using sleep command for 30 seconds. For example:
* * * * * date >> /tmp/cron_test
* * * * * sleep 30; date >> /tmp/cron_test

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in: