Install Cloudlinux in cPanel

  • Post author:
  • Post category:cPanel

PREPARATION

  • Obtain the Cloud Linux License from manage2.cpanel.net
  • Obtain permission from the customer to reboot the server.
  •   

    In cPanel:

    /usr/local/cpanel/cpkeyclt
    /usr/local/cpanel/bin/cloudlinux_system_install -k

    ~Possible error: Might see "Yum error: Plugins are disabled".

    ~Add "plugins=1" to /etc/yum.conf and try again.
    echo "plugins=1" >> /etc/yum.conf that should do the trick

    shutdown -ar now

    ~When its back up rebuild apache.

    /usr/local/cpanel/scripts/easyapache --build

      
    3rd party license

    wget http://repo.cloudlinux.com/cloudlinux/sources/cln/cpanel2cl
    sh cpanel2cl -k $key
    ~Replace $key with your license key.
    reboot
    /scripts/easyapache --build

      

    POST INSTALL

    If after installation you don’t see any numbers in the LVE page in WHM, this is normal. A cPanel account needs to be created first to set up the vhost, and after that numbers won’t show until it receives traffic.

    yum install yum-protectbase
    vim /etc/yum/pluginconf.d/rhnplugin.conf

    add the following to the file:
    [cloudlinux-x86_64-server-5]
    protect = 1

    [cloudlinux-base]
    protect = 1

      

    Install Plugins
    In order to install the lve cpanel modules and plugins

    yum -y install cpanel-lve cpanel-lvemanager

      

    More documentation can be found at http://docs.cpanel.net/twiki/bin/vief/AllDocumentation/InstallationGuide/InstallingOs

    User Configuration

    The main configuration file for all the users on the system is /etc/container/ve.cfg. This XML file contains two types of settings: default settings, and per-user settings. If an account does not have per-user settings, the account is subject to the default settings.


















    Per-user settings are managed by their cloud linux ID. In the vast majority of cases, this ID is the UID for the user found in /etc/passwd. In rare cases on cPanel boxes the cloud linux ID for a user can be different.
      

    cpu limit

    The cpu limit limits the percentage of CPU that a user can use. When changing this, just give it a number between 1 and 100.
      

    ncpu limit

    The ncpu limit limits the number of processor cores that the user can access on the server. It takes an integer no higher than the actual number of cores on the server.
    When changing this number, remember that the cpu limit applies to each core. So, if cpu is set to 25, and ncpu is set to 2, then the user can use up to 25% of 2 cores, or the equivalent of 50% of one core.
      

    mem limit

    The mem limit limits the maximum amount of RAM that a user can grab at any one time. This number is measured in KB (kilobytes).
      

    Correction for version 0.8
    mem limit controls virtual memory. It is set in number of 4kb pages. To get the number in bytes multiply it by 4096, Example: mem limit=”524288″ will increase the vmem limit to 2g.
    # lveinfo
    lVMem
    2.0G

      

    pmem
    pmem is physical memory.

    Correct for version 0.8

    The limit does not appear to be directly reflect the KB set. Example: mem limit=”262144″ will increase the vmem limit to 1g.
    # lveinfo
    lPMem
    1.0G

      

    maxentryprocs

    This variable limits the number of entry processes a user can run. Entry processes are just a certain type of process usually used in serving a web page. For example, CGI and PHP scripts are subject to this number. This variable takes an integer. Note: This variable does NOT limit the entire number of processes the user can spawn, only ones related to the serving of web pages.
      

    Load new cloudlinux configuration

    /etc/init.d/lvectl reload

      

    Current Server configs

    vim /etc/container/ve.cfg
     

    0.8

    < ?xml version="1.0" ?>









      
    Apache configuration

    Apache configuration is handled in
    /etc/httpd/conf/modhostinglimits.conf
    There should be little need to adjust this file. There is no need to modify individual vhosts. SuExec MUST be enabled in order for Cloud Linux to monitor web traffic.
      

    Command-line Tools

    Cloud Linux comes with a number of command line tools to help administer its usage. All such tools start with “lve”, and usually correlate to a similar command-line tool from unixland. While Cloud Linux does log a few things to /var/log/messages, for the most part it logs information to an SQLite database. In order to access it, you must use these tools and filter the information as needed, rather than grepping a traditional log file.

    lveps
    lveps provides a snapshot of process usage and groups them by cloud linux user.

    lvetop
    lvetop shows real-time resource usage of each user.

    lveinfo
    lveinfo shows a snapshot of historical resource usage. Data anywhere from one minute to two months old can be retrieved. Documentation for its use can be found here:
    http://docs.cloudlinux.com/index.html?lve-stats.html

    lvectl
    lvectl is the main command line tool for changing and applying configuration settings to cloud linux. It takes several arguments.

      1. lvectl apply applies changes that you have made to ve.cfg. If you give it a UID, it will reload just that user’s changes; otherwise it will reload all the configurations in the file.
      2. lvectl set lets you change cpu, io, and maxentryprocs for a user without those changes beings saved to ve.cfg. This is good for temporarily trying out some changes before committing them permanently. If you do want to make the changes permanent, you can rerun the lvctl set command with the –save flag.
      3. lvectl delete removes the supplied UID from ve.cfg, restoring the user to the system default restrictions.
      4. lvectl list lists all the running users.

    WARNING: apart from “lvectl list”, no other lvectl commands needs to be run in a shared server environment. If a account is butting up against the Cloud Linux’s restrictions, they should be advised to upgrade account types to. (Assuming you have multiple account package types for existing accounts in a shared environment.)

     
    Support Concerns

    Apart from initial configurations, a customer will most likely contact you once they have hit some resource limit. The page will not say “This Site Being Detroited by CLOUD LINUX™ “, but there will be some clues that should tip you off that a site is hitting the cloudlinux limits.
     
    508 errors

    If a site returns a 508 Resource Limit Reached error, then it is almost certainly butting up against a cloud linux limit, probably memory. 508 is a valid http response code, and as far as Cloud Linux knows, they are the only ones actually using it. If you see such an error, run this one-liner:
    lveinfo --by-fault=mem --display-username --period=1d
    This should give you info on just how bad the user is hitting the memory limit.
      

    General Site Slowness

    If a cloud linux site is experience general site slowness, they are likely hitting a non-memory limitation. To diagnose, run lvetop and try to load the site. Look to see which resource the site in question is hitting. You will also need to know their cloud linux UID number.

    Info: slowdowns happen more easily on single-core systems. If you are running a single-core server, you probably should upgrade or not be using cloud linux in this environment. But, this will depend on the type of server being utilized.

      
    Monitoring Concerns
     
    Load Average

    Certain waiting procs are not counted in a standard load average, and Cloud Linux does NOT supply a correct load average. Therefore, all load averages you see on the server will be artificially low. If you are looking at a problem server, but the load looks low, it might still be distressed. Look at the user, system, and idle CPU in top. Also take a gander at iowait.

    Note: This has been fixed in recent versions so you may see a consistent jump in load after updating cloudlinux.
     

    Cloud Linux usage reporting

    The stats that should be given special attention to at this level are the avg’s. For example:

    aCPU
    aIO
    aEP
    aPMem
    mCPU
    mPMem

    The exception is Physical memory usage which depending on the limits applied earlier. Normal limits are 1G; so if you see an account hitting this limit, it should be looked into.

    If a customer is hitting the physical memory limit for more than 2 days, check into this even if it is not causing a fault.
    lveinfo --period=2d --by-usage=pmem_max --display-username
     
    Note: The above cmd is probably the most useful stat when you start looking for accounts causing issues.
     
    Customers hitting any limits and triggering a fault.
    lveinfo --period=2d --by-fault=any --display-username
     
    Customers hitting the apache per user connection limit and faulting (entry procs).
    lveinfo --period=2d --by-fault=mep --display-username
     
    Customers hitting the vmem limit and faulting. (This is far less likely to cause a problem on the server but it may be causing problems for the customer.)
    lveinfo --period=2d --by-fault=vmem --display-username
     
    Also, check user reports before presuming there is an issue. Looks for RAM, CPU or I/O usage that is at or close to max over 25% of the times listed.
    lveinfo --period=2d -u$user

    Enjoy!

    g33kadmin

    I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....