lnmp环境安装


lnmp依赖包安装yum -y install gcc automake autoconf libtool makeyum install gcc gcc-c++yum -y install libmcrypt-devel
#lnmp依赖包安装
yum -y install gcc automake autoconf libtool make
yum install gcc gcc-c++
yum -y install libmcrypt-devel mhash-devel libxslt-devel \
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 pcre pcre-devel
#.安装nginx
cd /usr/local/src
#wget http://nginx.org/download/nginx-1.4.2.tar.gz
tar -zxvf nginx-1.4.2.tar.gz
cd nginx-1.4.2

./configure --sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--with-http_ssl_module \


make
make install

##复制配置文件(注意呀)
cp /usr/local/src/nginx.conf /usr/local/nginx/nginx.conf
#启动nginx服务
/usr/local/nginx/nginx



#安装mysql的cmake
cd /usr/local/src
tar zxvf  cmake-2.8.10.2.tar.gz

cd cmake-2.8.10.2
./configure  --prefix=/usr/local/cmake   
make && make install

#创建mysql用户以及相关目录
groupadd mysql              #所以在这里我们要建一个msyql的用户和组   
useradd -g mysql mysql -s /usr/sbin/nologin   
mkdir /usr/local/mysql           #创建目录   
mkdir /usr/local/mysql/data

#进入mysql-5.5.13的解压目录:

cd /usr/local/src
tar -zxvf mysql-5.5.35.tar.gz
cd mysql-5.5.35
/usr/local/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql && make && make install
#进入mysql的安装目录/usr/local/mysql下:

cd /usr/local/mysql

#复制配置文件(注意呀)
cp /usr/local/src/my.cnf  /usr/local/mysql/my.cnf
#初始化数据库
scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
#处理配置文件
#改变文件的所属组
chown -R mysql:mysql /usr/local/mysql



#把mysql做成系统服务
cd /usr/local/mysql/support-files/   
cp ./mysql.server /etc/init.d/mysqld  
/etc/init.d/mysqld start



#安装php

cd /usr/local/src
tar -zxvf php-5.5.12.tar.gz

cd php-5.5.12
./configure --prefix=/usr/local/php \
--enable-fpm \
--enable-safe-mode \
--enable-sigchild \
--with-libxml-dir \
--with-zlib \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-curlwrappers \
--with-libxml-dir \
--enable-exif \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--with-gettext \
--with-mhash \
--enable-mbstring \
--with-mcrypt \
--with-mysql=/usr/local/mysql \
--enable-pcntl \
--with-pdo-mysql=/usr/local/mysql \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sqlite-utf8 \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-xmlrpc \
--with-xsl \
--enable-zip \
--with-zlib-dir \
--with-pcre-dir  \
--without-pear  \
--with-openssl \

make && make install

#处理php.ini(注意呀)
cp /usr/local/src/php.ini  /usr/local/php/lib/php.ini
#处理php-fpm.conf
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

#启动php-fpm
/usr/local/php/sbin/php-fpm

你可能感兴趣的:(linux)