LNMP快速安装

 LNMP快速安装

1.LNMP版本

linux:CentOS release 6.6 (Final)

nginx: nginx-1.6.3

mysql:mysql-5.5.48

php:php-5.5.36

2.nginx-1.6.3安装

yum install -y pcre-devel
yum install -y openssl-devel
useradd -s /sbin/nologin -M nginx
ln -s /usr/local/lib/libpcre.so.1 /lib64
mkdir /server/tools -p
cd /server/tools
wget http://nginx.org/download/nginx-1.6.3.tar.gz
tar zxvf nginx-1.6.3.tar.gz
cd nginx-1.6.3
./configure --prefix=/application/nginx-1.6.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module
make && make install
cd ..
ln -s /application/nginx-1.6.3 /application/nginx
cd /application/nginx/conf
egrep -v "#|^$" nginx.conf.default
>nginx.conf
/application/nginx/sbin/nginx
ps -ef|grep nginx|egrep -v grep

3.安装mysql-5.5.48

安装依赖

yum install ncurses-devel libaio-devel -y
cd /server/tools/
wget https://cmake.org/files/v2.8/cmake-2.8.8.tar.gz
tar zxf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure
gmake
gmake install

安装mysql

useradd mysql -s /sbin/nologin -M
cd /server/tools/
wgethttp://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.48.tar.gz
tar zxvf mysql-5.5.48.tar.gz
cd mysql-5.5.48
cmake .-DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.48 -DMYSQL_DATADIR=/application/mysql-5.5.48/data -DMYSQL_UNIX_ADDR=/application/mysql-5.5.48/tmp/mysql.sock-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_PARTITION_STORAGE_ENGINE=1 -DWITH_FAST_MUTEXES=1 -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1 -DWITH_READLINE=1 -DWITH_EMBEDDED_SERVER=1 -DWITH_DEBUG=0
make && make install
ln -s /application/mysql-5.5.48/ /application/mysql

初始化数据库

cd /server/tools/mysql-5.5.48/support-files/
/bin/cp my-small.cnf /etc/my.cnf 
chown -R mysql.mysql /application/mysql
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
cd /server/tools/mysql-5.5.48/support-files/
cp mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld 
chkconfig --add mysqld
chkconfig mysqld on
/application/mysql/bin/mysqld_safe &
sleep 1
echo ‘export PATH="$PATH:/application/mysql/bin/"‘>> /etc/profile
source /etc/profile
mysqladmin -u root password ‘123456‘

 4.php-5.5.36安装

安装依赖

rpm -aq zlib-devel libxml2-devellibjpeg-turbo-devel libiconv-devel
rpm -aq freetype-devel libpng-devel gd-devellibcurl-devel libxslt-devel
yum install zlib-devel libxml2-devellibjpeg-turbo-devel libiconv-devel -y
yum install freetype-devel libpng-devel gd-devellibcurl-devel libxslt-devel libtool-ltdl-devel openssl-devel -y
cd /server/tools/
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
cd
wget -O /etc/yum.repos.d/epel.repohttp://mirrors.aliyun.com/repo/epel-6.repo
yum install -y libmcrypt-devel
yum install mhash mhash-devel -y
yum install -y mcrypt
echo "/usr/local/lib">>/etc/ld.so.conf
echo "/application/mysql-5.5.48/lib">>/etc/ld.so.conf
ldconfig
mkdir ext/phar/phar.phar -p

php-5.3.36服务编译安装

cd /srever/tools
wget http://cn2.php.net/distributions/php-5.5.36.tar.gz
tar zxvf php-5.5.36.tar.gz
cd php-5.5.36
./configure --prefix=/application/php5.5.36 --with-mysql=/application/mysql --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftp
make
make install
ln -s /application/php5.5.36 /application/php
cd /server/tools/php-5.5.36
cp php.ini-production /application/php/lib/php.ini
cd /application/php/etc
cp php-fpm.conf.default php-fpm.conf
/application/php/sbin/php-fpm
ps -ef|grep php-fpm|grep -v grep|wc -l

5.LNMP整合测试

n  测试一:nginx、php整合

mkdir -

编辑blog的server配置区域中添加如下

   location/ {
       root   /var/html/blog;
       index  index.html index.htm;
    }
    location~ .*\.(php|php5)?$ {
           root   /var/html/blog;
           fastcgi_pass  127.0.0.1:9000;
           fastcgi_index index.php;
           include /application/nginx/conf/fastcgi.conf;
        }

创建php文件并编辑

vi /var/html/blog/phpinfo.php
<?php
phpinfo();
?>

测试:http://blog.etiantian.org/phpinfo.php

n  nginx、php、mysql整合

vi /var/html/blog/test_mysql.php
<?php
       //$link_id=mysql_connect(‘主机名‘,‘用户‘,‘密码‘);
       $link_id=mysql_connect("127.0.0.1","root","123456");
       if(!empty($link_id)){
               echo "mysql successful by liwenbin !";
               }
        else{
               echo mysql_error();
               }
//这是php单行注释
/*这是php多行注释*/
?>

测试:http://blog.etiantian.org/test_mysql.php

时间: 2024-10-25 15:59:52

LNMP快速安装的相关文章

CentOS 7 X64 LNMP快速安装

1. 背景 一台云服务器  CentOS 7.X x64 最快速的安装,展示类应用 2. 安装过程 # 更新epel-release 依赖库 yum install epel-release -y # 强制YUM安装Nginx.Mariadb.PHP组件 yum -y install nginx* mariadb* php* --skip-broken # 启动服务并设置开机启动服务 systemctl start nginx systemctl start mysqld systemctl e

shell-网上lnmp一键安装讲解

shell-网上lnmp一键安装讲解 #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin       #设置系统环境变量本文出处:www.ksharpdabu.info export PATH     # # Check if user is root if [ $(id -u) != "0" ]; then                           #通过判断

lanmp v2.5一键安装包发布(包括lamp,lnmp,lnamp安装)

lanmp一键安装包是wdlinux官网2010年开始推出的lamp,lnmp,lnamp(apache,nginx,php,mysql,zend,eAccelerator,pureftpd)应用环境的快速简易安装包,执行一个脚本,整个环境就安装完成就可使用,快速,方便易用,安全稳定1 支持lamp(linux+apache+php+mysql),lnmp(linux+nginx+php+mysql)环境快速安装部署上线2 支持lnamp,即支持nginx+apache组合环境的应用,也即是ng

LNMP编译安装遇到问题归总

LNMP编译安装遇到问题归总 1.错误:configure: error: freetype-config not found. 解决:yum install freetype-devel 2.错误:configure: error: libevent >= 1.4.11 could not be found  解决:yum -y install libevent libevent-devel 3.错误:configure: error: Please reinstall the mysql d

python MySQLdb在windows环境下的快速安装、问题解决方式

使用Python访问MySQL,需要一系列安装 Linux下MySQLdb安装见 Python MySQLdb在Linux下的快速安装 http://blog.csdn.net/wklken/article/details/7271019 ------------------------------------------------------------- 以下是windows环境下的: 1.      安装数据库mysql 下载地址:http://www.mysql.com/downloa

centos7.3 快速安装布暑pnp4nagios图形显示

布暑之前,请看我之前的快速安装布暑nagios文章. 都在监控服务器端安装配置: 图形依赖库 #yum install cairo pango zlib zlib-devel freetype freetype-devel gd gd-devel rrdtools依赖 用来画图的 #yum install libart_lgpl rrdtool pnp4nagios 主角,收集数据,展示图形 #yum install pnp4nagios 更改显示时间,不然会有8小时时差 #vi /etc/ph

Percona Server 5.6 RPM 快速安装&快速完全卸载

1.先快速安装,然后进行学习,参数文件慢慢再来学习. 安装包下载到/tmp路径下 # tar -xvf Percona-Server-5.6.34-79.1-r1c589f9-el6-x86_64-bundle.tar # ls *.rpm # rpm -ivh Percona-Server-shared-56-5.6.34-rel79.1.el6.x86_64.rpm # rpm -ivh Percona-Server-client-56-5.6.34-rel79.1.el6.x86_64.r

Lnmp下安装memcached

????????Lnmp下安装memcached 1.先安装 libevent,再安装 Memcached主程序 # tar xf libevent-2.0.21-stable.tar.gz # cd libevent-2.0.21-stable # ./configure --prefix=/usr/local/libevent # make # make install 2.Memcached 安装? # tar xf memcached-1.4.21.tar.gz # cd memcach

HHvm建站环境搭建方法:Nginx,Mariadb,hhvm及lnmp/lamp安装部署 | 免费资源部落

HHvm建站环境搭建方法:Nginx,Mariadb,hhvm及lnmp/lamp安装部署 | 免费资源部落 nginx对redis取数据的不同方式 - 守望