Debian系統一直是受大家喜歡的Linux分枝,最小化的系統佔用系統資源非常的少,而且操作起來也很簡單。之前陸陸續續的折騰了一下LiteSpeed,最近就把一些手動安裝的心得貼出來和大家分享吧,如果實在懶得動腦,可以參考之前的文章,使用llsmp一鍵安裝包。下面開始安裝!
- 清理Debian,去除不必要的軟件包
- 安裝MySQL及相關的庫文件
- 安裝LiteSpeed
- 編譯PHP
- 配置eAccelerator
- 安裝Zend Loader
1.清理Debian,去除不必要的軟件包
apt-get update
apt-get -y purge apache2-* bind9-* xinetd samba-* nscd-* portmap sendmail-* sasl2-bin
apt-get -y purge lynx memtester unixodbc python-* odbcinst-* sudo tcpdump ttf-*
apt-get autoremove && apt-get clean
2.安裝MySQL及相關的庫文件
apt-get remove apache
apt-get update
apt-get upgrade
apt-get install autoconf gcc g++ libjpeg62-dev libpng12-dev libxml2-dev curl libcurl4-openSSL-dev libmcrypt-dev libmhash-dev libfreetype6-dev patch make mcrypt mysql-server libmysql++-dev zlib-bin zlib1g-dev
設置autoconf
export PHP_AUTOCONF=/usr/bin/autoconf
export PHP_AUTOHEADER=/usr/bin/autoheader
安裝時中途會詢問MySQL的密碼,連續輸入兩次即可
3.安裝LiteSpeed
訪問LiteSpeed官網獲得最新版本的下載鏈接:http://litespeedtech.com/litespeed-web-server-downloads.html
cd /tmp
wget http://litespeedtech.com/packages/4.0/lsws-4.1.13-std-i386-linux.tar.gz
tar zxvf lsws*
cd lsws*
sh ./install.sh
出現許可協議,只需持續按下【空格】鍵到最後,輸入Yes(注意Y大寫)
交互回答如下問題
Destination [/usr/local/lsws]: 回車
User Name [admin]:管理員賬號(默認admin)
Password:管理員密碼
Retype password:密碼確認
Email addresses [root@localhost]:你的郵箱
User [nobody]:默認,直接回車
Group [nogroup]:默認,直接回車
HTTP port [8088]:寫80
Admin HTTP port [7080]:Litespeed面板端口,可默認,直接Enter
Setup up PHP [Y/n]:默認,直接回車
Suffix for PHP script(comma separated list) [php]:默認,直接回車
Would you like to install AWStats Add-on module [y/N]?默認,直接回車
Would you like to have LiteSpeed Web Server started automatically when the server restarts [Y/n]?默認,直接回車
Would you like to start it right now [Y/n]?默認,直接回車
此時不要關閉SSH窗口,後面還要用到~
4.編譯PHP
訪問litespeed管理後台:http://ip:7080
點擊Actions->Compile PHP
選擇PHP版本,點擊Next(我選擇的是5.3.15)
在編譯參數中填寫為如下段,
‘–with-pdo-mysql’ ‘–with-mysql’ ‘–with-mysqli’ ‘–with-zlib’ ‘–with-gd’ ‘–enable-shmop’ ‘–enable-track-vars’ ‘–enable-sockets’ ‘–enable-sysvsem’ ‘–enable-sysvshm’ ‘–enable-magic-quotes’ ‘–enable-mbstring’ ‘–with-iconv’ ‘–with-litespeed’ ‘–enable-inline-optimization’ ‘–with-curl’ ‘–with-curlwrappers’ ‘–with-mcrypt’ ‘–with-mhash’ ‘–with-mime-magic’ ‘–with-openssl’ ‘–with-freetype-dir=/usr/lib’ ‘–with-jpeg-dir=/usr/lib’
小內存VPS在編譯的時候,會出現內存不夠的問題”virtual memory exhausted: Cannot allocate memory”,此時在參數欄處再上如下參數,重新編譯一下應該就OK了~
–disable-fileinfo
下面可選安裝組件,我只選擇了eAccelerator;
點擊Build PHP 5.x.x
LiteSpeed開始下載包,下載完成後,點擊Next
此時不要刷新頁面!
在SSH運行如下命令:
/usr/local/lsws/phpbuild/buildphp_manual_run.sh
直到瀏覽器提示”*Complete*”就算是大功告成了~
5.配置eAccelerator
PHP雖然安裝好了,但之前我們選擇的eAccelerator還需要配置一下
創建eAccelerator的緩存目錄
mkdir /usr/local/eaccelerator_cache
chmod -R 777 /usr/local/eaccelerator_cache
編輯php.ini
cp /usr/local/lsws/php/php.ini /usr/local/lsws/lsphp5/lib/
vi /usr/local/lsws/lsphp5/lib/php.ini
在php.ini後面加入如下字段
[eaccelerator]
zend_extension=”/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so”
eaccelerator.shm_size=”1″
eaccelerator.cache_dir=”/usr/local/eaccelerator_cache”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=””
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”3600″
eaccelerator.shm_prune_period=”3600″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″
eaccelerator.keys = “disk_only”
eaccelerator.sessions = “disk_only”
eaccelerator.content = “disk_only”
這時,可以打開http://ip/phpinfo.php看看eAccelerator安裝的如何~
6.安裝Zend Loader
wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
tar zxvf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
mkdir -p /usr/local/zend/
cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so /usr/local/zend/
編輯php.ini
vi /usr/local/lsws/lsphp5/lib/php.ini
添加如下字段
[Zend.loader]
zend_loader.enable=1
zend_loader.disable_licensing=1
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
zend_extension=”/usr/local/zend/ZendGuardLoader.so”
查看是否安裝成功
/usr/local/lsws/lsphp5/bin/php -v
最後重啟litespeed生效~
/etc/init.d/lsws restart
環境基本配置好了,但是要使用還需要添加虛擬主機等一系列的步驟和過程,在日後的教程中和大家分享~