Linux下Apache2.2.9 PHP5.28 MySQL5.1.30安装配置

下载相应文件包,按下面步骤可直接成功安装。但是要注意是否安装有编译支持的语言。

安装mysql-5.1.30
tar zxvf mysql-5.1.30.tar.gz
cd mysql-5.1.30
mkdir /usr/local/mysql
mv * /usr/local/mysql
groupadd mysql
useradd -d /usr/local/mysql/data -s /sbin/nologin/ -g mysql mysql
cd /usr/local/mysql
chown -R root .
chown -R mysql data
chown -R mysql .

./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static

./scripts/mysql_install_db --user=mysql   
./bin/mysqld_safe  --user=mysql &        
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld

#########
安装 zlib-1.2.3
tar zxvf zlib-1.2.3.tar.gz
cd  zlib-1.2.3
./configure --prefix=/usr/local/zlib
make
make install

##########
安装apache2.2.9
tar zxvf httpd-2.2.11.tar.gz
cd httpd-2.2.11
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-track-vars --enable-rewrite --enable-proxy --enable-proxy-connect --enable-mem-cache --enable-disk-cache --enable-cache --enable-vhost-alias --with-zlib-dir=/usr/local/zlib

make
make install

设置当linux启动时也同时启动apache
echo “/usr/local/apache/bin/apachectl start “>>/etc/rc.d/rc.local

###########
接着安装GD模块以及模块扩展库,以便生成图片时可以生成相关格式的图片文件
安装 libpng-1.2.8
tar zxvf libpng-1.2.8-config.tar.gz
cd  libpng-1.2.8-config
cp  scripts/makefile.linux makefile
make
make install

############
安装freetype-2.1.10
tar zxvf freetype-2.1.10.tar.gz
cd  freetype-2.1.10
mkdir -p /usr/local/freetype
./configure --prefix=/usr/local/freetype
make;make install

安装jpegsrc.v6b
用于生成jpeg格式图片  jpeg 不会自建目录 因此要手动建立
mkdir -p /usr/local/jpeg6
mkdir -p /usr/local/jpeg6/bin
mkdir -p /usr/local/jpeg6/lib
mkdir -p /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man
mkdir -p /usr/local/jpeg6/manl
mkdir -p /usr/local/jpeg6/man/manl
开始安装
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b                                                        
./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static         
make
make install
make install-lib

############
安装libxml
tar zxvf libxml2-2.6.31.tar.gz
cd libxml2-2.6.31
mkdir -p /usr/local/libxml2
./configure --prefix=/usr/local/libxml2
make;
make install
cp xml2-config /usr/bin

############
安装GD-2.0.33
tar zxvf gd-2.0.33.tar.gz
mkdir -p /usr/local/gd
cd gd-2.0.33                                                              
./configure --prefix=/usr/local/gd/ --with-png=/usr/local/lib --with-jpeg=/usr/local/jpeg6 --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype  
make;make install

############
安装libevent-1.4.9-stable
cd libevent-1.4.9-stable
./configure --prefix=/usr
make
make install

############
安装dbcached-1.0.beta2
tar zxvf dbcached-1.0.beta2.tar.gz
cd dbcached-1.0.beta2
./configure --prefix=/usr/local/dbcached --with-libevent=/usr/local/libevent
make
make install
############
安装qdbm-1.8.77.tar.gz
tar zxvf qdbm-1.8.77.tar.gz
cd qdbm-1.8.77
./configure --prefix=/usr

make
make install
############
############
安装nmdb-0.21.tar.gz
tar zxvf nmdb-0.21.tar.gz
cd nmdb-0.21
make BACKEND=qdbm ENABLE_TIPC=0 ENABLE_SCTP=0 install

作为守护进程运行
/usr/local/bin/nmdb -d /var/dbcached.db -t 26010 -T 192.168.1.188 -u 26010 -U 192.168.1.188 -c 1024

 

安装php 5.2.8
tar zxvf php-5.2.8.tar.gz
mkdir -p /usr/local/php
cd php-5.2.8                                                              
./configure --prefix=/usr/local/php /
 --with-apxs2=/usr/local/apache/bin/apxs /
 --with-libxml-dir=/usr/local/libxml2 /
 --with-png-dir=/usr/local/lib /
 --with-jpeg-dir=/usr/local/jpeg6 /
 --with-zlib=/usr/local/zlib /
 --with-freetype-dir=/usr/local/freetype /
 --with-gd=/usr/local/gd /
 --with-mysql=/usr/local/mysql /
 --with-mysqli=/usr/local/mysql/bin/mysql_config /
 --with-pdo-mysql=/usr/local/mysql /
 --with-qdbm=/usr /
 --enable-soap /
 --enable-mbstring=all /
 --enable-shmop /
 --enable-json /
 --disable-short-tags

 make
 make install
cp php.ini-dist /usr/local/php/lib/php.ini
chmod -R 755 /usr/local/apache/htdocs
chcon  /usr/local/apache/modules/libphp5.so  -t shlib_t
编辑apache 配置文件httpd.conf.
vi /etc/httpd/httpd.conf
修改以下几处
找到 LoadModule php5_module modules/libphp5.so 去掉前面的#号
在” AddType application/x-gzip.gz.tgz  .php”下加入
 AddType application/x-httpd-php  .php
找到Directory Index.html 后加上 “  空格+ index.php ” ,把index.php设为默认页

到这里已经完成Apache2服务器的安装 启动Apache2服务器
/usr/local/apache/bin/apachectl start
停止Apache Web服务器命令
/usr/local/apache/bin/apachectl stop

 

 

 

 

 

 

系统断电 坏了  郁闷 重装:

 

适用redhat于32位及64位,前提架设好本地源。在这里不再赘述。

1 安装Apache+php+Mysql

a、安装Apahce, PHP, Mysql, 以及php连接mysql库组件 yum -y install httpd php mysql mysql-server php-

mysql

b、安装mysql扩展    yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql

或一次性粘贴安装:

yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql

php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-

devel libdbi-dbd-mysql php-dom php-gd

安装pgsql
#yum -y install postgresql
    #yum -y install postgresql-server
    #yum -y install postgresql-devel /*devel同上*/
 
yum -y install postgresql  postgresql-server  postgresql-devel php-pgsql
   配置PostgreSQL远程连接:
   #vim /var/lib/pgsql/data/postgresql.conf
    寻找到下面内容并把前面的"#"去掉
    listen_addresses = 'localhost'
    port = 5432
    把'localhost'换成本机IP.
  #vim /var/lib/pgsql/data/pg_hba.conf
    在# IPv4 local connections:下面添加一条客户端IP内容
     host    all         all         192.168.1.104/32        md5

  yum -y install php-pgsql


c、设置mysql数据库root帐号密码。
mysqladmin -u root password ‘newpassword’ [引号内填密码]

d、 让mysql数据库更安全
mysql -u root -p [此时会要求你输入刚刚设置的密码,输入后回车即可

mysql> DROP DATABASE test; [删除test数据库]
mysql> DELETE FROM mysql.user WHERE user = ”; [删除匿名帐户]
mysql> FLUSH PRIVILEGES; [重载权限]

e、 按照以上的安装方式, 配置出来的默认站点目录为/var/www/html/新建一个php脚本:
<?php
phpinfo();
?>


2、安装phpMyAdmin
进入phpMyAdmin官方下载(不要最新版本,下phpMyAdmin 2.11.9.5就行了,3.1以上需php 5.2以上),上传到你的

网站目录下,然后进行配置。只需几步即可搞定。
I. config.sample.inc.php更名为config.inc.php;
II. 打开config.inc.php文件,进行以下修改;
// $cfg['Servers'][$i]['controluser'] = ‘pma’;
// $cfg['Servers'][$i]['controlpass'] = ‘pmapass’;
// $cfg['Servers'][$i]['pmadb'] = ‘phpmyadmin’;
// $cfg['Servers'][$i]['bookmarktable'] = ‘pma_bookmark’;
// $cfg['Servers'][$i]['relation'] = ‘pma_relation’;
// $cfg['Servers'][$i]['table_info'] = ‘pma_table_info’;
// $cfg['Servers'][$i]['table_coords'] = ‘pma_table_coords’;
// $cfg['Servers'][$i]['pdf_pages'] = ‘pma_pdf_pages’;
// $cfg['Servers'][$i]['column_info'] = ‘pma_column_info’;
// $cfg['Servers'][$i]['history'] = ‘pma_history’;
// $cfg['Servers'][$i]['designer_coords'] = ‘pma_designer_coords’;

去掉每行前面的//;
II.$cfg['blowfish_secret'] = ”; |修改为| $cfg['blowfish_secret'] = ‘http’;
IV.$cfg['Servers'][$i]['controluser'] = ‘pma’; |把’pma’修改为你的帐号|$cfg['Servers'][$i]

['controlpass'] = ‘pmapass’; |把’pmapass设置为你的mysql登录密码|
V. $cfg['blowfish_secret'] = ”; | 添加短语密码例如:$cfg['blowfish_secret'] = ‘onohot’;

 

3、//安装php的扩展
yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc

 

4、//安装apache扩展

yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql


5、 配置防火墙
添加允许访问HTTP、FTP端口

iptables -I RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPTiptables -I

RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT


各發行版的指令不同。使用Fedora,在shell執行

yum install httpd
yum install php
yum install mysql
yum install php-mysql
[編輯] Debian架構
Debian架構系統,包括Ubuntu[1],執行以下指令:

apt-get install php5
 
## 網頁服務器
#### Apache
apt-get install apache
## 或者
#### Lighttpd
apt-get install lighttpd
 
## 資料庫
#### Mysql
apt-get install mysql-server       mysql-client       php5-mysql
## 或者
#### Postgres
apt-get install postgres-server    postgres-client    php5-pg

$sudo apt-get install pgadmin3
现在安装postgresql 驱动程序$sudo apt-get install libpq-dev
$gem install postgres

 sudo apt-get install openssh-server


yum  install   sqlite

 

 Install PDO & PDO_SQLite:
 pecl install pdo                 

 pecl install pdo_sqlite      

sudo apt-get  install php5-sqlite

 

 

 

 PostgreSQL install for running:
# apt-get install postgresql postgresql-contrib

For postgresql configure question:
1. Where should the PostgreSQL database be created?
   A: just press <CR>;
2. Should the data be purged as well as the package files?
   A: select <Yes>;
3. What locale should be used by the database backend?
   A: just press <CR>;
4. These are the available encodings:
   A: just press <OK>;
5. What character encoding should the database use by default?
   A: select UNICODE, and press <OK>;
6. Choose European or US day/month order in dates.
   A: select US, and press <OK>;


For development, also need:
# apt-get install postgresql-dev

For database management, also need:
# apt-get install pgadmin3

CONFIG
^^^^^^
1: # edit file /etc/postgresql/pg_hba.conf, and lines at file top:
local   test       test                                          md5
host    test       test     127.0.0.1         255.255.255.255    md5
#host    test      test     0.0.0.0           0.0.0.0            md5

2: # su - postgres
3: $ pg_ctl reload
4: $ createuser -ADPE test
Enter password for new user:
Enter it again:
CREATE USER
5: $ createdb -O test test
CREATE DATABASE
6: $ createlang plpgsql test
$ logout
# psql -h 127.0.0.1 -U test test
Password:
Welcome to psql 7.4.6, the PostgreSQL interactive terminal.

Type:  /copyright for distribution terms
       /h for help with SQL commands
       /? for help on internal slash commands
       /g or terminate with semicolon to execute query
       /q to quit

test=>;/q

pgsql-# /l //**显示所有数据库列表,和mysql的show databases功能等同;

/l 列所有数据库
/dt 显示当前数据库中表的信息,与mysql 中show table等同
/c <database name> 连接另外一库
/du 显示用户列表
/! 回到shell下执行操作,exit返回
/q 退出psql
查看所有库:/l
查看所有表: /dt
查看某个表的结构: /d 表名

pg_dumpall > outfile
生成的转储可以用 psql 恢复:
psql -f infile postgres


sudo apt-get install mysql-server
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install php5-mysql(用mysql库)
sudo apt-get install php5-pgsql(用postgresql库)
sudo apt-get install libapache2-mod-php5
sudo apt-get install php5-imap(邮件服务)

 

 

 

 

 

 

 

 

 http://www.gishr.com/blog/u/mygis/archives/2008/216.html

http://www.mmclub.net/archives/category/php

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值