{"id":6757,"date":"2017-06-03T18:16:34","date_gmt":"2017-06-03T10:16:34","guid":{"rendered":"http:\/\/rmohan.com\/?p=6757"},"modified":"2017-06-03T18:16:34","modified_gmt":"2017-06-03T10:16:34","slug":"centos-6-8-to-compile-and-install-lnmp-brief","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6757","title":{"rendered":"CentOS 6.8 to compile and install LNMP Brief"},"content":{"rendered":"<p><strong>CentOS 6.8 to compile and install LNMP Brief<\/strong><\/p>\n<p>deas: According to information systems and Linux systems company&#8217;s Web site, select the appropriate installation package for installation<\/p>\n<p>First, view system information<\/p>\n<p># Uname -a # View kernel \/operating system \/the CPU information<br \/>\n# Head -n 1 \/etc\/issue # view the operating system version<br \/>\n# Grep MemTotal \/ proc \/ meminfo # view the amount of memory<br \/>\n# fdisk the -l # view all partitions<br \/>\nSecond, the specific installation<\/p>\n<p>Conventional installation dependencies<\/p>\n<p>yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-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 openldap openldap-devel openldap-clients openldap-servers make zlib-devel pcre-devel openssl-devel libtool* git tree bison perl gd gd-devel<br \/>\nInstall libiconv library<\/p>\n<p>1 tar zxvf libiconv-1.14.tar.gz<br \/>\n2 cd libiconv-1.14<br \/>\n3 .\/configure &#8211;prefix=\/usr\/local\/libiconv<br \/>\n4 make &#038;&#038; make install<br \/>\n5 cd ..<br \/>\nInstallation libmcrypt, mhash, mcrypt library<\/p>\n<p> 1 tar zxvf libmcrypt-2.5.8.tar.gz<br \/>\n 2 cd libmcrypt-2.5.8<br \/>\n 3 .\/configure<br \/>\n 4 make &#038;&#038; make install<br \/>\n 5 cd ..<br \/>\n 6 tar jxvf mhash-0.9.9.9.tar.bz2<br \/>\n 7 cd mhash-0.9.9.9<br \/>\n 8 .\/configure<br \/>\n 9 make &#038;&#038; make install<br \/>\n10 cd ..<br \/>\n11 tar zxvf mcrypt-2.6.8.tar.gz<br \/>\n12 cd mcrypt-2.6.8<br \/>\n13 .\/configure<br \/>\n14 make &#038;&#038; make install<br \/>\n15 cd ..<br \/>\nCMake installation tool<\/p>\n<p>1 tar zxvf cmake-3.7.2.tar.gz<br \/>\n2 cd cmake-3.7.2<br \/>\n3 .\/bootstrap &#038;&#038; make &#038;&#038; make install<br \/>\n4 cd..<br \/>\nInstalling MySQL<\/p>\n<p> 1<br \/>\n 2 rpm -e mysql &#8211;nodeps<br \/>\nmysql<br \/>\n 4 groupadd mysql &#038;&#038; useradd -g mysql -M mysql<br \/>\n 5 tar zxvf mysql-5.6.24.tar.gz<br \/>\n 6 cd mysql-5.6.24<br \/>\n 7 cmake \\<br \/>\n 8 -DCMAKE_INSTALL_PREFIX=\/usr\/local\/mysql \\<br \/>\n 9 -DMYSQL_DATADIR=\/usr\/local\/mysql\/data \\<br \/>\n10 -DSYSCONFDIR=\/etc \\<br \/>\n11 -DMYSQL_USER=mysql \\<br \/>\n12 -DWITH_MYISAM_STORAGE_ENGINE=1 \\<br \/>\n13 -DWITH_INNOBASE_STORAGE_ENGINE=1 \\<br \/>\n14 -DWITH_ARCHIVE_STORAGE_ENGINE=1 \\<br \/>\n15 -DWITH_MEMORY_STORAGE_ENGINE=1 \\<br \/>\n16 -DWITH_READLINE=1 \\<br \/>\n17 -DMYSQL_UNIX_ADDR=\/var\/lib\/mysql\/mysql.sock \\<br \/>\n18 -DMYSQL_TCP_PORT=3306 \\<br \/>\n19 -DENABLED_LOCAL_INFILE=1 \\<br \/>\n20 -DENABLE_DOWNLOADS=1 \\<br \/>\n21 -DWITH_PARTITION_STORAGE_ENGINE=1 \\<br \/>\n22 -DEXTRA_CHARSETS=all \\<br \/>\n23 -DDEFAULT_CHARSET=utf8 \\<br \/>\n24 -DDEFAULT_COLLATION=utf8_general_ci \\<br \/>\n25 -DWITH_DEBUG=0 \\<br \/>\n26 -DMYSQL_MAINTAINER_MODE=0 \\<br \/>\n27 -DWITH_SSL:STRING=bundled \\<br \/>\n28 -DWITH_ZLIB:STRING=bundled<br \/>\n29 make &#038;&#038; make install<br \/>\n31 chown -R mysql:mysql \/usr\/local\/mysql<br \/>\nmy.cnf?<br \/>\n33 cp support-files\/my-default.cnf \/etc\/my.cnf<br \/>\n[mysqld]<br \/>\n35 vi \/etc\/my.cnf<br \/>\n36 datadir = \/usr\/local\/mysql\/data #MySQL<\/p>\n<p>38 \/usr\/local\/mysql\/scripts\/mysql_install_db &#8211;basedir=\/usr\/local\/mysql &#8211;datadir=\/usr\/local\/mysql\/data &#8211;user=mysql<\/p>\n<p>40 cp support-files\/mysql.server \/etc\/init.d\/mysqld<br \/>\n41 chmod +x \/etc\/init.d\/mysqld<br \/>\nmysql<br \/>\n43 service mysqld start<\/p>\n<p>45 chkconfig mysqld on<\/p>\n<p>47 echo &#8216;PATH=\/usr\/local\/mysql\/bin:$PATH&#8217;>>\/etc\/profile<br \/>\n48 export PATH<\/p>\n<p>50 source \/etc\/profile<br \/>\nroot<\/p>\n<p>52 \/usr\/local\/mysql\/bin\/mysqladmin -uroot -p password<br \/>\n53 cd ..<\/p>\n<p>Installing PHP<\/p>\n<p> 1 tar zxvf php-5.6.30.tar.gz<br \/>\n 2 cd php-5.6.30<br \/>\n 3 .\/configure \\<br \/>\n 4 &#8211;prefix=\/usr\/local\/php \\<br \/>\n 5 &#8211;with-fpm-user=www &#8211;with-fpm-group=www \\<br \/>\n 6 &#8211;with-config-file-path=\/usr\/local\/php\/etc \\<br \/>\n 7 &#8211;with-mhash &#8211;with-mcrypt &#8211;enable-bcmath \\<br \/>\n 8 &#8211;enable-mysqlnd &#8211;with-mysql &#8211;with-mysqli &#8211;with-pdo-mysql \\<br \/>\n 9 &#8211;with-gd &#8211;enable-gd-native-ttf &#8211;with-jpeg-dir &#8211;with-png-dir &#8211;with-freetype-dir \\<br \/>\n10 &#8211;enable-fpm \\<br \/>\n11 &#8211;enable-mbstring \\<br \/>\n12 &#8211;enable-pcntl \\<br \/>\n13 &#8211;enable-sockets \\<br \/>\n14 &#8211;enable-opcache \\<br \/>\n15 &#8211;with-openssl \\<br \/>\n16 &#8211;with-zlib \\<br \/>\n17 &#8211;with-curl \\<br \/>\n18 &#8211;with-libxml-dir \\<br \/>\n19 &#8211;with-iconv-dir<br \/>\n20 make &#038;&#038; make install<br \/>\nphp-fpm<br \/>\n22 mv \/usr\/local\/php\/etc\/php-fpm.conf.default \/usr\/local\/php\/etc\/php-fpm.conf<br \/>\nphp<br \/>\n24 cp php.ini-production \/usr\/local\/php\/etc\/php.ini<br \/>\nphp-fpm<br \/>\n26 cp sapi\/fpm\/init.d.php-fpm \/etc\/init.d\/php-fpm<\/p>\n<p>28 chmod +x \/etc\/init.d\/php-fpm<\/p>\n<p>30 chkconfig php-fpm on#<br \/>\n31 groupadd www &#038;&#038; useradd -d \/home\/www -g www www<br \/>\nphp-fpm<br \/>\n33 service php-fpm start<br \/>\n34 cd ..<br \/>\n35 vim \/etc\/profile<br \/>\nPATH=\/usr\/local\/php\/bin:\/usr\/local\/mysql\/bin:$PATH<br \/>\n37 export PATH<br \/>\n38 source \/etc\/profile<br \/>\nInstall Nginx<\/p>\n<p>tar zxvf nginx-1.10.2.tar.gz<br \/>\ncd nginx-1.10.2<br \/>\n.\/configure \\<br \/>\n&#8211;user=www \\<br \/>\n&#8211;group=www \\<br \/>\n&#8211;prefix=\/usr\/local\/nginx \\<br \/>\n&#8211;conf-path=\/etc\/nginx\/nginx.conf \\<br \/>\n&#8211;error-log-path=\/var\/log\/nginx\/error.log \\<br \/>\n&#8211;http-log-path=\/var\/log\/nginx\/access.log \\<br \/>\n&#8211;pid-path=\/var\/run\/nginx.pid \\<br \/>\n&#8211;with-http_stub_status_module \\<br \/>\n&#8211;with-http_gzip_static_module \\<br \/>\n&#8211;with-http_ssl_module \\<br \/>\n&#8211;with-pcre<br \/>\nmake &#038;&#038; make install<\/p>\n<p>Add Nginx Boot Manager scripts \/etc\/init.d\/nginx<\/p>\n<p>#!\/bin\/sh<br \/>\n#<br \/>\n# nginx &#8211; this script starts and stops the nginx daemon<br \/>\n#<br \/>\n# chkconfig: &#8211; 85 15# description: NGINX is an HTTP(S) server, HTTP(S) reverse \\<br \/>\n# proxy and IMAP\/POP3 proxy server<br \/>\n# processname: nginx# config: \/etc\/nginx\/nginx.conf<br \/>\n# config: \/etc\/sysconfig\/nginx# pidfile: \/var\/run\/nginx.pid<\/p>\n<p># Source function library.<br \/>\n. \/etc\/rc.d\/init.d\/functions<\/p>\n<p># Source networking configuration.<br \/>\n. \/etc\/sysconfig\/network<\/p>\n<p># Check that networking is up.<br \/>\n[ &#8220;$NETWORKING&#8221; = &#8220;no&#8221; ] &#038;&#038; exit 0<\/p>\n<p>nginx=&#8221;\/usr\/sbin\/nginx&#8221;<br \/>\nprog=$(basename $nginx)<\/p>\n<p>NGINX_CONF_FILE=&#8221;\/etc\/nginx\/nginx.conf&#8221;<\/p>\n<p>[ -f \/etc\/sysconfig\/nginx ] &#038;&#038; . \/etc\/sysconfig\/nginx<\/p>\n<p>lockfile=\/var\/lock\/subsys\/nginx<\/p>\n<p>make_dirs() {<br \/>\n  # make required directories<br \/>\n  user=`$nginx -V 2>&#038;1 | grep &#8220;configure arguments:.*&#8211;user=&#8221; | sed &#8216;s\/[^*]*&#8211;user=\\([^ ]*\\).*\/\\1\/g&#8217; -`<br \/>\n  if [ -n &#8220;$user&#8221; ]; then<br \/>\n  if [ -z &#8220;`grep $user \/etc\/passwd`&#8221; ]; then<br \/>\n  useradd -M -s \/bin\/nologin $user<br \/>\n  fi<br \/>\n  options=`$nginx -V 2>&#038;1 | grep &#8216;configure arguments:&#8217;`<br \/>\n  for opt in $options; do<br \/>\n  if [ `echo $opt | grep &#8216;.*-temp-path&#8217;` ]; then<br \/>\n  value=`echo $opt | cut -d &#8220;=&#8221; -f 2`<br \/>\n  if [ ! -d &#8220;$value&#8221; ]; then<br \/>\n  # echo &#8220;creating&#8221; $value<br \/>\n  mkdir -p $value &#038;&#038; chown -R $user $value<br \/>\n  fi<br \/>\n  fi<br \/>\n  done<br \/>\n  fi<br \/>\n}<\/p>\n<p>start() {<br \/>\n  [ -x $nginx ] || exit 5<br \/>\n  [ -f $NGINX_CONF_FILE ] || exit 6<br \/>\n  make_dirs<br \/>\n  echo -n $&#8221;Starting $prog: &#8221;<br \/>\n  daemon $nginx -c $NGINX_CONF_FILE<br \/>\n  retval=$?<br \/>\n  echo<br \/>\n  [ $retval -eq 0 ] &#038;&#038; touch $lockfile<br \/>\n  return $retval<br \/>\n}<\/p>\n<p>stop() {<br \/>\n  echo -n $&#8221;Stopping $prog: &#8221;<br \/>\n  killproc $prog -QUIT<br \/>\n  retval=$?<br \/>\n  echo<br \/>\n  [ $retval -eq 0 ] &#038;&#038; rm -f $lockfile<br \/>\n  return $retval<br \/>\n}<\/p>\n<p>restart() {<br \/>\n  configtest || return $?<br \/>\n  stop<br \/>\n  sleep 1<br \/>\n  start<br \/>\n}<\/p>\n<p>reload() {<br \/>\n  configtest || return $?<br \/>\n  echo -n $&#8221;Reloading $prog: &#8221;<br \/>\n  killproc $nginx -HUP<br \/>\n  RETVAL=$?<br \/>\n  echo<br \/>\n}<\/p>\n<p>force_reload() {<br \/>\n  restart<br \/>\n}<\/p>\n<p>configtest() {<br \/>\n  $nginx -t -c $NGINX_CONF_FILE<br \/>\n}<\/p>\n<p>rh_status() {<br \/>\n  status $prog<br \/>\n}<\/p>\n<p>rh_status_q() {<br \/>\n  rh_status >\/dev\/null 2>&#038;1<br \/>\n}<\/p>\n<p>case &#8220;$1&#8243; in<br \/>\n  start)<br \/>\n  rh_status_q &#038;&#038; exit 0<br \/>\n  $1<br \/>\n  ;;<br \/>\n  stop)<br \/>\n  rh_status_q || exit 0<br \/>\n  $1<br \/>\n  ;;<br \/>\n  restart|configtest)<br \/>\n  $1<br \/>\n  ;;<br \/>\n  reload)<br \/>\n  rh_status_q || exit 7<br \/>\n  $1<br \/>\n  ;;<br \/>\n  force-reload)<br \/>\n  force_reload<br \/>\n  ;;<br \/>\n  status)<br \/>\n  rh_status<br \/>\n  ;;<br \/>\n  condrestart|try-restart)<br \/>\n  rh_status_q || exit 0<br \/>\n  ;;<br \/>\n  *)<br \/>\n  echo $&#8221;Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}&#8221;<br \/>\n  exit 2<br \/>\nesac<br \/>\nUsage Guidelines<\/p>\n<p>chmod +x \/etc\/init.d\/nginx<br \/>\nservice nginx start # start nginx service<br \/>\nchkconfig nginx on # boot<br \/>\ncd ..<br \/>\nSo far, LNMP environment has been set up is completed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CentOS 6.8 to compile and install LNMP Brief<\/p>\n<p>deas: According to information systems and Linux systems company&#8217;s Web site, select the appropriate installation package for installation<\/p>\n<p>First, view system information<\/p>\n<p># Uname -a # View kernel \/operating system \/the CPU information # Head -n 1 \/etc\/issue # view the operating system version # Grep MemTotal [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6757"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6757"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6757\/revisions"}],"predecessor-version":[{"id":6758,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6757\/revisions\/6758"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}