笔记本安装CentOS环境

请使用项目  http://git.oschina.net/azhai/CentSetup


1. 使用CentOS-6.3-x86_64-bin-DVD1.iso安装盘。之前试过用minial安装盘,装好之后再yum update && yum groupinstall "X Desktop System" "Desktop" "Development tools" "Emacs" chinese-support firefox,装好之后Terminal终端的字体都不对管理菜单也少只有两项。

2. 安装Google Chrome浏览器。下面文本添加到yum源/etc/yum.repos.d/CentOS-Base.repo中就有Chrome了。


[google64]
name=Google - x86_64
baseurl=http://dl.google.com/linux/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub


3. 在添加/删除软件中添加mysql-server,然后下载nginx v1.2.5,php v5.4.8开始编译安装。

 在添加/删除软件中添依赖库,nginx依赖pcre-devel和zlib-devel包,php依赖下列devel包

openssl-devel libcurl-devel libxml2-devel libpng-devel libjpeg-devel-6b freetype-devel libmcrypt-devel libicu-devel

4. 安装 nginx-1.2.5

tar xzf nginx-1.2.5.tar.gz
cd nginx-1.2.5
./configure --prefix=/opt/nginx-1.2.5
make && sudo make install
cd ..

5. 安装 php-5.4.8

参照 CentOS X64 PHP5.4编译参数

tar xzf php-5.4.8.tar.gz
cd php-5.4.8
./configure --prefix=/opt/php-5.4.8 \
--build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu \
--with-layout=GNU --with-libdir=lib64 \
--with-pic  --with-curl=shared  --with-freetype-dir --with-png-dir  \
--with-gettext=shared --with-gmp=shared --with-iconv --with-jpeg-dir --with-png-dir \
--with-openssl --with-libxml-dir --with-pcre-regex \
--with-mcrypt=shared --with-zlib  \
--with-mysql --with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-mysqli --with-pdo-mysql \
--with-kerberos --with-imap --with-imap-ssl \
--with-pear --with-gd --enable-gd-native-ttf --enable-calendar=shared \
--enable-exif --enable-ftp --enable-sockets --enable-bcmath=shared \
--enable-pcntl \
--enable-intl --enable-mbstring \
--enable-zip --with-bz2=shared \
--enable-sysvsem --enable-sysvshm --enable-sysvmsg \
--without-unixODBC --enable-mbregex \
--enable-fpm  --with-fpm-user=ryan  --with-fpm-group=ryan \
--enable-tokenizer --enable-phar \
--with-sqlite3
make && sudo make install
cd ..  

NOTE:

(1)  不要忘记将php.ini-development 复制到目标文件夹 /opt/php-5.4.8/etc

(2) 如果报错 error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing

    请安装 libc-client-devel

6. 配置nginx

将conf/nginx.config中server部分,改为 include sites/*.conf;

建立sites目录和php.conf文件,文件内容为


    server {
        listen       80;
        server_name  192.168.1.55;
        charset utf-8;
        root         /home/ryan/project;

        #access_log  logs/host.access.log  main;

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        #error_page   500 502 503 504  /50x.html;
        #location = /50x.html {
        #    root   html;
        #}

        location ~* ^.+\.(css|js|jpg|png|gif|ico|swf|pdf|txt|xlsx)$ {
		access_log off;
		expires max;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
        #    root           /home/ryan/project;
            fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_pass   /opt/php-5.4.8/var/run/php-fpm.sock;
            fastcgi_index  index.php;
            include        fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }
    }


7. 配置php

简单地将etc/php-fpm.conf.default复制为etc/php-fpm.conf即可

8. 启动服务


#建立软链接
sudo ln -s /opt/nginx-1.2.5/sbin/nginx /usr/sbin/nginx
sudo ln -s /opt/php-5.4.8/sbin/php-fpm /usr/sbin/pnp-fpm
#启动
sudo service mysqld start
sudo nginx
php-fpm -D


你可能感兴趣的:(PHP,nginx,centos)