linux安装Apache

本文详细介绍了如何使用m4、libtool、autoconf等工具升级开发包,然后安装MySQL-5.1.53、Apache-2.2.17和PHP-5.3.4,并配置相关服务,包括初始化数据库、修改配置文件和启动服务。
摘要由CSDN通过智能技术生成
 

一、开发包升级
 ## 对m4、libtool、autoconf、automake、pkg-config进行升级
 ## gnu libtool 搜索
 1、安装m4-1.4.15
  ## http://ftp.gnu.org/gnu/m4/
tar jxvf m4-1.4.15.tar.bz2
cd m4-1.4.15
./configure --prefix=/usr
make
make install
#make check
#make uninstall
#make clean
cd ..

2、安装libtool-2.4
 ## http://ftp.gnu.org/gnu/libtool/
tar zxvf libtool-2.4.tar.gz
cd libtool-2.4
./configure --prefix=/usr
make
make install
cd ..

3、安装autoconf-2.68
 ## http://ftp.gnu.org/gnu/autoconf/
tar jxvf autoconf-2.68.tar.bz2
cd autoconf-2.68
./configure --prefix=/usr
make
make install
cd ..

4、安装automake-1.11
 ## http://ftp.gnu.org/gnu/automake/
tar jxvf automake-1.11.tar.bz2
cd automake-1.11
./configure --prefix=/usr
make
make install
cd ..

5、安装libiconv-1.13.1
 ## http://ftp.gnu.org/gnu/libiconv/
tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr
make
make install
cd ..

6、安装pkg-config-0.25
 ## http://pkgconfig.freedesktop.org/releases/
tar zxvf pkg-config-0.25.tar.gz
cd pkg-config-0.25
./configure --prefix=/usr
make
make install
cd ..

二、安装MySQL-5.1.53
 ## ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.1/mysql-5.1.53.tar.gz
 
1、安装OpenSSL-1.0.0.tar.gz
 ## http://www.openssl.org/source/
tar zxvf openssl-1.0.0.tar.gz
cd openssl-1.0.0
./config --prefix=/usr shared zlib
make
make install
#make test
#make uninstall
#make clean
cd ..

2、安装mysql-5.1.53
 ## ftp://mirror.switch.ch/mirror/mysql/Downloads/
tar zxvf mysql-5.1.53.tar.gz
cd mysql-5.1.53
./configure --prefix=/usr/local/mysql5 --sharedstatedir=/usr/local/mysql5/data --with-mysqld-user=mysql --with-charset=gbk --with-extra-charsets=complex --enable-thread-safe-client --with-ssl --with-embedded-server --enable-local-infile --enable-assembler --with-plugins=innobase --with-plugins=partition
make
make install
cp support-files/mysql.server /etc/init.d/mysqld
cd ..

3、配置mysql-5.1.53
 ## 修改/etc/init.d/mysqld文件
      basedir=/usr/local/mysql5
      datadir=/usr/local/mysql5/data

 ## 建立用户mysql
groupadd mysql
useradd mysql -g mysql
 ## 设置权限
mkdir /usr/local/mysql5/data
chown -R root /usr/local/mysql5
chgrp -R mysql /usr/local/mysql5
chown -R mysql /usr/local/mysql5/data
chmod -R 777 /usr/local/mysql5/data
 ## 初始化数据库
/usr/local/mysql5/bin/mysql_install_db --user=mysql --ldata="/usr/local/mysql5/data"
/usr/local/mysql5/bin/mysqld_safe --user=mysql&
/usr/local/mysql5/bin/mysql
touch /tmp/mysql.sock    #先杀掉mysqld和mysqld_safe进程
/usr/local/mysql5/bin/mysqladmin -u root password '你的密码'  #MySQL设置密码

 ## 配置服务
mv /etc/my.cnf /etc/my.old
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
chkconfig --list mysqld
#chkconfig --del mysqld
#export PATH=$PATH:/usr/local/mysql5/bin

三、安装Apache-2.2.17
 ## http://httpd.apache.org
tar xjvf httpd-2.2.17.tar.bz2
cd httpd-2.2.17
./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most --with-mpm=worker --with-ssl --htmldir=/var/www/html
make
make install
cd ..

1、修改配置文件 httpd.conf
Listen 80

#DocumentRoot "/usr/local/apache/htdocs"
DocumentRoot "/var/www/html"

#<Directory "/usr/local/apache/htdocs">
<Directory "/var/www/html">
## 或上面不修改,在文件末尾添加下面内容,拷贝文件localhost.conf到vhosts目录下。
Include conf/vhosts/[^.#]*.conf

2、配置服务
cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
## 修改httpd文件,在文件头加入下面内容
#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  It is used to serve \
#              HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache2/logs/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf

## 添加服务
#chkconfig --del httpd
chkconfig --add httpd
chkconfig httpd on
chkconfig --list httpd
#chkconfig --level 35 httpd on
service httpd start       
#export PATH=$PATH:/usr/local/apache/bin

四、安装PHP-5.3.4
 ## http://php.net/downloads.php

 1、安装libpng-1.4.5
  ## ftp://ftp.simplesystems.org/pub/png/src/
tar xjvf libpng-1.4.5.tar.bz2
cd libpng-1.4.5
./configure --prefix=/usr
make
make install
cd ..

 2、安装jpegsrc.v8b
  ## http://www.ijg.org
tar zxvf jpegsrc.v8b.tar.gz
cd jpeg-8b
./configure --prefix=/usr --enable-shared --enable-static
make
make install
cd ..

 3、安装gd-2.0.35.tar.bz2
 ## http://www.libgd.org/releases/
tar xjvf gd-2.0.35.tar.bz2
cd gd-2.0.35
./configure --prefix=/usr --with-jpeg=/usr --with-freetype=/usr --with-png=/usr
make
make install
cd ..

4、安装libxml2-2.7.8.tar.gz
 ## ftp://xmlsoft.org/libxml2
tar zxvf libxml2-2.7.8.tar.gz
cd libxml2-2.7.8
./configure --prefix=/usr
make
make install
cd ..

5、安装curl-7.21.2
 ## http://curl.haxx.se/download.html
tar jxvf curl-7.21.2.tar.bz2
cd curl-7.21.2
./configure --prefix=/usr
make
make install
cd ..

6、安装libmcrypt-2.5.8
 ## http://sourceforge.net/projects/mcrypt/files/libmcrypt
tar jxvf libmcrypt-2.5.8.tar.bz2
cd libmcrypt-2.5.8
./configure --prefix=/usr
make
make install
cd ..

7、安装php-5.3.4
tar xjvf php-5.3.4.tar.bz2
cd php-5.3.4
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql5  --with-jpeg-dir=/usr --with-zlib-dir=/usr --with-png-dir=/usr --with-gd=/usr --with-curl=/usr --with-freetype-dir=/usr --enable-shared  --enable-mbstring=all --enable-mbregex --enable-ftp --with-mcrypt=/usr --with-mhash=/usr --enable-soap --with-config-file-path=/usr/local/php5 --with-openssl=/usr
make
make install
cd ..

 ## 修改Apache配置文件httpd.conf添加下面内容
LoadModule php5_module modules/libphp5.so
Addtype application/x-httpd-php .php .php3 .any_file_in_php
 
 ## 拷贝PHP源文件目录下的php.ini*到/usr/local/php5目录下
cp php.ini* /usr/local/php5

 ## 改名php.ini-production为php.ini
 ## 修改php.ini文件
 ## short_open_tag = Off 改为:short_open_tag = On          #支持<%  %>代替<%php %>       
 ## allow_call_time_pass_reference = Off 改为:allow_call_time_pass_reference = On
 ## ;date.timezone =  下面添加一行:date.timezone = "Asia/Shanghai"

 ## 删除下面中在";"号
 ## ;extension=php_gd2.dll
 ## ;extension=php_gettext.dll
 ## ;extension=php_mbstring.dll
 ## ;extension=php_mysql.dll
 ## ;extension=php_openssl.dll
 ## ;extension=php_xsl.dll

 

#### 最后重启Apache服务
service httpd stop
service httpd start
service httpd restart

**** 服务文件mysqld、httpd拷贝到/etc/init.d目录下
cp mysqld /etc/init.d/mysqld
cp httpd /etc/init.d/httpd
**** 配置文件php.ini、httpd.conf、localhost.conf拷贝到相应目录下
cp php.ini /usr/local/php5
cp httpd.conf /usr/local/apache2/conf/httpd.conf
cp localhost.conf /usr/local/apache2/conf/vhosts/localhost.conf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值