centos6.2下lamp开发环境部署过程

centos6.2下lamp开发环境部署过程
yan 2012-08-16
一、部署程序apache
mysql
php
mongodb
ImageMagick
Memcached
epel
ssh
rockmongo
phpmyadmin
memadmin
二、部署过程
1.mysql
yum install mysql mysql-server
chkconfig –levels 235 mysqld on
/etc/init.d/mysqld start
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword
2.apache
yum install httpd
chkconfig –levels 235 httpd on
/etc/init.d/httpd start
测试 apache:
在CentOS里Apache的默认文档路径的位置是在/var/www/html,配置文件的路径是/etc/httpd/conf/httpd.conf。其他的配置存储在/etc/httpd/conf.d/ 文件夹里。
3.php
yum install php
/etc/init.d/httpd start
#php extension
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
/etc/init.d/httpd restart
4.测试apache和php
vi /var/www/html/info.php
<?php phpinfo(); ?>
5.安装ssh并测试登录其它linux服务器:
yum install ssh
ssh -l root 192.168.1.234
exit
6.安装epel:
rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
7.安装php常用扩展:
yum install php-mbstring
yum install php-mcrypt
8.安装mongo
yum install mongodb-server
yum install php-pecl-mongo
配置mongo参数:
vi mongodb.conf
dbpath = /data/db/mongodb #数据文件存放目录
logpath = /data/logs/mongodb.log #日志文件存放目录
port = 27017  #端口
fork = true  #以守护程序的方式启用,即在后台运行
创建db目录并设置权限:
mkdir /data/db/mongodb
chmod 777 -R /data/db/mongodb
启动mongod:
mongod –config /etc/mongodb.conf
联接:
mongo
use topka
db.addUser(“topka”,”topkapassword”);
db.auth(“topka”,”topkapassword”);
9.svn co
mkdir /var/www/html/topka/trunk
cd /var/www/html/topka/trunk
svn -co svn://xxx.xxx.xxx/topka/trunk
修改目录权限:
chmod 777 -R /var/www/html
10.配置apache VirtualHost
vi /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
#配置localhost
<VirtualHost *:80>
    ServerName localhost
    ServerAdmin yan@localhost
    DocumentRoot /var/www/html/
    ErrorLog logs/localhost.log
    CustomLog logs/localhost.log common
</VirtualHost>
#配置www.topka.cn域名
<VirtualHost *:80>
    ServerName www.topka.cn
    ServerAdmin yan.jingang@topka.cn
    DocumentRoot /var/www/html/topka/trunk/web/code/topka_wb/app/
    ErrorLog logs/topka.cn.log
    CustomLog logs/topka.cn.log common
</VirtualHost>
11.配置hosts
#localhost
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
#topka
127.0.0.1 topka.cn www.topka.cn img.topka.cn static.topka.cn admin.topka.cn
#db.conf
127.0.0.1 db_master
127.0.0.1 mongoserver
12.安装imageMagick
yum install ImageMagick
yum install php-pecl-imagick
13.安装memcached
yum install memcached
yum install libmemcached
yum install php-pecl-memcache
yum install php-pecl-memcached
启动memcached:
memcached -d -u root
测试:
yum install telnet
telnet localhost 11211
stats
php扩展状态:
使用memadmin管理: