1. 官方推荐最简方式安装Varnish

rpm –nosignature -i http://repo.varnish-cache.org/redhat/el5/noarch/varnish-release-2.1-2.noarch.rpm

yum install varnish

 

启动varnish

service varnish restart

 

配置文件路径

配置1:/etc/varnish/default.vcl

配置2:/etc/sysconfig/varnish

 

2. 编译安装lighttpd

wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.28.tar.gz

tar xvzf lighttpd-1.4.28.tar.gz

cd lighttpd-1.4.28

./configure -prefix=/usr/local/lighttpd

make && make install

 

把lighttpd-1.4.28/doc/config拷贝到/usr/local/lighttpd/config

把lighttpd-1.4.28/doc/initscripts/rc.lighttpd.redhat 拷贝到/etc/init.d/lighttpd

nano lighttpd 把对应的lighttpd目录和配置文件目录修改成对应的目录

chkconfig lighttpd on

service lighttpd restart

3. 安装php

添加yum repo php5.2.x
vi /etc/yum.repos.d/CentOS-Testing.repo
[c5-testing]
name=CentOS-5 Testing
baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
priority=1

注:这个是centos官方的test源,里面有php5.2.10

yum install php

4. lighttpd fastcgi方式整合php

wget http://www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.gz

tar xvzf spawn-fcgi-1.6.3.tar.gz

cd spawn-fcgi-1.6.3

./configure –prefix=/usr/local/spawn-fcgi

make && make install

/usr/local/spawn-fcgi/bin/spawn-fcgi -f /usr/bin/php-cgi -p 2000 -a 127.0.0.1 -C 8

nano  /usr/local/lighttpd/config/modules.conf 去掉include “conf.d/fastcgi.conf”前面的#号

nano /usr/local/lighttpd/config/conf.d/fastcgi.conf

追加如下配置内容

fastcgi.server = (

“.php” => ((

“host” => “127.0.0.1″,

“port” => “2000″,

“docroot” => “/home/www/”

)))

 

service lighttpd restart

5. RPM方式安装mysql

wget  http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.9-1.rhel4.i386.rpm/from/http://mysql.spd.co.il/

wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.9-1.rhel4.i386.rpm/from/http://mysql.spd.co.il/

rpm -ivh MySQL-client-5.5.9-1.rhel4.i386.rpm

rpm -ivh MySQL-server-5.5.9-1.rhel4.i386.rpm

service mysql start

mysqladmin -u root password ’123456′

mysql -u root -p   输入密码登录

mysql>use mysql;

mysql>update user set host = ‘%’ where user = ‘root’;

mysql>UPDATE user SET Password=PASSWORD(’123456′) where USER=’root’;

mysql>FLUSH PRIVILEGES;

mysq>exit;

 

这样就开启了远程管理权限,可以用客户端GUI工具进行远程管理。

最后不要忘记挑选一个配置文件拷贝到/etc/my.cnf

cp /usr/share/mysql/my-huge.cnf /etc/my.cnf

 

6. MySQL主从配置

注意:关闭防火墙 service iptables stop .默认centos5.5开启iptables。否则不能访问80端口

修改Master所在服务器的my.cnf文件里[mysqld]配置项追加配置如下

#不同步的数据库

#binlog_ignore_db = mysql

#需要同步的数据库

binlog_do_db = ad

 

继续修改slave所在服务器的my.cnf文件中[mysqld]配置项追加如下配置:

server-id       = 2

#需要同步的数据库

replicate-do-db = ad

# The replication master for this slave – required

master-host     =   192.168.1.2

# The username the slave will use for authentication when connecting

# to the master – required

master-user     =   master_user

# The password the slave will authenticate with when connecting to

# the master – required

master-password =   master_user_password

# The port the master is listening on.

# optional – defaults to 3306

master-port     =  3306

# binary logging – not required for slaves, but recommended

log-bin=mysql-bin

# binary logging format – mixed recommended

binlog_format=mixed

 

接着分别检查master和slave服务器状态,在mysql命令行下敲入如下命令

show master status \G

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。