[GUIDE] Installing/Configuring LiteSpeed with CHRoot

Discussion in 'Site & Server Administration' started by yah0m, May 24, 2009.

  1. #1

    1.0 INSTALLING LITESPEED/PHP
    1.1 Installing LiteSpeed with CHRoot
    1. /usr/sbin/useradd -g HTTPD -s /bin/false LSWS
    2. mkdir -p /chroot/lsws
    3. cd /usr/src
    4. wget http://www.litespeedtech.com/packages/3.0/...86-linux.tar.gz
    5. tar -zxvf lsws-3.3.24-ent-i386-linux.tar.gz
    6. cd lsws-3.3.24
    7. (DOWNLOAD AND WGET A NEW trial.key)
    8. ./install.sh
      • Do you agree with above license? Yes
      • Destination [/opt/lsws]: /chroot/lsws
      • Chroot Path /chroot
      • User name [admin]: admin
      • Password: 123456 (change with your own admin password)
      • Retype password: 123456
      • User [nobody]: LSWS (use a non-system user that doesn't have a shell access and home directory)
      • Group [nobody]: HTTPD (group the webserver will be running as)
      • HTTP port [8088]: 80
      • Admin HTTP port [7080]: 7080
        Don't forget, both these ports should be enabled in the firewall
      • Setup up PHP [Y/n]: Y
      • Suffix for PHP script(comma separated list)
        : php
        [*]  Would you like to change PHP opcode cache setting [y/N]? N
        [*]  Would you like to install AWStats Add-on module [y/N]? N
        [*]  Would you like to import Apache configuration [y/N]? N
        [*]  Would you like to have LiteSpeed Web Server started automatically when the machine restarts [Y/n]? Y
        [*]  Would you like to start it right now [Y/n]? Y
        [/list]
        [/list][code]cd ..[/code][/indent]
        [indent][color="#FA8D4A"][size=3][b]1.2 Installing PHP for LiteSpeed[/b][/size][/color]
        [list=1]
        [*]wget [url="http://us2.php.net/get/php-5.2.9.tar.gz/from/us.php.net/mirror"]http://us2.php.net/get/php-5.2.9.tar.gz/fr....php.net/mirror[/url]
        [*]tar -zxvf php-5.2.9.tar.gz
        [b]MAIL PATCH[/b][indent][list]
        [*]cd /usr/src
        [*]wget [url="http://choon.net/opensource/php/php-5.2.9-mail-header.patch"]http://choon.net/opensource/php/php-5.2.9-mail-header.patch[/url]
        [*]cd php-5.2.9
        [*]patch -p1 < ../php-5.2.9-mail-header.patch
        [/list][/indent][b]SUHOSIN PATCH[/b][indent][list]
        [*]cd /usr/src
        [*]wget [url="http://download.suhosin.org/suhosin-patch-5.2.9-0.9.7.patch.gz"]http://download.suhosin.org/suhosin-patch-...-0.9.7.patch.gz[/url]
        [*]wget [url="http://download.suhosin.org/suhosin-0.9.27.tgz"]http://download.suhosin.org/suhosin-0.9.27.tgz[/url]
        [*]gunzip suhosin-patch-5.2.9-0.9.7.patch.gz
        [*]cd php-5.2.9
        [*]patch -p 1 -i ../suhosin-patch-5.2.9-0.9.7.patch
        [*]phpize
        [*]./configure 
        [*]make
        [*]make install
        [/list][/indent]
        [*]cd /usr/src/php-5.2.9/sapi
        [*]wget [url="http://www.litespeedtech.com/packages/lsapi/php-litespeed-4.9.tgz"]http://www.litespeedtech.com/packages/lsap...tespeed-4.9.tgz[/url]
        [*]tar -zxvf php-litespeed-4.9.tgz
        [*]cd ..
        [*]touch ac*
        [*]./buildconf --force[indent]-- IF ERROR ON ./buildconf:
        --------------------------
        install autoconf-2.13
        --------------------------
        wget [url="http://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz"]http://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz[/url]
        tar zfvx autoconf-2.13.tar.gz
        cd autoconf-2.13
        ./configure
        make
        make install
        cd ..
        ./buildconf --force[/indent]
        [/list]
        
        Depending on your install, you will need to install packages/sources. This list cover most of the common ones needed just so you don't get error on install.
        [code]yum install libxml2-devel openssl-devel bzip2-devel libcurl-devel libpng-devel libjpeg-devel libXpm-devel freetype-devel libc-client-devel libmcrypt-devel libmhash-devel imap-devel libxslt-devel pcre-devel aspell-devel net-snmp-devel libxml expat-devel[/code]
        
        The most important to make sure you include is --with-litespeed
        [code]./configure --enable-bcmath --enable-calendar --enable-dbase --enable-exif --enable-gd-native-ttf --enable-libxml --enable-ftp --enable-magic-quotes --enable-mbstring --enable-soap --enable-wddx --enable-zip --prefix=/usr/local --with-litespeed --with-config-file-path=/usr/local/lib --enable-suhosin --with-bz2 --with-curl=/opt/curlssl/ --with-curlwrappers --with-freetype-dir=/usr --with-gd --with-gettext --with-imap=/opt/php_with_imap_client/ --with-kerberos --with-imap-ssl=/usr --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-libexpat-dir=/usr --with-libxml-dir=/opt/xml2 --with-libxml-dir=/opt/xml2/ --with-mcrypt --with-mhash=/opt/mhash/ --with-mime-magic --with-mm --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl --enable-pdo=shared --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-sqlite=shared  --with-pic --with-png-dir=/usr --with-ttf --with-xmlrpc --with-xpm-dir=/usr --with-xsl=/opt/xslt/ --with-zlib --with-zlib-dir=/usr --with-pspell --with-pear --enable-sockets --with-snmp --enable-ucd-snmp-hack --with-tidy=/opt/tidy[/code]
        Compile and Install...
        [code]make
        make install[/code]
        
        Now that we have PHP done, lets get the new binary moved over:
        [list]
        [*]cd /opt/lsws/fcgi-bin
        [*]mv lsphp lsphp.old
        [*]cp /usr/src/php-5.2.9/sapi/litespeed/php ./lsphp
        [*](RESTART LSWS)
        [/list][/indent]
        
        [color="#555576"][size=5][b]2.0 CONFIGURING SERVICES[/b][/size][/color]
        [indent][color="#FA8D4A"][size=3][b]2.1 Configuring LiteSpeed with CHRoot[/b][/size][/color]
        Because we are running in a CHRoot Environment now, we need to copy over the needed binaries for PHP.
        [code]/chroot/lsws/admin/misc/chroot.sh /chroot/ /chroot/lsws/fcgi-bin/lsphp[/code]
        [/indent]
        [indent][color="#FA8D4A"][size=3][b]2.2 Configuring PHP for LSWS CHRoot[/b][/size][/color]
        [code]vim /chroot/lsws/usr/local/lib/php.ini[/code]
        Find the following and set the socket location...
        [code][MySQL]
        ...
        mysql.default_socket = /tmp/mysqld/mysqld.sock[/code]
        [/indent]
        [indent][color="#FA8D4A"][size=3][b]2.3 Configuring MySQL for LSWS CHRoot[/b][/size][/color]
        [code]vim /etc/my.cnf[/code]
        Find and edit MySQL so that it sets the sock in the CHRoot:
        [code][client]
        socket=/chroot/lsws/tmp/mysqld/mysqld.sock
        [mysqld]
        socket=/chroot/lsws/tmp/mysqld/mysqld.sock[/code]
        [/indent]
        PHP:

     
    yah0m, May 24, 2009 IP
  2. RAmoss

    RAmoss Guest

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    awesomeness thanks for this
     
    RAmoss, Jun 2, 2010 IP