實戰(zhàn) LAMP 服務(wù)器配置 完整篇
更新時間:2009年06月01日 16:25:39 作者:
LAMP 服務(wù)器配置 按部就班篇,大家可以學(xué)習(xí)試試。
安裝zlib
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib2
make
make install
安裝libpng
tar zxvf libpng-1.2.10.tar.gz
cd libpng-1.2.10
./configure --prefix=/usr/local/libpng
make
make install
安裝freetype
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local/freetype
make
make install
安裝Jpeg
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir /usr/local/jpeg6/man
mkdir /usr/local/jpeg6/man/man1
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6 --enable-shared
make
make install
安裝GD
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr/local/gd2 --with-zlib=/usr/local/zlib2/ --with-png=/usr/local/libpng/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype/
make
(在make時可能會是出現(xiàn)以下錯誤:
cd . && /bin/sh /root/gd-2.0.35/config/missing --run aclocal-1.9 -I config
aclocal:configure.ac:64: warning: macro `AM_ICONV' not found in library
cd . && /bin/sh /root/gd-2.0.35/config/missing --run automake-1.9 --foreign
cd . && /bin/sh /root/gd-2.0.35/config/missing --run autoconf
configure.ac:64: error: possibly undefined macro: AM_ICONV
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
make: *** [configure] Error 1
把報錯信息“configure.ac:64: error: possibly undefined macro: AM_ICONV”拿到google里搜索,得到“But you need to have gettext”沒有g(shù)ettext這個包。
然后直接運行:yum install gettext 在做make 就好了[解決方法是在:把warning: macro `AM_ICONV' not found in library 復(fù)制到google中找到這個地址http://sery.blog.51cto.com/10037/50892]
)
安裝mysql
groupadd mysql // 建立mysql組
useradd mysql -g mysql //建立mysql用戶并且加入到mysql組中
tar zxvf mysql-5.0.16.tar.gz //解壓縮
cd mysql-5.0.16 //進(jìn)入解開包的目錄
./configure --prefix=/usr/local/mysql --with-charset=gbk --with-extra-charsets=gbk,gb2312 --enable-thread-safe-client
make
make install
cd scripts //進(jìn)入到腳本目錄下
./mysql_install_db --user=mysql //安裝庫文件,應(yīng)該會提示說OK!的。
cd /usr/local/mysql //進(jìn)入到安裝的mysql軟件目錄中
chown -R root . //設(shè)定root能訪問/usr/local/mysql
chown -R mysql var //設(shè)定mysql用戶能訪問/usr/local/mysql/var ,里面存的是mysql的數(shù)據(jù)庫文件.這個目錄是在/etc/my.cnf中有配置,在mysql_install_db時產(chǎn)生。
chown -R mysql var/ . //設(shè)定mysql用戶能訪問/usr/local/mysql/var/mysql下的所有文件
chgrp -R mysql . //設(shè)定mysql組能夠訪問/usr/local/mysql
# 上面的已經(jīng)把mysql完全安裝完了,也能正常使用了,但還不夠,你要將mysql的數(shù)據(jù)庫啟動腳本加入系統(tǒng)啟動目錄
cd /usr/local/mysql/lib/mysql/
ln -s libmysqlclient.so.15.0.0 libmysqlclient_r.so
cp /tmp/mysql-5.0.16/support-files/my-huge.cnf /etc/my.cnf
cp /tmp/mysql-5.0.16/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/rc.d/init.d/mysqld
ln -s /etc/rc.d/init.d/mysqld /etc/rc.d/rc3.d/mysqld
/etc/rc.d/init.d/mysqld start //來啟動mysql進(jìn)程
安裝apache
tar zxvf httpd-2.2.11.tar.gz
cd httpd-2.2.11
./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-ssl
make
make install
安裝完畢后, 使用如下命令啟動APACHE /usr/local/apache2/bin/apachectl start
安裝PHP
tar zxvf php-5.2.6.tar.gz
cd php-5-2.6
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php/etc --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/libpng/ --with-gd=/usr/local/gd2/ --with-freetype-dir=/usr/local/freetype/ --enable-trace-vars --with-zlib-dir=/usr/local/zlib2/
make
make install
將APACHE支持 .PHP
編輯APACHE配置 vi /var/apache/conf/httpd.conf
搜索 AddType 找到類似AddType application/x-compress .Z
在其下增加一行
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
重啟apache時候,出現(xiàn)以下信息:
[root@miix htdocs]# apachectl -k restart
httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
這是由于selinux引起的,所以需要這樣一下:
chcon -t textrel_shlib_t libphp5.so
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib2
make
make install
安裝libpng
tar zxvf libpng-1.2.10.tar.gz
cd libpng-1.2.10
./configure --prefix=/usr/local/libpng
make
make install
安裝freetype
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local/freetype
make
make install
安裝Jpeg
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir /usr/local/jpeg6/man
mkdir /usr/local/jpeg6/man/man1
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6 --enable-shared
make
make install
安裝GD
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr/local/gd2 --with-zlib=/usr/local/zlib2/ --with-png=/usr/local/libpng/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype/
make
(在make時可能會是出現(xiàn)以下錯誤:
cd . && /bin/sh /root/gd-2.0.35/config/missing --run aclocal-1.9 -I config
aclocal:configure.ac:64: warning: macro `AM_ICONV' not found in library
cd . && /bin/sh /root/gd-2.0.35/config/missing --run automake-1.9 --foreign
cd . && /bin/sh /root/gd-2.0.35/config/missing --run autoconf
configure.ac:64: error: possibly undefined macro: AM_ICONV
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
make: *** [configure] Error 1
把報錯信息“configure.ac:64: error: possibly undefined macro: AM_ICONV”拿到google里搜索,得到“But you need to have gettext”沒有g(shù)ettext這個包。
然后直接運行:yum install gettext 在做make 就好了[解決方法是在:把warning: macro `AM_ICONV' not found in library 復(fù)制到google中找到這個地址http://sery.blog.51cto.com/10037/50892]
)
安裝mysql
groupadd mysql // 建立mysql組
useradd mysql -g mysql //建立mysql用戶并且加入到mysql組中
tar zxvf mysql-5.0.16.tar.gz //解壓縮
cd mysql-5.0.16 //進(jìn)入解開包的目錄
./configure --prefix=/usr/local/mysql --with-charset=gbk --with-extra-charsets=gbk,gb2312 --enable-thread-safe-client
make
make install
cd scripts //進(jìn)入到腳本目錄下
./mysql_install_db --user=mysql //安裝庫文件,應(yīng)該會提示說OK!的。
cd /usr/local/mysql //進(jìn)入到安裝的mysql軟件目錄中
chown -R root . //設(shè)定root能訪問/usr/local/mysql
chown -R mysql var //設(shè)定mysql用戶能訪問/usr/local/mysql/var ,里面存的是mysql的數(shù)據(jù)庫文件.這個目錄是在/etc/my.cnf中有配置,在mysql_install_db時產(chǎn)生。
chown -R mysql var/ . //設(shè)定mysql用戶能訪問/usr/local/mysql/var/mysql下的所有文件
chgrp -R mysql . //設(shè)定mysql組能夠訪問/usr/local/mysql
# 上面的已經(jīng)把mysql完全安裝完了,也能正常使用了,但還不夠,你要將mysql的數(shù)據(jù)庫啟動腳本加入系統(tǒng)啟動目錄
cd /usr/local/mysql/lib/mysql/
ln -s libmysqlclient.so.15.0.0 libmysqlclient_r.so
cp /tmp/mysql-5.0.16/support-files/my-huge.cnf /etc/my.cnf
cp /tmp/mysql-5.0.16/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/rc.d/init.d/mysqld
ln -s /etc/rc.d/init.d/mysqld /etc/rc.d/rc3.d/mysqld
/etc/rc.d/init.d/mysqld start //來啟動mysql進(jìn)程
安裝apache
tar zxvf httpd-2.2.11.tar.gz
cd httpd-2.2.11
./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-ssl
make
make install
安裝完畢后, 使用如下命令啟動APACHE /usr/local/apache2/bin/apachectl start
安裝PHP
tar zxvf php-5.2.6.tar.gz
cd php-5-2.6
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php/etc --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/libpng/ --with-gd=/usr/local/gd2/ --with-freetype-dir=/usr/local/freetype/ --enable-trace-vars --with-zlib-dir=/usr/local/zlib2/
make
make install
將APACHE支持 .PHP
編輯APACHE配置 vi /var/apache/conf/httpd.conf
搜索 AddType 找到類似AddType application/x-compress .Z
在其下增加一行
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
重啟apache時候,出現(xiàn)以下信息:
[root@miix htdocs]# apachectl -k restart
httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
這是由于selinux引起的,所以需要這樣一下:
chcon -t textrel_shlib_t libphp5.so
相關(guān)文章
Linux上為你的任務(wù)創(chuàng)建一個自定義的系統(tǒng)托盤指示器
系統(tǒng)托盤圖標(biāo)如今仍是一個很神奇的功能。這篇文章主要介紹了Linux上為你的任務(wù)創(chuàng)建一個自定義的系統(tǒng)托盤指示器,需要的朋友可以參考下2019-07-07詳解 MAC/Linux Vi配置環(huán)境變量及Java環(huán)境變量配置
這篇文章主要介紹了詳解 MAC/Linux Vi配置環(huán)境變量及Java環(huán)境變量配置的相關(guān)資料,需要的朋友可以參考下2017-06-06關(guān)于Ubuntu系統(tǒng)常見問題及解決辦法
這篇文章主要介紹了關(guān)于Ubuntu系統(tǒng)常見問題及解決辦法,Ubuntu是linux系統(tǒng)的一種,在剛開始使用是會碰到各種各樣的問題,本文列舉了一些常見的問題,需要的朋友可以參考下2023-03-03Ubuntu下圖形化LAMP環(huán)境配置教程(linux)
這篇文章主要為大家詳細(xì)介紹了Ubuntu下圖形化LAMP環(huán)境配置,感興趣的小伙伴們可以參考一下2016-06-06Centos 6.5 下配置DNS服務(wù)器的方法(圖文詳解)
這篇文章主要介紹了Centos 6.5 下配置DNS服務(wù)器的方法詳解,需要的朋友可以參考下2017-05-05如何在Ubuntu 18.04(實體機(jī))上配置OpenWRT的開發(fā)環(huán)境
這篇文章主要介紹了如何在Ubuntu 18.04(實體機(jī))上配置OpenWRT的開發(fā)環(huán)境,本文通過圖文并茂的形式給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-07-07