All posts by admin

Setting up a lubuntu desktop

First get you a vps from a quality company, example Digital Ocean.

Once you have your vps, reload the OS to Ubuntu 18.X

Lubuntu Desktop Installation

Login to your VPS server as root via SSH.

Firstly, update system packages by issuing following command:

apt-get update

Then Install the Lubuntu Desktop:

apt-get install lubuntu-desktop

It may take about 10 -15 minutes for the installation. After the installation, you’ll have a full-fledged desktop environment with some handy applications like AbiWord for docs and Firefox for web browsing.

Then reboot your server for changes to be take effect:


Now add your first user.

adduser username

Now lets install the remote desktop server.

First open a terminal and enter sudo apt-get install xrdp.

When that is installed enter sudo nano /etc/xrdp/ in the terminal. Make sure the last line looks like this:

. /etc/X11/Xsession

Then go to your home folder, rightclick and select Show hidden. If there is no file named .xsession, create it. If there is a filed named like that, open it and make sure that it looks like this when your done: lxsession -e LXDE -s Lubuntu

Now type sudo service xrdp restart in the terminal to restart xrdp. Now it should work 🙂

Now lets install Google Chrome software for all to use.

From the ssh command line that you should still be logged in at.

The list of commands to run one by one from command prompt:

  1. sudo wget -q -O – | sudo apt-key add –
  2. sudo sh -c ‘echo “deb stable main” >> /etc/apt/sources.list.d/google.list’
  3. sudo apt-get update
  4. sudo apt-get install google-chrome-stable

The first time when you run the command,it will ask for admin password. Run the above commands one by one, finally You can see Chrome tab under Applications -> Internet -> Google Chrome

Install XenServer tools in your VM

Install XenServer tools

Next step is to install those tools. Also I’ll give you some tips.

For any VM, go in the console view on your VM, and insert the appropriate ISO:

  • xs-tools.iso for XenServer 6 and older
  • guest-tools.iso for XenServer 7 and high

Then, each system is a bit different.

For Linux VMs

Debian, Ubuntu (deb based)

For a Debian VM, it’s pretty simple, as root:

  • mount /dev/cdrom /mnt
  • bash /mnt/Linux/
  • umount /dev/cdrom

In a real example:

root@myVM:~# mount /dev/cdrom /mnt       
mount: block device /dev/xvdd is write-protected, mounting read-only
root@myVM:~# bash /mnt/Linux/ 
Detected `Debian GNU/Linux 7.9 (wheezy)' (debian version 7).

The following changes will be made to this Virtual Machine:
  * update arp_notify sysctl.
  * packages to be installed/upgraded:
    - xe-guest-utilities_7.0.0-24_all.deb

Continue? [y/n] Y

(Reading database ... 37679 files and directories currently installed.)
Preparing to replace xe-guest-utilities 6.2.0-1133 (using .../xe-guest-utilities_7.0.0-24_all.deb) ...
Stopping xe daemon:  OK
Unpacking replacement xe-guest-utilities ...
Setting up xe-guest-utilities (7.0.0-24) ...
Installing new version of config file /etc/init.d/xe-linux-distribution ...
$Detecting Linux distribution version: OK
$Starting xe daemon:  OK

You should now reboot this Virtual Machine.

That’s all! You can eject the ISO now.

As soon the .deb is installed, tools will report their info: no need to reboot!

CentOS, RHEL (rpm based)

Same principle, almost same procedure than on a Deb based distro:

# mount /dev/cdrom /mnt/
mount: block device /dev/xvdd is write-protected, mounting read-only
[root@localhost ~]# bash /mnt/Linux/ 
Detected `CentOS release 6.6 (Final)' (centos version 6).

The following changes will be made to this Virtual Machine:
  * update arp_notify sysctl.
  * packages to be installed/upgraded:
    - xe-guest-utilities-7.0.0-24.x86_64.rpm
    - xe-guest-utilities-xenstore-7.0.0-24.x86_64.rpm

Continue? [y/n] y

Preparing...                ########################################### [100%]
   1:xe-guest-utilities-xens########################################### [ 50%]
   2:xe-guest-utilities     ########################################### [100%]

You should now reboot this Virtual Machine.
[root@localhost ~]# 

Nope, rebooting is not mandatory.

Adding Additional Disk Drives to CentOS

Adding a new drive to CentOS or RedHat systems.

Making use of a second drive for extra space? Here’s a quick run-down:

1) Make sure you know which disk is being formatted. First, second, and third drives will be /dev/sda, /dev/sdb, and /dev/sdc respectively. Check this with fdisk -l

[03:50:04] [root@virt ~]# fdisk -l

Disk /dev/sda: 34.3 GB, 34359738368 bytes
255 heads, 63 sectors/track, 4177 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        4177    33447330   8e  Linux LVM

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

2) You can see that /dev/sdb (our second hard drive) does not have any partitions. We will need to create a partition(s) on the drive and then make a file system on it, then mount it. Let’s write partitions to the drive using fdisk /dev/sdb:

[03:53:01] [root@virt ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help):

3) As you can see from the help menu (by using the command “m”) we want to add a new partition. Using the defaults will use the entire disk. After it’s created, you will want to use the command “w” to “write table to disk and exit”.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-1044, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044): 
Using default value 1044

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[03:54:58] [root@virt ~]#

4) Now you will notice that the output of fdisk -l /dev/sdb shows a partition as /dev/sdb1:

[03:57:08] [root@virt ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1044     8385898+  83  Linux

5) Now we need to create a file system on it. I’ve always used ext3 for general use/purposes. You’ll want to use the command mkfs -t ext3 /dev/sdb1 as shown here:

[03:58:38] [root@virt ~]# mkfs -t ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1048576 inodes, 2096474 blocks
104823 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2147483648
64 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

6) Great, now we have a single partitioned secondary drive using ext3 file system. Now you want to create a directory to mount it in; lets just use “/drive2”. You’ll need to use the command mount -t [filesystem] [source] [mount directory] to mount it.

[03:59:50] [root@virt ~]# mount -t ext3 /dev/sdb1 /drive2/

7) Now you’ll notice, via df, that the drive is mounted:

[03:59:57] [root@virt ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
                       28G  1.4G   25G   6% /
/dev/sda1              99M   19M   76M  20% /boot
tmpfs                1014M     0 1014M   0% /dev/shm
/dev/sdb1             7.9G  147M  7.4G   2% /drive2

8) Last step – you want to make sure the drive automatically mounts itself when the server boots/reboots. You’ll need to add the following line to your /etc/fstab file:

/dev/sdb1  /drive2  ext3  defaults 0 0


All done!



SolusVM Mass Starting/Stopping Virtual Servers

If you need to mass start your virtual servers, run the following code in SSH on the host:



CFGS=/home/xen/vm*/;for cfg in $CFGS;do xm create $cfg*.cfg;done


xm shutdown -aw



CFGS=`vzlist -S -Ho ctid`;for cfg in $CFGS;do vzctl start $cfg;done


CFGS=`vzlist -S -Ho ctid`;for cfg in $CFGS;do vzctl stop $cfg;done


CFGS=/home/kvm/kvm*/;for cfg in $CFGS;do virsh create $cfg*.xml;done

Using Screen

Screen is like a window manager for your console. It will allow you to keep multiple terminal sessions running and easily switch between them. It also protects you from disconnection, because the screen session doesn’t end when you get disconnected.

You’ll need to make sure that screen is installed on the server you are connecting to. If that server is Ubuntu or Debian, just use this command:

sudo apt-get install screen

Now you can start a new screen session by just typing screen at the command line. You’ll be shown some information about screen. Hit enter, and you’ll be at a normal prompt.

To disconnect (but leave the session running)

Hit Ctrl + A and then Ctrl + D in immediate succession. You will see the message [detached]

To reconnect to an already running session

screen -r

To reconnect to an existing session, or create a new one if none exists

screen -D -r

To create a new window inside of a running screen session

Hit Ctrl + A and then C in immediate succession. You will see a new prompt.

To switch from one screen window to another

Hit Ctrl + A and then Ctrl + A in immediate succession.

To list open screen windows

Hit Ctrl + A and then W in immediate succession

There’s lots of other commands, but those are the ones I use the most.



scp examples

Example syntax for Secure Copy (scp)

What is Secure Copy?

scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.


Copy the file “foobar.txt” from a remote host to the local host

$ scp /some/local/directory

Copy the file “foobar.txt” from the local host to a remote host

$ scp foobar.txt

Copy the directory “foo” from the local host to a remote host’s directory “bar”

$ scp -r foo

Copy the file “foobar.txt” from remote host “” to remote host “”

$ scp \

Copying the files “foo.txt” and “bar.txt” from the local host to your home directory on the remote host

$ scp foo.txt bar.txt

Copy the file “foobar.txt” from the local host to a remote host using port 2264

$ scp -P 2264 foobar.txt

Copy multiple files from the remote host to your current directory on the local host

$ scp\{a,b,c\} .
$ scp\{foo.txt,bar.txt\} .

scp Performance

By default scp uses the Triple-DES cipher to encrypt the data being sent. Using the Blowfish cipher has been shown to increase speed. This can be done by using option -c blowfish in the command line.

$ scp -c blowfish some_file

It is often suggested that the -C option for compression should also be used to increase speed. The effect of compression, however, will only significantly increase speed if your connection is very slow. Otherwise it may just be adding extra burden to the CPU. An example of using blowfish and compression:

$ scp -c blowfish -C local_file

** Source –

Command Line Ping Sweep

Sometimes it can be handy to ‘see’ what is around you on a network, for instance when you’re using DHCP on a network and you want to find which addresses are already taken. Or you want to see whether specific machines are up and running… Of course there are various tools you can install or use, but there are times that you just can’t reach for the right tool(s)… You don’t want to do a ping sweep for nothing.
Of course there is a way of ping sweeping from the command line By simply using the ‘FOR’, ‘PIPE’ and ‘GREP’ commands in a clever way.

for i in {1..254}; do ping -c 1 -W 1 192.168.1.$i | grep ‘from’; done

Naturally you can stop the ping sweep by entering Ctrl+z

Install, Edit, or Remove Cron Jobs

1. Install Crontab in Batch Mode

By specifying the file name as an argument to crontab command, you can install the new cron jobs from a text file as shown below.

First create a text file with all your cron job entries.

$ cat cron-file.txt
* * * * * /bin/date >> /tmp/date-out
* * * * * /bin/ls >> /tmp/ls-out

Next, install the cron jobs from a text file as shown below.

$ crontab cron-file.txt

Note: This will overwrite the existing cron entries.

2. Edit crontab in Batch Mode

You can edit the crontab in batch mode using various methods (for example, using sed).

Example: Change output redirection from write to append for all cron jobs.

$ crontab -l
* * * * * /bin/date > /tmp/date-out
* * * * * /bin/ls > /tmp/ls-out

$ crontab -l | sed 's/>/>>/' | crontab -

$ crontab -l
* * * * * /bin/date >> /tmp/date-out
* * * * * /bin/ls >> /tmp/ls-out

3. Remove All cron jobs of the Current User

Crontab’s -r option removes all cron job for the current user. If you have appropriate privilege, you can even remove other user’s cron jobs using the -r option along with the -u user option.

Example: Remove the current user cron entries.

$ crontab -r

Example: Remove the specified user cron entries.

$ crontab -r -u USERNAME

Installing WHM and cPanel

1.) Login via SSH as root
2.) Run the following command: cd /home && curl -o latest -L && sh latest
3.) The install will take an hour to 90 minutes to complete
4.) Once the install is complete, you will need to login to WHM to finish the installation process. Your control panel will be located athttps://<ipaddress>:2087 replacing <ipaddress> with the main IP address your services are located on.
5.) Follow the on screen instructions, you will be prompted for a variety of different features and functions, please be sure to read the help icons if you are unsure what each feature or requirement is.

You are now all set to begin using WHM/cPanel. We recommend configuring any packages you might have next!

Full Server Backup and Move Using rsync

Need to make a quick backup of your server? Maybe even move all your important files? Use the following commands to backup or replicate your entire Linux server without any pain. If you are sending the backup to a remote server, use the second command. Both commands will backup non-system files (not software, only settings and user files) which is perfect if you are migrating an entire server or just need a very usable backup that keeps your directory structure completely intact all the way to the root folder. We do recommend that this command only be ran by a qualified Linux technician, there is a very real possibility that if you do not know where you are putting the files, you can overwrite files that you actually don’t want overridden so be sure to use these commands with care. Also recommended if you are replicating that you replicate to a operating system that is the same as the original machine to prevent any oddities.

When in doubt, contact Mean Servers for a quote, we can do it for you!

Local Backup: rsync -aAXv –exclude={“/dev/*”,”/proc/*”,”/sys/*”,”/tmp/*”,”/run/*”,”/mnt/*”,”/media/*”,”/lost+found”} / /path/to/backup/folder

*Be sure to replace the /path/to/backup/folder in the first one with the location of where you wish to place the backup of.

Remote Backup: rsync -aAXv –exclude={“/dev/*”,”/proc/*”,”/sys/*”,”/tmp/*”,”/run/*”,”/mnt/*”,”/media/*”,”/lost+found”} / root@<remote ip>:/path/to/remote/backup/folder

*Be sure to replace the <remove ip> with the IP address of the server you are sending the backup to and /path/to/remote/backup/folder with the full path to the remote backup folder location