LAMP 配置笔记
安装前,最好先把这些安装一下
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng \
libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel \
glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel \
curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel \
openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients \
openldap-servers gd gd2 gd-devel gd2-devel perl-CPAN pcre-devel
----------------------------------------------------------------------------
+ Nginx +
----------------------------------------------------------------------------
Nginx配置
1:指定安装路径
./configure --prefix=/lnmp/local/nginx
2:编译安装
make && make install
3: 启动 nginx
./sbin/nginx
4: 关闭防火墙
service iptables stop
5:访问
----------------------------------------------------------------------------
+ php +
----------------------------------------------------------------------------
php 安装配置
1:为确保安装不报错,先运行一下这个
yum install gd zlib zlib-devel openssl openssl-devel libxml2 libxml2-devel \
libjpeg libjpeg-devel libpng libpng-devel
2:指定安装目录,及模块
./configure --prefix=/lnmp/local/php \
--with-gd \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--enable-mysqlnd \
--with-mysql=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-openssl \
--enable-mbstring \
--enable-fpm
#公司PHP的配置
./configure --prefix=/usr/local/php \
./configure --prefix=/lnmp/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-fpm \
--enable-opcache \
--disable-fileinfo \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir=/usr/local \
--with-freetype-dir \
--with-jpeg-dir --with-png-dir --with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop\
--enable-exif \
--enable-sysvsem \
--with-curl \
--enable-mbregex \
--enable-inline-optimization \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-ftp \
--enable-intl \
--with-xsl \
--with-gettext \
--enable-zip \
--enable-soap \
--disable-ipv6 \
--disable-debug
./configure --with-apxs2=/usr/local/apache2/bin/apxs
--disable-ipv6
--with-libxml-dir=/usr
--with-openssl=/usr
--with-zlib=/usr
--with-bz2=/usr
--with-curl=/usr
--enable-ftp
--with-mysql=/usr/local/mysql
--with-mysql-sock=/var/run/mysqld/mysql5.socket
--with-mysqli=/usr/local/mysql/bin/mysql_config
--enable-bcmath --enable-mbstring --enable-sockets
--with-gd --with-jpeg-dir=/usr/local/jpeg/
--with-png-dir=/usr/local/png/
--with-freetype-dir=/usr/local/freetype
--with-zlib-dir=/usr/local/zlib/
--with-zlib
2.1 make
2.2 make install
3:配置php-fpm
3.1:执行文件在 /lnmp/local/php/sbin/php-fpm
如果出错找不到文件就去 /lnmp/local/php/etc/
目录将:
php-fpm.conf.default 复制一份
例:
cp /lnmp/local/php/etc/php-fpm.conf.default /lnmp/local/php/etc/php-fpm.conf
3.2:复制php.ini(我还没弄明白cp到哪个目录中去)
cp php-5.6.32/php.ini-development /lnmp/local/php/lib/php.ini
3.2:设置快捷方式
ln -s /lnmp/local/php/bin/php /usr/bin/php
4:去nginx中配置 nginx.conf
mysql准备工作:
1:创建用户及组
groupadd mysql
useradd -g mysql mysql -s /bin/false
2:创建安装目录和数据存放目录,并修改权限
mkdir -p /lnmp/local/mysql/data
chown -R mysql:mysql /lnmp/local/mysql
3:yum install cmake
4:下载mysql包,并将其解压,cd 进入目录中
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mysql 安装
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1:cmake 编译
cmake -DCMAKE_INSTALL_PREFIX=/lnmp/local/mysql \
-DMYSQL_DATADIR=/lnmp/local/mysql/data\
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0
2:安装
make && make install
3:修改安装完成后文件的所有者和组
chown -R mysql:mysql /lnmp/local/mysql
4:复制配置文件模板到 /etc
cp /lnmp/local/mysql/support-files/my-default.cnf /etc/my.cnf