首页 > 其他> LNMP架构部署

* 安装mysql

    # tar xzvf mysql-5.5.24.tar.gz -C /opt
    # cd /opt/mysql-5.5.24
    编译&&编译安装

    # cmake      -DCMAKE_INSTALL_PREFIX=/usr/local/mysql     -DDEFAULT_CHARSET=utf8     -DDEFAULT_COLLATION=utf8_general_ci     -DWITH_EXTRA_CHARSETS=all     -DSYSCONFDIR=/etc     -DMYSQL_DATADIR=/home/mysql/     -DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock     -DWITH_MYISAM_STORAGE_ENGINE=1     -DWITH_INNOBASE_STORAGE_ENGINE=1     -DWITH_ARCHIVE_STORAGE_ENGINE=1     -DWITH_BLACKHOLE_STORAGE_ENGINE=1     -DENABLED_LOCAL_INFILE=1     -DWITH_SSL=system     -DMYSQL_TCP_PORT=3306     -DENABLE_DOWNLOADS=1     -DWITH_SSL=bundled

    # make && make install    

复制/opt/mysql-5.5.24/support-files 目录下的 my-medium.cnf 保存到/etc 命名 my.cnf
复制/opt/mysql-5.5.24/support-files 目录下的 my.server 保存到/etc/init.d 命名 mysqld
设置 /etc/init.d/mysql 文件的权限
添加mysqld 服务并开启 3 5 的开机自启动

# cp support-files/my-medium.cnf /etc/my.cnf
# cp support-files/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld       
# chkconfig --add mysqld
# chkconfig --level 35 mysqld on 

定义环境变量

# echo "PATH=$PATH:/usr/local/mysql/bin/" >> /etc/profile
# . /etc/profile 

创建一个mysql用户 禁止shell登录
设置/usr/local/mysql 的属主为mysql

# useradd -s /sbin/nologin mysql
# chown -R mysql.mysql /usr/local/mysql

初始化数据库

# /usr/local/mysql/scripts/mysql_install_db --user=mysql --ldata=/var/lib/mysql --basedir=/usr/local/mysql --datadir=/home/mysql 

# ln -s /var/lib/mysql/mysql.sock  /home/mysql/mysql.sock
# vi /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/home/mysql
# service mysqld start

解压缩安装包

    # tar xjvf /opt/lamp/php-5.4.5.tar.bz2 -C /opt
    # cd /opt/php-5.4.5

 # ./configure --prefix=/usr/local/php5 --with-gd --with-zlib --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php5 --enable-mbstring --with-jpeg-dir --with-openssl --disable-ipv6 --enable-fpm

安装编译安装

# make && make install

优化调整PHP

# cp php.ini-development /usr/local/php5/php.ini
# ln -s /usr/local/php5/bin/* /usr/local/bin/
# ln -s /usr/local/php5/sbin/* /usr/local/sbin/

为PHP安装加速器

# tar xzvf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz -C /opt
# cd ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x
# cp ZendGuardLoader.so /usr/local/php5/lib/php

配置PHP识别加速器

# vi /usr/local/php5/php.ini
[Zend Guard Loader]
zend_extension=/usr/local/php5/lib/php/ZendGuardLoader.so
zend_loader.enable=1

分享图片

开启nginx的PHP支持

# cd /usr/local/php5/etc/
# cp  php-fpm.conf.default php-fpm.conf
# useradd -M -s /sbin/nologin php
# vi php-fpm.conf     //修改参数
pid = run/php-fpm.pid
user = php
group = php
pm.max_children=50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35

# /usr/local/sbin/php-fpm    //启用该模块
# netstat -tnal | grep 9000    //查看

# vi /usr/local/nginx/conf/nginx.conf
location ~ \.php$ {
        root           /var/www/bt;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        include        fastcgi.conf;
    }

分享图片

标签:IM   免费   engine   libxml   开启   grep   install   mys   lib   

赞0
暂无评论!
登录后才能评论!