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"

Sunday, July 29, 2018

Changing Server Hostname

To change your hostname, enter the following command as root:

$ hostname servername.yourdomain.com

If you are using cPanel, you will need to resync your license with the cPanel license server.  To do this, use the following command:

$ /usr/local/cpanel/cpkeyclt

Creating a Welcome message for SSH logins

Did you ever want to change or create a new login message anytime someone logs into SSH? We'll show you how it's done.

First off login to the server as root. Then type in the following:
pico /etc/motd

Now type in the security login message you wish all users to see once they login to your server through SSH. Try something like this as a start:

This computer system is for authorized users only. All activity is logged and regulary checked by systems personal. Individuals using this system without authority or in excess of their authority are subject to having all their services revoked. Any illegal services run by user or attempts to take down this server or its services will be reported to local law enforcement, and said user will be punished to the full extent of the law. Anyone using this system consents to these terms.

Now type Ctrl+X then hit Y and enter.
Logout of SSH then log back in, you will receive your new greeting!

Common SSH Commands - Linux Shell Commands

Navigation

pwd Shows the full path of the current directory
ls Lists all the files in the current directory
ls -al Lists all files and information
ls –alR Lists all files and information in all subdirectories
ls -alR | more Same as ls –alR, pausing when screen becomes full
ls -alR > filename.txt Same as ls –alR, outputs the results to a file
ls *.html Lists all files ending with .html
cd [directory name] Changes to a new directory
cd .. Changes to directory above current one
clear Clears the screen
vdir Gives a more detailed listing than the "ls" command
exit Log off your shell

Moving, Copying, and Deleting Files

mv [old filename] [new filename] Move/rename a file
cp [filename] [new filename] Copies a file
rm [filename] Deletes a file
rm * Deletes all files in current directory
rm *.html Deletes all files ending in .html
Creating, Moving, Copying and Deleting Directories
mkdir [directory name] Creates a new directory
ls -d */ Lists all directories within current directory
cp -r [directory] [new directory] Copies a directory and all files/directories in it
Searching Files and Directories
find . -name [filename] -print Searches for a file starting with current directory
grep [text] [filename] Searches for text within a file


Saturday, May 26, 2018

How to check the Inode usage for an account in cPanel server

First of all, let me briefly explain about Inode. Index Node (inode) is a basic concept in Linux/Unix. Index node/number (inode) is a data structure which contain the information about a file in your server/hosting account.

Inode save the information such as user and group ownerships, access mode (read, write, execute permissions) and file type.
Number of inodes indicates the number of files and folders in your account. Every file like a webpage, image file, an email, cache file etc will count as 1 inode.
In a WHM server, you can view the inode usage of your account from left side of your cPanel which is denoted by the term “File Usage”.


Note, this feature must be enabled from the WHM's tweak settings (Display File Usage information in the cPanel stats bar (inode count)) to display in cPanel. [Default OFF]


How to Install eAccelerator on cPanel Server

eAccelerator is a free open-source PHP optimizer & accelerator. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. Enhances execution of scripts. It typically reduces server load and increases the speed of your PHP code by 10 times. Stores compiled PHP scripts in shared memory and executes code directly from it. It creates locks for a short time, so one script can be executed at the same time by several engines. Files that can’t fit in shared memory are cached on disk.
Installing eAccelerator on your linux dedicated/VPS can be achieved by just one command.

 
# /scripts/phpextensionmgr install eAccelerator 

Un-installation of eAccelerator

/scripts/phpextensionmgr uninstall EAccelerator


Check with the command below if eAccelerator has been installed properly.

Friday, May 18, 2018

Install Memcache onto cPanel

Memcached is a service that allows entire database tables to be stored in memory, drastically speeding up queries to those tables and alleviating database load. In WordPress and W3 Total Cache, the Memcached module allows you to store all cache tables in memory.
This guide can be used to set up Memcached on CentOS.

To install memcached on cpanel server, login to SSH as user root, run

   
yum install memcached
Enable memcached start on boot with
systemctl enable memcached
Start memcached with
   
systemctl start memcached

Enable memcached PHP module
For PHP applications to use memcached, we need PHP module installed. To install login to WHM as user root, go to
Home > Software > Module Installers



Install nginx as reverse proxy in cPanel

The web-hosting control panel’s default web-server is Apache. cPanel/WHM doesn’t have native support on Nginx, but we can install and configure it so that it will improve the server performance.

Why run Apache and Nginx together? Is there any advantage by using Nginx as reverse proxy on Cpanel?

Both Apache and Nginx are powerful and effective web-servers. Apache is the topmost webserver since it was released in 2006 and Nginx is now using top websites. The reason for using Apache and Nginx are clear, Apache’s power and Nginx’s speed. By setting Nginx as reverse proxy, we can increase the website’s speed and performance on the server. This is because, Nginx will take care of all static contents in the website such as CSS, images, SWF files, MP4 and more. Apache will manage the rest of requests (dynamic requests – php page). This is known as a Nginx reverse proxy setup. Nginx stand as a front end server with a powerful backend Apache server.

How to set up?


WHM/Cpanel Increase The Size Of /tmp (/usr/tmpDSK) Partition

You may have noticed that cPanel’s default partition size for /tmp is
512 MB, which in some cases can be way too small. And sometime you probably get this report email:
Drive Critical: /usr/tmpDSK (/tmp) is 100% full
Although cPanel automatically deletes the unused files, the /tmp would be getting full very quickly on a busy server.
The /tmp partition on cPanel servers, assuming it was the one cPanel created and not one you did yourself, is a file-based partition that can easily be resized.
By default on most servers, /tmp is the temporary dumping place for a lot of things, for example:
  • PHP session files
  • PHP temporary file uploads
  • MySQL temporary files
  • Cache files for certain Apache modules


Basic Linux Commands

In this article, I am going to provide you a brief overview of some of the most commonly used and essential Linux Commands. Becoming familiar with these commands will help you get far in a fairly short amount of time.


  • ls Displays everything in the current directory
  • ls -a Displays all files, including hidden
  • ls -l Displays all files, along with the size and timestamp
  • tar -zxpf Uncompresses tar.gz files
  • tar -xpf Uncompresses .tar files
  • gunzip Uncompresses .gz files
  • cp /path/to/old /path/to/new Copies a file to a new file
  • mv /path/to/old /path/to/new Moves a file to a new file, or rename
  • mkdir Creates a directory
  • rmdir Deletes a directory
  • rm Deletes a file
  • rm -rf Deletes a directory
  • cd /path/to/dir Moves to a directory
  • cd .. Move up one directory
  • cd ~ Moves to your home directory
  • cd – Moves to the previous directory
  • pwd Displays the present working directory (the one you’re in)
  • pico Edits a file
  • ftp Connect to a FTP server
  • lynx View a webpage
  • df Displays the hard drive stats
  • quota Displays your quota
  • uptime Displays the uptime of the server
  • uname -a Displays the operating system stats
  • whoami Displays your info
  • who Displays others connected to the server
  • last Displays the last login
  • whereis Tells where a file is located
  • BitchX IRC Client
  • mail Check your email
  • ps -x Displays processes your running
  • ps -a Displays all processes running
  • ps -ux Displays running processes, with CPU/Memory usage
  • kill pid# Kills a process
  • kill -9 pid# Kills an eggdrop process
  • killall proc_name Kills all running process of the same type
  • whatis Description of commands
  • man command Displays help on the command (manual)
  • nano Same as Pico (Use yum install nano if it doesn’t first work)
  • Top – gives an overall view of what is going on with the server including memory usage, serve load and running processes “q” to exit top
  • sar -q gives a report of the process list, 1 minute and 5 minute average load every 10 minutes since midnight server time
  • tar -zcf filename.tar.gz file Tars up the file or directory of your choice, replace filename.tar.gzwith the name you want your tar file to have…with the tar.gz extension on the end and replace file with the file or directory you want to tar up. Can also use a path/to/file for both.
  • updatedb – Updates the locate/search DB.
     

Friday, January 26, 2018

How to Restore a Full cPanel Backup to VPS

Backup restoration is one of the essential tasks every server administrator must know how to perform. Under cPanel it is really simple to restore full backup of one account. In this tutorial we are going to show you two very easy methods about how to restore a full cPanel backup to a Linux VPS.

Restore Full cPanel Backup via WHM

Outlook - Update to enable TLS 1.1 and TLS 1.2 as a default secure protocols

Due to the recent version changes, cPanel software uses a secure version of TLS, v1.2 and will prevent email clients from accessing secure email with older, less secure ones such as TLS v.1.1 , TLS v.1.0 and SSL 2 and 3 . It is possible that the version of the mail client being used or the version of windows is the major reason for the recent issues. For example, if on Windows 7, Windows 7 may not be fully up to date or may not offer appropriate support for the minimum required version of TLS cpanel now support. Microsoft itself has published methods of allowing this to work:

It is better to try configuring your  operating systems and web browsers to use TLS v1.2 according to sites such as these:
 

Follow the instructions below: