Linux/Centos安裝Litespeed+PHP+MYSQL+PHPMYADMIN教程

cnbird發表於2011-01-10

http://rootzone.net/zh-CN/setup-unmanaged-vps-with-litespeed-php-and-mysql/

http://www.wowtutorial.org/tutorial/2.html

http://www.blogtopsites.com/outpost/2418766d6534bb558e370c45336a41c4

本文教程非原創,採集眾家之長,綜合小夜(419.at)和vpsbeta.com兩家的測試使用所寫,本站現在用的就是Litespeed+PHP+MYSQL+PHPMYADMIN.

本站用的vps是

hostrail優惠後1.2美元每月256M記憶體的VPS

系統環境和程式版本介紹:

系統是 Centos 5 32bit

Litespeed 是官方提供的免費版本:lsws-4.0.17-std-i386-linux.tar.gz
Mysql 是 5.1.35版本
Php 升級使用的是 5.2.14版本

第一:

yum -y install yum-fastestmirror
yum -y update
yum -y remove httpd
yum -y install patch make gcc gcc-c++ gcc-g77 flex bison tar
yum -y install libtool libtool-libs kernel-devel autoconf213
yum -y install libjpeg libjpeg-devel libpng libpng-devel
yum -y install freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel
yum -y install file glib2 glib2-devel bzip2 diff* openldap-devel
yum -y install bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs
yum -y install e2fsprogs-devel krb5 krb5-devel libidn libidn-devel
yum -y install openssl openssl-devel vim-minimal unzip vixie-cron
yum -y install fonts-chinese scim-chewing scim-pinyin scim-tables-chinese
export PHP_AUTOCONF=/usr/bin/autoconf-2.13
export PHP_AUTOHEADER=/usr/bin/autoheader-2.13
wget -c http://dl.awlsh.com/litespeed/libiconv-1.13.1.tar.gz
tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1/
./configure –prefix=/usr/local
make
make install
cd ../
wget -c http://dl.awlsh.com/litespeed/libevent-1.4.14b-stable.tar.gz
tar zxvf libevent-1.4.14b-stable.tar.gz
cd libevent-1.4.14b-stable/
./configure –prefix=/usr
make
make install
cd ../
wget -c http://dl.awlsh.com/litespeed/libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure –enable-ltdl-install
make
make install
cd ../../
wget -c http://dl.awlsh.com/litespeed/mhash-0.9.9.9.tar.gz
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

wget -c http://dl.awlsh.com/litespeed/mcrypt-2.6.8.tar.gz
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
./configure
make
make install
cd ../
wget -c http://dl.awlsh.com/litespeed/google-perftools-1.6.tar.gz
tar zxvf  google-perftools-1.6.tar.gz
cd google-perftools-1.6/
./configure
make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
/sbin/ldconfig
cd ../

第2:安裝資料庫

tar -zxvf mysql-5.1.35.tar.gz
cd mysql-5.1.35
./configure –prefix=/usr/local/mysql –enable-assembler –with-charset=utf8 –enable-thread-safe-client –with-extra-charsets=all –with-big-tables –with-readline –with-ssl –with-embedded-server –enable-local-infile
make && make install
cd ../
groupadd mysql
useradd -g mysql mysql
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db –user=mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql/.
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
chkconfig –level 345 mysql on
echo “/usr/local/mysql/lib/mysql” >> /etc/ld.so.conf
echo “/usr/local/lib” >> /etc/ld.so.conf
ldconfig
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
/etc/init.d/mysql start
/usr/local/mysql/bin/mysqladmin -u root password 11111 (這個是資料庫密碼)
/etc/init.d/mysql restart
第3:安裝Litespeed

 

tar zxvf lsws-4.0.17-std-i386-linux.tar.gz
cd lsws-4.0.17
sh install.sh
(1).其中會出現授權協議,–More–<27%>這樣子,直接按空格翻頁即可。
Do you agree with abot license ? 輸入 Yes
(2)詢問litespeed安裝路徑?可直接回車預設
Destination [/usr/local/lsws]:/usr/local/litespeed
(3).輸入管理員使用者名稱,回車使用預設admin
User name [admin]:
二次重複管理員密碼。
(4)輸入管理員郵箱,回車使用預設:
Email address [root@localhost]:
(5).Litespeed啟動使用者及組,回車使用預設即可:
User [nobody]:
Group [nogroup]:
(6)輸入web服務埠,普通的網站服務為80。
HTTP PORT [8088]:80
(7) 是否安裝php,選擇y,然後預設即可,後臺有很多php版本選擇安裝:
Setup up PHP [Y/n]:Y
(8)是否安裝AWSatas,選n即可,說實話這個沒啥大用:
Would you like to install AWStats Add-on module [y/N]?N
(9)是否設定litespeed為開機自動啟動,這個要看個人選擇,小夜選Y:
Would you lite to have LiteSpeed Web Server started automatically
when the server restarts [Y/n]?Y
(10)安裝完成後,是否啟動,Y即可:
[OK] The startup script has been successfully installed!
Would you like to start it right now [Y/n]?
現在可以通過http://ip:7080/進入後臺管理
現在先不要關閉SSH連線,等啊還要用到.
第4:升級PHP版本到 5.2.14
1.登陸後臺 Actions 選單 Compile PHP
2.選擇5.2.14,點選後面的 next
在 Configure Parameters 項裡輸入下面程式碼,其它預設即可,Suhosin和Mail Header 都不要,需要eAccelerator 的可以選上,輸入下面的PHP功能元件,點 Build PHP 5.2.14
–with-litespeed –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config   –with-zlib –with-gd –enable-shmop –enable-track-vars –enable-sockets –enable-sysvsem –enable-sysvshm –enable-magic-quotes –enable-mbstring –with-iconv
3.千萬不要重新整理或其它操作,靜等出現提示資訊 Next 。
4.會給您一行程式碼,您需要在ssh裡面執行:
/usr/local/lsws/phpbuild/buildphp_manual_run.sh
5.如果一切順利,當你看到監視php編譯檢查的步驟提示 **COMPLETE** 的時候,那就已經OK了
6.點選選單 Actions 裡面的 Graceful Restart 重啟litespeed。您可以訪問 http://ip/phpinfo.php,如果確認顯示php資訊,則表示安裝成功
第5:安裝phpmyadmin
因為Litespeed 預設的web目錄 :

 

/usr/local/lsws/DEFAULT/html
所以進入其目錄:
cd /usr/local/lsws/DEFAULT/html/
下載 phpmyadmin,解壓
wget -c http://soft.vpser.net/datebase/phpmyadmin/phpmyadmin.tar.gz
tar zxvf phpmyadmin.tar.gz
最後通過訪問
http://ip/phpmyadmin/index.php來管理你的資料庫.

 

 


相關文章