Tag Archives: centos

install php zend optimizer with yum on centos

Contents: atomic.repo

# Name: Atomic Rocket Turtle RPM Repository for CentOS / Red Hat Enterprise Linux 5 –
# URL: http://www.atomicrocketturtle.com/
[atomic]
name = CentOS / Red Hat Enterprise Linux $releasever – atomicrocketturtle.com
mirrorlist = http://www.atomicorp.com/mirrorlist/atomic/centos-5-$basearch
#mirrorlist = http://www.atomicorp.com/channels/atomic/centos/5/mirrors-atomic
enabled = 1
priority = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt
gpgcheck = 1

# Almost Stable, release candidates for [atomic]
[atomic-testing]
name = CentOS / Red Hat Enterprise Linux $releasever – atomicrocketturtle.com – (Testing)
mirrorlist = http://www.atomicorp.com/mirrorlist/atomic-testing/centos-5-$basearch
enabled = 0
priority = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt
gpgcheck = 1

# Untested, Unstable, known buggy, and incomplete packages.
#[atomic-bleeding]
#name = CentOS / Red Hat Enterprise Linux $releasever – atomicrocketturtle.com – (Bleeding)
#baseurl = http://www.atomicorp.com/channels/atomic-bleeding/centos/5/$basearch/
#enabled = 0
#priority = 1
#protect = 0
#gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt
#gpgcheck = 1

yum install php-zend-optimizer

5分钟完成配置CentOS+Apache+MySQL+PHP5+Webmin+PPTP VPN+Subversion+etc

嗯,今天实在不知道的写什么,就只有把老本拿出来了:自己折腾了N台vps后整理出的快速配置centos的脚本,只要打开terminal一行行的粘进去回车就完事。
正常情况下是可以在5分钟内完成一台新vps的配置的,如果遇到非正常情况。。就。。。。。。
跑poptopd的前提是你的vps是xen架构,否则免谈

#安装epel+rpmforge
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt http://quattor.web.lal.in2p3.fr/packages/os/sl520-x86_64/base/RPM-GPG-KEYs/RPM-GPG-KEY-CentOS-5 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
rpm –import RPM-GPG-KEY.dag.txt
rpm –import RPM-GPG-KEY-CentOS-5
rpm -Uhv rpmforge-release-0.5.1-1.el5.rf.i386.rpm

#更新系统
yum -y update
yum -y upgrade
#install php 5.2+ on centos5
vim /etc/yum.repos.d/CentOS-Testing.repo

[c5-testing]
name=CentOS-5Testing
baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
includepkgs=php*

#安装lamp和subversion+其他一些东西
yum -y install perl-Net-SSLeay gcc-c++ patch zlib-devel openssl-devel readline-devel mysql-devel mysql-server httpd-devel apr-devel iptables php-common php-gd php-mcrypt php-pear php-mhash php-mysql php-xml php-mbstring traceroute bind-utils setuptool mod_dav_svn subversion sqlite-devel ntp

#poptopd pptp vpn server
rpm -Uvh http://poptop.sourceforge.net/yum/stable/fc7/pptp-release-current.noarch.rpm
yum -y –enablerepo=poptop-stable install pptpd

vim /etc/pptpd.conf (修改localip、remoteip)
vim /etc/ppp/options (修改ms-dns),
vim /etc/ppp/chap-secrets (创建用户名、密码,指定ip)
vim /etc/sysctl.conf
#修改
net.ipv4.ip_forward = 1
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 内网ip段(eg. 192.168.100.0/24) -j SNAT –to 服务器的任意ip(eg. 1.2.3.4)
/etc/init.d/iptables save
/etc/init.d/iptables restart

#webmin图形化的web管理界面,减少命令行的折腾程度
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.520-1.noarch.rpm
rpm -i webmin-1.520-1.noarch.rpm

#subversion
svnadmin create /path/to/repo
chmod 777 -R /path/to/repo
htpasswd -c /path/to/svn/password username#下面这段丢给httpd.conf

DocumentRoot /path/to/svn/repo
ServerName svn.yourname.com

DAV svn
SVNPath /data/svn
AuthType Basic
AuthName “Subversion”
AuthUserFile /path/to/svn/password
Require valid-user

#大功告成^_^

非常NB的软7层交换机-haproxy在centos上最简化配置

yum -y install haproxy
vim /etc/haproxy/haproxy.cfg
#    use_backend static          if url_static  #注释掉这一行
server  app1 你的服务器真实ip:端口 check  #修改这一行
删掉其余两行server app1

保存退出完事
然后service haproxy start

自己hosts后就可以感受一下了,对于动态内容加速效果还是很明显的,支持非常强大的配置,等有空研究清楚了继续贴配置

之前搞错了- -haproxy主要是作为load balancer用,部署在最前端,后面一般是个squid群,squid之后才是应用服务器,应用服务器后面可以再来一层数据库服务器,这样的架构抗负载能力是非常强悍的。

目前我这个烂博客已经实现squid+apache+mysql分布在3台服务器,其中一台跑在xeex的网络后面作为前端,另外两个在Amazon的ec2上。估计是没必要考虑引入haproxy的了- –