日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

VPS上安裝LAMP(Linux+Apache+MySQL+PHP)步驟_Web服務(wù)器教程

編輯Tag賺U幣
教程Tag:vps添加
最近買了個(gè)VPS,128M內(nèi)存,8G硬盤,CentOS5操作系統(tǒng),系統(tǒng)初始化后,內(nèi)存使用情況如下:
                    total       used       free     shared    buffers     cached
Mem:        131232      62872      68360          0      11384      37688
硬盤使用情況如下:
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1              8256952    626932   7210592   8% /

好可憐的內(nèi)存,為此,只好盡量少在上面裝東西,什么ftp、什么pptp都省得裝了。只在上面裝了LAMP,分享安裝步驟如下。

先安裝基本編譯程序
yum install gcc
yum install make


下載LAMP需要用到的包
MySQL-client-community-5.1.41-0.rhel5.i386.rpm
MySQL-devel-community-5.1.41-0.rhel5.i386.rpm
MySQL-server-community-5.1.41-0.rhel5.i386.rpm
gd-2.0.35.tar.gz
httpd-2.2.14.tar.gz
libpng-1.2.41.tar.gz
libxml2-2.7.6.tar.gz
php-5.3.1.tar.gz
zlib-1.2.3.tar.gz
由于編譯mysql時(shí)不大順利,需要其他包,故沒有用源碼編譯安裝,用的是rpm安裝安

安裝Apache
./configure --prefix=/usr/local/httpd --enable-module=so --enable-rewrite
make
make install
加入啟動(dòng)項(xiàng),使其隨機(jī)啟動(dòng)(由于沒有安裝chkconfig,所以沒有用添加服務(wù)的方式)
在/etc/rc.d/rc.local中增加啟動(dòng)apache的命令,例如:/usr/local/httpd/bin/apachectl -k start


安裝PHP基本支持庫
libxml2
zlib
ligpng
gd
基本都是按如下流程編譯安裝,但注意安裝的順序:
cd source-path
./configure
make
make install


MySQL rpm包安裝
rpm -ivh MySQL-server-community-5.1.41-0.rhel5.i386.rpm #服務(wù)端
rpm -ivh MySQL-client-community-5.1.41-0.rhel5.i386.rpm #客戶端
rpm -ivh MySQL-devel-community-5.1.41-0.rhel5.i386.rpm #PHP編譯時(shí)需要用到
復(fù)制配置文件
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

編譯安裝PHP5
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-gd=/usr/local  --with-mysql --with-libxml-dir --with-png-dir --with-pear=/usr/local/php/pear --enable-mbstring --with-config-file-path=/usr/local/php/ --disable-debug --enable-safe-mode
make
make install
cp php.ini-production /usr/local/php/php.ini #復(fù)制php配置文件到設(shè)定的目錄
如果不需要支持pear,可以去掉 --with-pear=/usr/local/php/pear 

接下來就可以配置LAMP了,想關(guān)配置文件如下
PHP配置文件:/usr/local/php/php.ini
Apache主配置文件:/usr/local/httpd/conf/httpd.conf
MySQL配置文件:/etc/my.cnf

相關(guān)啟動(dòng)命令
service mysql start|stop|restart
/usr/local/httpd/bin/apachectl -k start|stop|restart

以上如有不明或遺漏或有更好的方案,請(qǐng)不惜鍵盤,給我留言,謝謝。
聽說LNMP(Linux+Nginx+MySQL+PHP)比較省內(nèi)存,下次想試試。

來源:網(wǎng)絡(luò)搜集//所屬分類:Web服務(wù)器教程/更新時(shí)間:2013-04-13
相關(guān)Web服務(wù)器教程