glibc-devel
glibc-headers
kernel-headers
libgomp
gcc-c++
libstdc++-devel
zlib-1.2.5.tar.gz
shell> cd /home/shuhua/tar
shell> tar –zxvf zlib-1.2.5.tar.gz
shell> cd zlib-1.2.5
shell> ./configure //這個配置編譯命令不要加目錄參數(shù)
shell>make && make install
shell> cd /home/shuhua/tar
shell> tar -jxvf httpd-2.2.19.tar.bz2
shell> cd httpd-2.2.19
shell>./configure --PRefix=/usr/local/http2 /
--enable-modules=all /
--enable-rewrite /
--enable-mods-shared=all /
--enable-so
shell> make && make install
#啟動Apache
shell> /usr/local/http2/bin/apachectl start
#測試apache
瀏覽器打開: http://虛擬機ip
看到 "it works!",即為成功
配置虛擬主機
1)配置host文件
打開C:/windows/system32/drivers/etc/hosts 文件
增加域名記錄
如:
192.168.1.246 www.ec1.com
192.168.1.246 www.ec2.com
2) 增加虛擬主機
vi /usr/local/http2/conf/httpd.conf
取消#Include conf/extra/httpd-vhosts.conf
這一行前面的#號
保存退出
vi /usr/local/http2/conf/extra/httpd-vhosts.conf
增加虛擬主機記錄
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/usr/local/http2/htdocs/ec1"
ServerName www.ec1.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/usr/local/http2/htdocs/ec2"
ServerName www.ec2.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
3)
shell> cd /usr/local/http2/htdocs
shell> mkdir ec1 ec2
shell> echo this is ec1.com > ec1/index.html
shell> echo this is ec2.com > ec2/index.html
4)重啟apache
/usr/local/http2/bin/apachectl restart
5)瀏覽器打開www.ec1.com,和www.ec2.com
看到不同的網(wǎng)站內(nèi)容,虛擬主機創(chuàng)建完畢!
安裝圖形庫,為編譯php做準備
libxml2-2.7.2.tar.gz
jpegsrc.v8b.tar.gz
libpng-1.4.3.tar.gz
freetype-2.4.1.tar.gz
gd-2.0.35.tar.gz
(四) 安裝libxml2
shell> cd /home/shuhua/tar
shell> tar zxvf libxml2-2.7.2.tar.gz
shell> cd libxml2-2.7.2
shell>./configure --prefix=/usr/local/libxml2
shell> make && make install
(五) 安裝jpeg8
shell> cd /home/shuhua/tar
shell> tar -zxvf jpegsrc.v8b.tar.gz
shell> cd jpeg-8b
shell>./configure --prefix=/usr/local/jpeg /
--enable-shared --enable-static
shell> make && make install
(六) 安裝libpng
shell> cd /home/shuhua/tar
shell> tar zxvf libpng-1.4.3.tar.gz
shell> cd libpng-1.4.3
shell>./configure #和zlib一樣不要帶參數(shù),讓它默認安裝到相應(yīng)目錄
shell> make && make install
(七) 安裝freetype
shell> cd /home/shuhua/tar
shell> tar zxvf freetype-2.4.1.tar.gz
shell> cd freetype-2.4.1
shell>./configure --prefix=/usr/local/freetype
shell> make && make install
(八) 安裝GD庫
shell> cd /home/shuhua/tar
shell> tar -zvxf gd-2.0.35.tar.gz
shell> mkdir -p /usr/local/gd
shell> cd gd-2.0.35
shell>./configure --prefix=/usr/local/gd /
--with-jpeg=/usr/local/jpeg/ /
--with-png --with-zlib /
--with-freetype=/usr/local/freetype
shell> make && make install
(九) 安裝 php5
shell> cd /home/shuhua/tar
shell> tar -jxvf php-5.3.6.tar.bz
shell> cd php-5.3.6
shell>./configure --prefix=/usr/local/php /
--with-apxs2=/usr/local/http2/bin/apxs /
--with-MySQL=mysqlnd /
--with-pdo-mysql=mysqlnd /
--with-mysqli=mysqlnd /
--with-freetype-dir=/usr/local/freetype /
--with-gd=/usr/local/gd /
--with-zlib --with-libxml-dir=/usr/local/libxml2 /
--with-jpeg-dir=/usr/local/jpeg /
--with-png-dir /
--enable-mbstring=all /
--enable-mbregex /
--enable-shared
shell> make && make install
shell> cp php.ini-development /usr/local/php/lib/php.ini
配置Apache使其支持php
vi /usr/local/http2/conf/httpd.conf
1) 在httpd.conf(Apache主配置文件)中增加:
AddType application/x-httpd-php .php
2) 找到下面這段話:
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
在index.html 前面添加index.php
3) 建立php測試網(wǎng)頁
vi /usr/local/apache2/htdocs/index.php
輸入如下內(nèi)容:
<?php
phpinfo();
?>
4) 重啟apache
shell> /usr/local/http2/bin/apachectl restart
5) 再次瀏覽器查看http://虛擬機IP
如果看到php信息,工作就完成了!
(十) 安裝MySQL
1) 編譯安裝MySQL
shell> cd /home/shuhua/tar
shell> tar -xzvf mysql-5.1.30.tar.gz
shell> cd mysql-5.1.58
shell> ./configure --prefix=/usr/local/mysql /
--with-charset=utf8 /
--with-extra-charsets=gbk,gb2312,binary
shell> mount .....掛載光盤
shell>rpm -ivh libtermcap-devel-2.0.8-46....
shell> make && make install
2) 配置并初始化MySQL
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cp support-files/my-medium.cnf/etc/my.cnf
shell> cd /usr/local/mysql
shell> chown -R mysql.mysql .
shell> bin/mysql_install_db --user=mysql /
--datadir=/usr/local/mysql/var
shell> chown -R root .
shell> chown -R mysql var
shell> bin/mysqld_safe --user=mysql &
3) 測試數(shù)據(jù)庫
shell>bin/mysql –uroot
mysql> showdatabases;
4) 接上步,修改mysql密碼(可不做此步,默認無密碼)
mysql>UPDATEuser SET
passWord=PASSWORD('new_password')
WHEREuser='root';
mysql>flushprivileges;
新聞熱點
疑難解答
圖片精選