Blog

  • Install Python for a user

    Log into server as user via SSH :

    Download Python package of required version from : http://www.python.org/getit/releases/

    Say, version required is 2.6.6

    Code: 
    # wget http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz
    Code: 
    # tar -xvf Python-2.6.6.tgz
    Code: 
    # cd Python-2.6.6

    Configure and Install Python for user :

    Code: 
    #./configure --prefix=/home/user_name/Python-2.6.6
    Code: 
    # make
    Code: 
    # make install

    Python Binary for the user will be : /home/user_name/Python-2.6.6/bin/python and to check version :

    Code: 
    # /home/user_name/Python-2.6.6/bin/python --version

    That’s All..!! 

  • Extend Xen Disk Space

    Xen VMs use lvms and extending disk space from SolusVM control panel may
    not work properly. So, we will need to extend the lvm manually.

    Shutdown VM from SolusVM control panel or use the following command on node :

    # xm shutdown vm_ID 

    (Replace vm_id with the xen ID of the VPS)

    Extend LVM :

    # lvextend /dev/Xen/vm_ID_img -L +50G 

    (This will increase the main disk size for vm by 50G)

    Checking File System for errors :

    # e2fsck -f /dev/vg0/vm_ID_img 

    Resize File System :

    # resize2fs /dev/vg0/vm1_ID_img 

    (This will increase the disk’s filesystem to the maximum new amount)

    Boot up the VM:

    # xm create vm_ID /home/xen/vm_ID/vm_ID.cfg 

    Done..!! Now check the VPS Disk Space using df command.

  • phpinfo() has been disabled

    If you get the message while browsing php info page, it means that
    phpinfo function is disabled. To resolve this you will have to :

    Remove phpinfo from disable_functions in php.ini

    To locate php.ini file, use command :

    # php –ini

    Check the line Loaded Configuration File: for php.ini location. Remove phpinfo  from disable_functions in php.ini and save it.

    Now check the phpinfo page..!!  8)

  • Change SolusVM admin password

    If you forget or lose your SolusVM Admin password, you can change it using SolusVM php script.
    Log into SolusVM master server via SSH. Then you can reset the admin password by running the below command :

    Code:
    php /usr/local/solusvm/scripts/pass.php --type=admin --comm=change 
    --username=<ADMINUSERNAME>

    For username mention the admin username for SolusVM , the default Admin username is vpsadmin.
    You will get an output similar to this:

    Code:
    New password: Wc7Q0EbVFUasJ4j

    Done..!! Now you can log into SolusVM server with the new password.

  • Enable MySQL slow query log

    The slow query log consists of SQL statements that took more than long_query_time seconds to execute and required at least min_examined_row_limit rows to be examined. It is very helpful in troubleshooting bad queries.

    Add the following to /etc/my.cnf file to enable the slow query log:

    Code: 
    log-slow-queries=/var/lib/mysql/slow.log

    After that, then do the following commands to create the file with the right ownership and file permissions:

    Code: 
    touch /var/lib/mysql/slow.log
    Code: 
    chmod 660 /var/lib/mysql/slow.log
    Code: 
    chown mysql:mysql /var/lib/mysql/slow.log

    Done..!! I hope that was too easy..  ;)

  • Iptables problems on VPSes

    You might have come across issues with csf on VPSes.

    CSF requires at least these iptables modules to work properly :
    ip_tables
    ipt_state
    ipt_multiport
    iptable_filter
    ipt_limit
    ipt_LOG
    ipt_REJECT
    ipt_conntrack
    ip_conntrack
    ip_conntrack_ftp
    iptable_mangle

    Other modules for additional functionality:
    ipt_owner
    ipt_recent
    iptable_nat
    ipt_REDIRECT

    You can check the hosting environment using :

    Code: 
    /etc/csf/csftest.pl

    This
    should run without any FATAL errors. If any such errors are present,
    check the module failed and see if it is installed on node. You can use
    “lsmod” command for that.
    Eg :
    Code: 

    # lsmod | grep ipt_limit

    If any of the modules is not present on the node, install it using modprobe command.
    Eg :

    Code:
    # modprobe ipt_limit

    Then to enable modules in VPS :

    Code:
    # vzctl set CT_ID --iptables ip_tbales ipt_multiport --iptables ipt_REJECT 
    --iptables ipt_recent --iptables xt_connlimit --iptables ipt_owner --iptables 
    ip_conntrack --iptables iptable_nat --iptables iptable_mangle --iptables 
    ipt_state --iptables ipt_limit --iptables ipt_LOG --iptables ipt_owner --save 

    (Replace CT_ID with container ID)

    These changes will be applied after the container restart.

    If
    you get any “memory allocation” errors with iptables on a VPS, make
    sure that your numiptent setting is set sufficiently high.  Set
    numiptent  to at least 1000.

    Code:
    # vzctl set CT_ID --numiptent 1000 --save

    (Replace CT_ID with container ID).

  • locate: can not open `/var/lib/mlocate/mlocate.db’: No such file or directory

    The locate command is a very useful command to find the exact
    path/location of files in Linux if you know the file name. You can
    install it using yum and the package is mlocate.
    Quote

    can not open `/var/lib/mlocate/mlocate.db’: No such file or directory

    It
    is a common issue while using locate command, and the error is because
    we haven’t created the db for locate. To create db for locate, simply
    run the command :

    Code: 
    # updatedb

    Wait for it to complete and run the locate command again. It should be working fine this time…!!!  :D
    You can use the same command (updatedb)to update recent changes to locate’s db.

  • Enable CLR Integration in SQL Server 2008

    By default the common language runtime (CLR) integration feature is
    turned off. If it is turned off, SQL server won’t be able to access the
    custom assemlies that are part of your database (if the database
    contains objects that are coded to use CLR integration). CLRmust be
    enabled in order to use objects that are coded to use CLR integration.

    To check :
    Open
    SQL Management Studio, click on the “New Query” button. In the query
    window paste the following and click the “Execute” button :

    Code: 
    SELECT * FROM sys.configurations
    WHERE name = 'clr enabled'

    To enable CLR integration, use the clr enabled option of the sp_configure stored procedure:

    Execute the below query :

    Code: 
    sp_configure 'show advanced options', 1;
    GO
    RECONFIGURE;
    GO
    sp_configure 'clr enabled', 1;
    GO
    RECONFIGURE;
    GO

    Then click the “Execute” button to run the stored procedure.

    In the SQL Server “Messages” window you should see messages similar to below ones :

    Configuration option ‘show advanced options’ changed from 0 to 1. Run the RECONFIGURE statement to install.
    Configuration option ‘clr enabled’ changed from 0 to 1. Run the RECONFIGURE statement to install.

    That’s all..!!

  • 535 Incorrect Authentication Data

    The error normally caused due to incorrect permissions. We can fix mail box permissions from WHM on cPanel servers. For that : 

    1) Log into WHM as root and click on “Email” section.
    2) Select “Repair Mailbox permissions
    3) It will show a message like :


    This function will inspect mailbox ownership and permissions and attempt to 
    fix any issues that may exist. 

    Click “Proceed >>” button.

  • Fatal error: Allowed memory size of x bytes exhausted (tried to allocate xbytes)

    The error normally occurs when PHP tries to process a big database
    records or when importing or exporting. To solve the error, there are
    two fixes. One is to increase PHP memory limit of the account by using a
    custom php.ini file. But sometimes it won’t work.

    If it didn’t
    work, then you can fix the error by increasing the memory of the
    particular PHP script (displayed in error message) by adding an
    additional line at the top of the script:

    Code: 
    ini_set(”memory_limit”,”32M”);  

      (Change the value based on the error message).

    Now
    browse the page again, perform the operation again. It will just work
    fine if you have set correct value based on the error message.