L_AMP的安裝部署

LAMP的安裝部署

1. 準備相應軟件
apache
php
mysql
memcache擴展

2. 安裝mysql
groupadd mysql
useradd -g mysql mysql
tar -zxvf mysql-5.0.51b.tar.gz
進入mysql-5.0.51b目錄
cd mysql-5.0.51b
./configure --prefix=/usr/local/mysql --with-charset=utf8 --without-debug --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --disable-shared --with-mysqld-user=mysql --with-extra-charsets=gb2312,big5,gbk
make
make install
cp support-files/my-medium.cnf /etc/my.cnf
初始化數據庫
cd /usr/local/mysql
bin/mysql_install_db --user=mysql
修改mysql目錄權限
cd /usr/local/
chown -R mysql:mysql mysql
啓動數據庫
cd /usr/local/mysql
bin/mysqld_safe --user=mysql &

加入自動啓動服務
cd mysql-5.0.51b
cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 35 mysqld on



3. 安裝apache
將包加壓縮
tar -zxvf httpd-2.2.9.tar.gz
進入apache目錄
cd httpd-2.2.9
./configure --prefix=/usr/local/httpd --enable-modules=so --enable-rewrite
make
make install
useradd daemon
cd /usr/local/
chown -R daemon:daemon apache/
待會裝完php的時候再修改下 httpd.conf文件


4. 安裝php

將包解壓
tar -zxvf php-5.2.6.tar.gz
進入php的目錄
cd php-5.2.6
此處給了兩處編譯實例:
./configure  --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mime-magic --with-iconv --with-gd --with-jpeg-dir=/usr/lib --with-zlib-dir=/usr/lib --with-png-dir=/usr --with-png --enable-gd-native-ttf --with-jpeg --with-freetype-dir=/usr/lib --with-mysql=/usr/local/mysql --with-curl --enable-mbstring=all --with-xml --enable-track-vars --with-pdo-mysql=/usr/local/mysql
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mime-magic --with-iconv --with-gd --with-jpeg-dir=/usr/lib --with-zlib-dir=/usr/lib --with-png-dir=/usr --with-png --enable-gd-native-ttf --with-jpeg --with-freetype-dir=/usr/lib --with-mysql=/usr/local/mysql --with-curl --enable-mbstring=all --with-xml --enable-track-vars --with-pdo-mysql=/usr/local/mysql --enable-sockets --enable-shmop
make
make install

cp php.ini-dist /usr/local/php/lib/php.ini


5. 安裝memcache擴展
memcache擴展使php操作memcached服務器成爲可能.
1.首先下載安裝文件 ()
wget http://pecl.php.net/get/memcache-2.2.3.tgz
放在某個目錄下,然後
tar zxf memcache-2.2.3.tgz
cd memcache-2.2.3
2.安裝步驟
$ cd memcache-2.2.3
(這個是php/bin下的一個程序 爲安裝擴展準備環境的)
$ /usr/local/php/bin/phpize
$ ./configure --with-php-config=/usr/local/php/bin/php-config
$ make
# make install
3.配置php.ini
cd /usr/local/php/lib/
vi php.ini
1) 找到extension_dir = "./"
改爲extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613"
後面的值是你自己的那個路徑.基本是php/lib/php/extensions/no-debug-non-zts-20060613這個
2) 找到Dynamic Extensions這部分
添加一行 extension=memcache.so 然後保存退出編輯.

4. 重起apache,然後就ok了.


6. 修改apache配置文件

LoadModule php5_module        modules/libphp5.so
PHPIniDir "/usr/local/php/lib"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order allow,Deny
    allow from all
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

AddType application/x-httpd-php .php

重啓Apache時若出現
httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied

則執行命令:chcon -t texrel_shlib_t /usr/local/apache/modules/libphp5.so

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章