centos6.5 搭建lnmp开发环境(一)

vmware 安装 centos6.5

BinDVD: 普通安装版
LiveCD: 光盘centos系统,包含图形界面,终端
LiveDVD: LiveDVD的精简版

centos6.5下载链接

centos6.5 操作ssh和防火墙

centos默认是没有打开ssh的

启动ssh服务: service sshd start

打开端口:
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

保存: /etc/rc.d/init.d/iptables save
查看打开的端口: /etc/init.d/iptables status
关闭防火墙:/etc/init.d/iptables stop    service iptables stop

vmware tools共享文件

VMware虚拟机 >> 安装VMware Tools
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom  挂载虚拟光驱
cd /mnt/cdrom 
tar -zxvf VMware Tools-9.9.0-2304977.tar.gz -C /tmp   把安装文件解压到/tmp文件中
cd /tmp/vmware-tools-distrib
./vmware-install.pl
然后一路回车或者yes 就可以安装完成

共享windows目录:
 编辑虚拟机设置 >> 选项 >> 共享文件夹 (总是启用  然后添加共享文件夹)

新建软连接:
 ln -s /mnt/hgfs/www /home

LNMP 安装

新建用户

[root@localhost src]# groupadd www
[root@localhost src]# useradd -M -g www -s /sbin/nologin www

安装nginx

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
tar -zxvf pcre-8.39.tar.gz
cd pcre-8.39
./configure --prefix=/opt/local/pcre/
make 
make install

wget http://www.zlib.net/zlib-1.2.11.tar.gz
#tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=/opt/local/zlib/
make
make install

wget http://www.openssl.org/source/openssl-1.0.0e.tar.gz 
cd $SRC
tar -zxvf openssl-1.0.0e.tar.gz
cd openssl-1.0.0e
./config --prefix=/opt/local/openssl --openssldir=/opt/local/ssl
make
make install

wget http://nginx.org/download/nginx-1.10.3.tar.gz
./configure --prefix=/opt/local/nginx --user=www --group=www --with-http_ssl_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_gzip_static_module --with-pcre=/opt/src/pcre-8.39 --with-zlib=/opt/src/zlib-1.2.11 --with-openssl=/opt/src/openssl-1.0.0e
make 
make install

安装php

yum -y install epel-release libxml2-devel freetype-devel zlib-devel curl-devel libjpeg-devel libgcrypt-devel libmcrypt-devel ncurses-devel pcre-devel psmisc pcre openssl-devel libpng-devel gd-devel bzip2-devel libmcrypt mcrypt mhash mhash-devel libicu-devel t1lib-devel curl libtool-ltdl-devel libtool-ltdl php-xmlrpc mysql-devel 
tar -zxvf php-5.5.38.tar.gz
cd php-5.5.38
./configure --prefix=/opt/local/php --enable-sockets --enable-soap --enable-zip --enable-zend-signals --enable-mysqlnd --enable-opcache --enable-pcntl --enable-embedded-mysqli --enable-mbstring --enable-intl --enable-exif --enable-calendar --enable-bcmatch --with-curl --with-openssl --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-config-file-path=/opt/local/php/lib/php --with-mcrypt --enable-re2c-cgoto --disable-short-tags --enable-ftp --with-mysqli --with-pdo-mysql --with-kerberos --with-zlib --with-gd --with-freetype-dir=/usr --enable-shmop --enable-sysvsem --with-mhash --with-xmlrpc --with-png-dir --enable-pcntl
make 
make install


yum install libmcrypt-devel
cp php-fpm.conf.default php-fpm.conf

php环境变量:
vi /etc/profile  末尾增加如下命令

PATH=$PATH:/opt/local/php/bin
export PATH

source /etc/profile

安装php常用扩展

yum install libtool.x86_64 libtool-ltdl.x86_64 libtool-ltdl-devel.x86_64

安装phalcon框架

wget https://github.com/phalcon/cphalcon/archive/phalcon-v1.3.4.tar.gz
tar -zxvf phalcon-v1.3.4
cd cphalcon-phalcon-v1.3.4/build/
编辑install文件修改成: /opt/local/php/bin/phpize && ./configure --enable-phalcon --with-php-config=/opt/local/php/bin/php-config
./install
修改ini文件  extension=phalcon.so

安装memcache

wget http://pecl.php.net/get/memcache-3.0.8.tgz
tar -zxvf memcache-3.0.8.tgz
cd memcache-3.0.8
/opt/local/php/bin/phpize
make && make install
修改ini文件  extension=memcache.so

安装zendopcache(php代码加速)

wget https://pecl.php.net/get/zendopcache-7.0.5.tgz
tar -zxvf zendopcache-7.0.5.tgz
cd zendopcache-7.0.5
/opt/local/php/bin/phpize
./configure --with-php-config=/opt/local/php/bin/php-config
修改ini文件  extension=opcache.so

安装mongodb

wget https://pecl.php.net/get/mongodb-1.2.8.tgz
tar -zxvf mongodb-1.2.8.tgz
cd mongodb-1.2.8
/opt/local/php/bin/phpize
./configure --with-php-config=/opt/local/php/bin/php-config
修改ini文件  extension=mongodb.so

安装redis扩展

wget https://pecl.php.net/get/redis-3.1.2.tgz
tar -zxvf redis-3.1.2.tgz
cd redis-3.1.2
/opt/local/php/bin/phpize
./configure --with-php-config=/opt/local/php/bin/php-config
修改ini文件  extension=redis.so
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值