Can’t locate DateTime perl module

July 22nd, 2017 No comments

If you are getting below error while installing any application on linux then perl date time module is missing.

Can’t locate DateTime.
pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at gatherbot_en.pl line 13.
BEGIN failed–compilation aborted at gatherbot_en.pl line 13.

You can use below command to install Datetime on server.

yum install perl-DateTime-TimeZone

After that if you are getting below error.

Can’t locate Date/Parse.pm in @INC

Then please run below command. It will ask to install some modules then keep on typing yes or hit enter.

cpan install Date::Parse

 

Categories: CPanel / WHM, Installation Tags:

How to change the color of your BASH prompt

May 11th, 2017 No comments

How to change the color of your BASH prompt

You can change the color of your BASH prompt to green with this command:

export PS1=”\e[0;32m[\[email protected]\h \W]\$ \e[m”

It will change the colour of bash temporarily. To make it permanent then add code in bash_profile page.

vi ~/.bash_profile

and paste above code save the file and you are done.

For other colors please see the attached list:

Color Code
Black 0;30
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33
Light Color Code
Light Black 1;30
Light Blue 1;34
Light Green 1;32
Light Cyan 1;36
Light Red 1;31
Light Purple 1;35
Light Brown 1;33
Light Blue 1;34
Light Green 1;32
Light Cyan 1;36
Light Red 1;31
Light Purple 1;35
Light Brown 1;33

Categories: Cloud Linux, CPanel / WHM, Tweaks Tags:

Amazon S3 bucket commands

May 11th, 2017 No comments

1. Delete an S3 bucket and all its contents with just one command

Sometimes you may end up with a bucket full of hundreds or thousands of files that you no longer need. If you have ever had to delete a substantial number of items in S3, you know that this can be a little time consuming. The following command will  delete a bucket and all of its content including directories:

aws s3 rb s3://bucket-name –force

2. Recursively copy a directory and its subfolders from your PC to Amazon S3

If you have used the S3 Console, at some stage, you’ve probably found yourself having to copy a ton of files to a bucket from your PC. It can be a little clunky at times, especially if you have multiple directory levels that need to be copied. The following AWS CLI command will make the process a little easier, as it will copy a directory and all of its sub folders from your PC to Amazon S3 to a specified region.

aws s3 cp MyFolder s3://bucket-name/Foldername — recursive

aws s3 sync “My Folder” s3://bukcet-name/“My Folder”

3. Display subsets of all available ec2 images

The following will display all available ec2 images, filtered to include only those built on Ubuntu (assuming, of course, that you’re working from a terminal on a Linux or Mac machine).

aws ec2 describe-images | grep ubuntu

Warning: this may take a few minutes.

4. List users in a different format

Sometimes, depending on the output format you chose as default, when you invoke long lists – like a large set of users – the display format can be a little hard to read. Including the –output parameter with, say, the table argument, will display a nice, easy-to-read table this one time without having to change your default.

aws iam list-users –output table

5.  List the sizes of an S3 bucket and its contents

The following command uses JSON output to list the size of a bucket and the items stored within. This might come in handy when auditing what is taking up all your S3 storage.

aws s3api list-objects –bucket BUCKETNAME –output json –query “[sum(Contents[].Size), length(Contents[])]”

6. Move S3 bucket to different location

If you need to quickly move an S3 bucket to a different location, then this command just might save you a ton of time.

aws s3 sync s3://oldbucket s3://newbucket –source-region us-west-1 –region us-west-2

 

Categories: AWS Tags:

How to extend disk space in windows 2012

May 10th, 2017 No comments

How to extend disk space in windows 2012

Login to windows. Click on Start run and type cmd.

In windows command prompt.

run diskpart.exe

DISKPART prompt will come.

diskpart >list volume

Above command will show list of volumes.

Select volume volume number

It will select the volume which you want to extend.

extend filesystem

It will extend filesystem size.

Once done. Close the command prompt and refresh windows explorer. If still it is showing old space then try rebooting the server.

 

Categories: Uncategorized Tags:

dd command to migrate VPS on linux platform

May 10th, 2017 No comments

dd command to migrate VPS on linux platform.

First create new vps with same configuration on another node. It doesn’t matter new vps is having os or not or you can choose any OS.

Once same configuration VPS setup done then use below command to migrate VPS.

dd if=/dev/guestos/kvm2351_img | ssh 10.10.10.10 “dd of=/dev/guestos/kvm2520_img”

Once migration is completed then try starting VPS on new node.

 

 

Categories: Uncategorized Tags:

Mount windows/linux disk using kpartx

May 10th, 2017 No comments

This post will guide you through how to access the contents of the virtual disk (LVM disk) directly so that you don’t need to boot the VM or when VM is not booting and you want to recover the data(windows or linux)

 

[[email protected] ~]# lvdisplay | grep centos
LV Path /dev/VolGroup/centos
LV Name centos

We need to create device maps from this LVM device’s partition tables.

kpartx -av /dev/VolGroup/centos

add map VolGroup-centos1 (253:8): 0 9912042 linear /dev/VolGroup/centos 63
add map VolGroup-centos2 (253:9): 0 562275 linear /dev/VolGroup/centos 9912105
add map VolGroup-centos : 0 562212 linear 253:9 9912168

Now we can mount the image and grab any files we may need.

mkdir /mnt/centos

mount /dev/mapper/vbox-centos1 /mnt/centos

Once we are done accessing our files, we can go ahead and unmount the partition and delete the partition mappings.

umount /mnt/centos

kpartx -d /dev/VolGroup/centos

 

 

 

Categories: Uncategorized Tags:

Kill restore process in new cpanel

October 14th, 2014 No comments

Kill restore process in new cpanel

 

In new cpanel/WHM when we try to kill restore process it is still showing in WHM >> restore full backup. Below are the steps to remove that process from WHM.

You can manually mark the transfer as completed using the following instructions:

Ensure the transfer is no longer running by clicking on the “View” option under “Sessions in Progress” for this transfer. In the new window, there will be a line that looks like this:

You may close this window and view the transfer on the command line: /usr/local/cpanel/bin/view_transfer 1071601843quick20141013154952IAZhRro

Access your server via SSH and run that command (the transfer name will be different on your server):

/usr/local/cpanel/bin/view_transfer 1071601843quick20141013154952IAZhRro

As an example, you might see output like this:

Transfer running with pid: paused
[795 ][MASTER ]: Start Session
[795 ][MASTER ]: Version: 1.9

You will note that the master PID for this transfer is xxx. If the process still exists, and the transfer has failed, then you can kill that process:

kill -9 xxx

The next step requires you to change the entry for this transfer in the whmxfer.sessions table in MySQL. Find the entry with the session ID for your migration. In the example we have been using, it’s ‘ 1071601843quick20141013154952IAZhRro .’ It will look like this:

mysql -e “select * from whmxfer.sessions where sessionid=’1071601843quick20141013152137YIVT7Ze'”
+————————————–+————–+——-+———+———————–+————-+——-+———————+———+
| sessionid | initiator | pid | version | target_host | source_host | state | starttime | endtime |
+————————————–+————–+——-+———+———————–+————-+——-+———————+———+
| 1071601843quick20141013152137YIVT7Ze | quickrestore | 21295 | 1.9 | vps1.insurancedxb.com | localhost | 50 | 2014-10-13 08:21:37 | NULL |
+————————————–+————–+——-+———+———————–+————-+——-+———————+———+

You will need to change the ‘state’ field to 100, and change the ‘endtime’ field from NULL to a time after the ‘starttime’ field:

mysql -e “update whmxfer.sessions set state=’100′, endtime=’2014-10-14 09:37:52′ where sessionid=’1071601843quick20141013152137YIVT7Ze'”

If you check it again then you will notice that process ended.

+————————————–+————–+——-+———+———————–+————-+——-+———————+———————+
| sessionid | initiator | pid | version | target_host | source_host | state | starttime | endtime |
+————————————–+————–+——-+———+———————–+————-+——-+———————+———————+
| 1071601843quick20141013152137YIVT7Ze | quickrestore | 21295 | 1.9 | vps1.insurancedxb.com | localhost | 100 | 2014-10-13 08:21:37 | 2014-10-14 09:37:52 |
+————————————–+————–+——-+———+———————–+————-+——-+———————+———————+

The transfer should then no longer appear under “Sessions in Progress.”

You can reconfirm the same by login into WHM.

Categories: CPanel / WHM, Uncategorized Tags:

How to replace MySQL with MariaDB in cpanel

September 30th, 2014 No comments

Backup existing MySQL data

Make sure to save all existing data just in case there are any issues.

cp -Rf /var/lib/mysql /var/lib/mysql-old
mv /etc/my.cnf /etc/my.cnf-old

Disable the targets so cPanel no longer handles MySQL updates

The following will mark the versions of MySQL we distribute as uninstalled so they are no longer maintained by cPanel/WHM

/scripts/update_local_rpm_versions –edit target_settings.MySQL50 uninstalled
/scripts/update_local_rpm_versions –edit target_settings.MySQL51 uninstalled
/scripts/update_local_rpm_versions –edit target_settings.MySQL55 uninstalled

Remove existing MySQL RPM’s so theres a clean slate for MariaDB

The below command will uninstall the MySQL RPM’s!

/scripts/check_cpanel_rpms –fix –targets=MySQL50,MySQL51,MySQL55

Create a yum repository for MariaDB

vi /etc/yum.repos.d/MariaDB.repo

place the following inside of it depending on the DISTRO (https://downloads.mariadb.org/mariadb/repositories/):

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5.29/centos6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Remove php from the /etc/yum.conf file then run the following commands

yum install MariaDB-server MariaDB-client MariaDB-devel
/etc/init.d/mysql start
mysql_upgrade
/etc/init.d/mysql restart

Add php back to the /etc/yum.conf file to ensure future php updates don’t get clobbered

Rebuild easyapache/php to ensure modules are intact/working

/scripts/easyapache –build

 

CVE-2014-7169 BASH Shell Shock Vulnerability for Linux

September 29th, 2014 No comments

What is CVE-2014-7169 / Shell Shock Vulnerability?

GNU Bash through 4.3 bash43-025 processes trailing strings after certain malformed function definitions in the values of environment variables, which allows remote attackers to write to files or possibly have unknown other impact via a crafted environment, as demonstrated by vectors involving the ForceCommand feature in OpenSSH sshd, the mod_cgi and mod_cgid modules in the Apache HTTP Server, scripts executed by unspecified DHCP clients, and other situations in which setting the environment occurs across a privilege boundary from Bash execution.
NOTE: this vulnerability exists because of an incomplete fix for CVE-2014-6271.
In short Shell Shock vulnerability allows remote attackers to execute arbitrary code given certain conditions, by passing strings of code following environment variable assignments.
The Shell Shock vulnerability is considered bigger than Heartbleed as it’s affecting all versions of bash and it’s still unclear from when and adding to that linux bash is not only running on linux webservers but other embedded devices as well such as Mac Laptops

Test your server bash version using below command

bash –version
or
/bin/bash –version

Output

GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

Check if your server is affected

[email protected][#] env x='() { :;}; echo vulnerable’ bash -c “echo this is a test”
bash: warning: x: ignoring function definition attempt
bash: error importing function definition for`x’
this is a test

If you get the above output then you are safe. But,  if you get the below output then you are affected.

[email protected][#] env x='() { :;}; echo vulnerable’ bash -c “echo this is a test”
vulnerable
this is a test

To fix it follow below steps:

For RedHat/CentOS/Fedora/RPM based OS:

Note:: This is a temporary fix released by Red Hat Security Team. The team is still working on a full fix which is expected to release soon.

[email protected][#] yum upgrade bash

For Ubuntu / Debian

apt-get update && sudo apt-get install –only-upgrade bash

 

 

Categories: Installation, Security Tags:

How to install kloxo panel in centos

June 16th, 2014 No comments

How to install kloxo panel in centos

Go to below path.

cd /usr/local/src

Use the wget Command to download latest version of Kloxo Auto Installer Script

wget http://download.lxcenter.org/download/kloxo/production/kloxo-installer.sh

Give proper permission.

chmod 777 kloxo-installer.sh

Install Kloxo control panel as Master.

./kloxo-installer.sh –type=master

Next follow the instructions. Once done you will get below message.

Congratulations. Kloxo has been installed succesfully on your server as master

You can connect to the server at:
https:/IP/:7777 – secure ssl connection, or
http:/IP/:7778 – normal one.

The login and password are ‘admin’ ‘admin’. After Logging in, you will have to
change your password to something more secure

We hope you will find managing your hosting with Kloxo
refreshingly pleasurable, and also we wish you all the success
on your hosting venture

Thanks for choosing Kloxo to manage your hosting, and allowing us to be of
service

 

Once you will get the above message then try accessing above link in browser. If still you are unable to access it then try adding port in iptables.

You can use one of the below command to enable port in iptables:

iptables -A INPUT -p tcp -m tcp –dport 7777:7778 -j ACCEPT

or

iptables -A INPUT -p tcp -m tcp –dport 7777 -j ACCEPT
iptables -A INPUT -p tcp -m tcp –dport 7778 -j ACCEPT

Once done restart the iptables.

/etc/init.d/iptables restart

 

 

 

Categories: Installation Tags: