码迷,mamicode.com
首页 > 其他好文 > 详细

lnmp部署命令

时间:2016-06-26 16:59:24      阅读:263      评论:0      收藏:0      [点我收藏+]

标签:linux

实验的过程:

 tar zvxf mysql-5.1.60.tar.gz -C /usr/src

    cd /usr/src/mysql-5.1.60/

 

    ./configure --prefix=/usr/local/mysql

  

    make && make install

 

 PATH=$PATH:/usr/local/mysql/bin

  echo $PATH

   mkdir -p /var/run/mysqld   

   useradd -M -s /sbin/nologin mysql

   chown -R  mysql /usr/local/mysql/

   /usr/local/mysql/bin/mysql_install_db --user=mysql

   /usr/local/mysql/bin/mysqld_safe --user=mysql

cd /usr/src/mysql-5.1.60

  cp -p support-files/mysql.server /etc/rc.d/init.d/mysqld

    chmod a+x /etc/rc.d/init.d/mysqld

  chkconfig --add mysqld

   chkconfig --list mysqld

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

   netstat -nultp | grep ":3306"

ln -s /usr/local/mysql/bin/mysql /usr/bin/

service mysqld start

    mysqladmin -u root password ‘123456‘

   netstat -nultp

   kill 13424

   netstat -nultp

 service mysqld start

 mysql -u root -p

   mysqldump -u root -p yy02 > /yy02.bak

  ls /yy02.bak 

  mysql -u root -p

   mysql -u root -p yy02 < /yy02.bak

   mysql -u root -p

 


、Nginx安装配置

tar zxvf pcre-8.20.tar.gz -C /

     cd /pcre-8.20/

    ./configure && make && make install


[root@localhost ~]# tar zxvf nginx-1.1.4.tar.gz


[root@localhost nginx-1.1.4]# ./configure --prefix=/usr/local/nginx


[root@localhost nginx-1.1.4]# make && make install


[root@localhost ~]# cd /usr/local/nginx/html/

[root@localhost html]# vi index.php 

<?php

phpinfo();

?>

[root@localhost html]# cd ../conf/

[root@localhost conf]# vi nginx.conf  


        location ~ .php$ {

            root           html;

            fastcgi_pass   192.168.1.192:9000;   //

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;

            include        fastcgi_params;


[root@localhost conf]# cd /etc/init.d/

[root@localhost init.d]# vi nginxd (书写启动的shell)


#!/bin/bash

#Author ethnicity(Just a check of others)

#Time 2011-9-24

nginxd=/usr/local/nginx/sbin/nginx

nginx_config=/usr/local/nginx/conf/nginx.conf

nginx_pid=/usr/local/nginx/logs/nginx.pid


RETVAL=0

prog="nginx"


# Source function library.

. /etc/rc.d/init.d/functions


# Source networking configuration.

. /etc/sysconfig/network


# Check that networking is up.

[ ${NETWORKING} = "no" ] && exit 0


[ -x $nginxd ] || exit 0



# Start nginx daemons functions.

start() {


if [ -e $nginx_pid ];then

   echo "nginx already running...."

   exit 1

fi


 echo -n $"Starting $prog: "

   daemon $nginxd -c ${nginx_config}

   RETVAL=$?

   echo

   [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx

   return $RETVAL


}



# Stop nginx daemons functions.

stop() {

        echo -n $"Stopping $prog: "

        killproc $nginxd

        RETVAL=$?

        echo

        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid

}


# reload nginx service functions.

reload() {


    echo -n $"Reloading $prog: "

    #kill -HUP `cat ${nginx_pid}`

    killproc $nginxd -HUP

    RETVAL=$?

    echo


}


# See how we were called.

case "$1" in

start)

        start

        ;;


stop)

        stop


        ;;


reload)

        reload

        ;;


restart)

        stop

        start

        ;;


status)

        status $prog

        RETVAL=$?

        ;;

*)

        echo $"Usage: $prog {start|stop|restart|reload|status|help}"

        exit 1

esac


exit $RETVAL




[root@localhost init.d]# chmod a+x nginxd


[root@localhost ~]# service nginxd  restart

                                            



、php的相关配置

1、安装libpng

tar xvf libpng-1.2.10.tar.tar

cd libpng-1.2.10

./configure --prefix=/usr/local/png

make;make install

ln -s /usr/local/png/lib/* /usr/lib/

2、安装jpeg

mkdir /usr/local/jpeg

mkdir /usr/local/jpeg/bin

mkdir /usr/local/jpeg/lib

mkdir /usr/local/jpeg/include

mkdir /usr/local/jpeg/man

mkdir /usr/local/jpeg/man/man1

tar xvf jpegsrc.v7.tar.tar

cd jpeg-7

./configure --prefix=/usr/local/jpeg --enable-shared --enable-static

make;make install

ln -s /usr/local/jpeg/lib/* /usr/lib/

3、安装 freetype

tar xvf freetype-2.3.9.tar.tar

cd freetype-2.3.9

./configure --prefix=/usr/local/freetype

make;make install

4、安装fontconfig

tar zxvf fontconfig-2.4.2.tar.gz

cd fontconfig-2.4.2

./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/freetype/bin/freetype-config

make;make install

5、安装GD

tar zxvf gd-2.0.32.tar.gz

cd gd-2.0.32

./configure --prefix=/usr/local/gd --with-png=/usr/local/png --with-jpeg=/usr/local/jpeg --with- freetype=/usr/local/freetype --with-fontconfig=/usr/local/fontconfig

cp /usr/local/png/include/png.h ./

cp /usr/local/png/include/pngconf.h ./

make;make install


 tar zxvf php-5.2.17.tar.gz


 gzip -cd php-5.2.17-fpm-0.5.14.diff.gz |patch -d php-5.2.17 -p1   //打补丁的步骤


 ./configure --prefix=/usr/local/php --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/png --with-freetype-dir=/usr/local/freetype --with-mysql=/usr/local/mysql --enable-fastcgi --enable-fpm



 make && make install

 cd /usr/local/php/etc/

 vi php-fpm.conf (找到修改如下的语句前面的注释去掉)


 <value name="listen_address">192.168.1.192:9000</value>   //本机的实际IP


                        Unix user of processes                        <value name="user">nobody</value>                       


                        Unix group of processes                        <value name="group">nobody</value>


<value name="allowed_clients">192.168.1.192</value>  //此IP就是Nginx主机的IP,这里是安装在同一台机器上,所以采用相同ip


 cd ~/php-5.2.17

  cp php.ini-recommended /usr/local/lib/php.ini (设置php的主配置文件)


 vim /usr/local/php/etc/php-fpm.conf 

把下面那几行的注释去掉

                        Unix user of processes

                        <value name="user">nobody</value>                               


                        Unix group of processes

                        <value name="group">nobody</value>


cd /usr/local/php/sbin/php-fpm 

./php-fpm restart(开启监控的功能)



、测试的部分


[root@localhost ~]# /etc/init.d/nginxd restart

Stopping nginx:                                            [  OK  ]

Starting nginx:                                            [  OK  ]

[root@localhost ~]# /usr/local/php-5.2.17/sbin/php-fpm restart

Shutting down php_fpm . done

Starting php_fpm  done

在IE地址栏里输入http://192.168.1.192/index.php  即可以出现php那个经典的测试网页了!

 tar zvxf phpMyAdmin-3.4.9-all-languages.tar.gz -C /usr/local/nginx/html

   

   cd /usr/local/nginx/html


  mv phpMyAdmin-3.4.9-all-languages/ phpmyadmin


 cd phpmyadmin/


  cp config.sample.inc.php config.inc.php 

   vim config.inc.php 

$cfg[‘Servers‘][$i][‘host‘] = ‘127.0.0.1‘;


lnmp部署命令

标签:linux

原文地址:http://9272317.blog.51cto.com/9262317/1792987

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!