Pages

Wednesday, December 5, 2018

Optimize MySQL & Apache on cPanel/WHM server

On this optimization process, we will go over the Apache core configuration and modules that are part of Apache core. We think that with the correct settings of Apache and MySQL you can get excellent results and the correct level of resource use without installing third-party proxy and cache modules. So let’s start,


Apache & PHP

In the first stage we run the Easy Apache and selected the following:

    Apache Version 2.4+

    PHP Version 5.6+

    In step 5 “Exhaustive Options List” select

– Deflate

– Expires

– MPM Worker

After Easy Apache finished go to your WHM » Service Configuration » Apache Configuration » “Global Configuration” and set the values by the level of resources available on your server.

    Apache Directive       (From 2GB memory or less and to 12GB+ memory)      

Command to activate VG on LVM

When you create a volume group, by default, it is activated. Sometimes you may need to activate it manually to make the kernel aware of volume groups.

To activate,

    # vgchange -ay my_vg_name

To De-activate,

    # vgchnage -an my_vg_name

A command to activate the VG in a cluster?

To activate exclusively on one node,

cPanel EasyApache 4 Installing Redis and Redis PHP extension

Installing the Redis daemon:

for CentOS 6/RHEL 6

    rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
    rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
    yum -y install redis --enablerepo=remi --disableplugin=priorities
    chkconfig redis on
    service redis start

for CentOS 7/RHEL 7

    rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
    yum -y install redis --enablerepo=remi --disableplugin=priorities
    systemctl enable redis
    systemctl start redis

Resetting email account password from Command line in cPanel

1) Login to the server as root via SSH

2) Run the command “openssl” and you will see this:

    test@test [~]# openssl
    OpenSSL>

3) Now in the OpenSSL prompt give the command : passwd -1 “your_new_email_password”

    test@test [~]# openssl
    OpenSSL> passwd -1 “test@123”
    $1$m4pq941w/j$1KYI5VwHl8C6h9H6ScTFNWy/
    OpenSSL> quit

Please note the option in command: passwd -1 “test@123”. It is not alphabet “-l”. It is numeric “-1”.
You will get the MD5 encrypted format for your password. Copy it somewhere.

How to upgrade ubuntu 16.04 to ubuntu 18.04

Check Ubuntu version before upgrading.

    lsb_release -a

First, we have to run an update

    sudo apt update

Then run upgrade command

    sudo apt upgrade

After that dist-upgrade

    sudo apt dist-upgrade

Then update core manager

    sudo apt install update-manager-core

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

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"