{"id":6415,"date":"2017-01-03T11:31:49","date_gmt":"2017-01-03T03:31:49","guid":{"rendered":"http:\/\/rmohan.com\/?p=6415"},"modified":"2017-01-03T11:31:49","modified_gmt":"2017-01-03T03:31:49","slug":"centos6-8-compiler-installation-apache2-4-25-mysql5-7-16-php5-6-29-initialization","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6415","title":{"rendered":"CentOS6.8 compiler installation Apache2.4.25, MySQL5.7.16, PHP5.6.29 initialization"},"content":{"rendered":"<p>CentOS6.8 compiler installation Apache2.4.25, MySQL5.7.16, PHP5.6.29<br \/>\ninitialization<\/p>\n<p># Fixed IP address<br \/>\nvi \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<br \/>\nONBOOT=yes<br \/>\nBOOTPROTO=none<br \/>\nDNS1=202.96.209.133<br \/>\nIPADDR=192.168.159.68<br \/>\nPREFIX=24<br \/>\nGATEWAY=192.168.159.2<\/p>\n<p># The base library<br \/>\nyum groupinstall base<br \/>\nyum grouplist<br \/>\nyum groupinstall &#8216;Development tools&#8217;<br \/>\nyum groupinstall &#8216;Debugging Tools&#8217;<br \/>\nyum groupinstall &#8216;Compatibility libraries&#8217;<\/p>\n<p>Apache<\/p>\n<p>mkdir \/app\/src -p<br \/>\ncd \/app\/src\/<br \/>\nwget -c http:\/\/mirrors.aliyun.com\/apache\/apr\/apr-1.5.2.tar.gz<br \/>\nwget -c http:\/\/mirrors.aliyun.com\/apache\/apr\/apr-util-1.5.4.tar.gz<br \/>\nwget -c http:\/\/mirrors.aliyun.com\/apache\/httpd\/httpd-2.4.25.tar.gz<br \/>\ntar xf apr-1.5.2.tar.gz<\/p>\n<p>apr<br \/>\ncd apr-1.5.2<br \/>\n.\/configure &#8211;prefix=\/app\/apr-1.5.2<br \/>\nmake &amp;&amp; make install<br \/>\nln -sv \/app\/apr-1.5.2\/ \/app\/apr<\/p>\n<p>apr-util<br \/>\ncd ..<br \/>\ntar xf apr-util-1.5.4.tar.gz<br \/>\ncd apr-util-1.5.4<br \/>\n.\/configure &#8211;prefix=\/app\/apr-util-1.5.4 &#8211;<br \/>\n-with-apr=\/app\/apr-1.5.2\/<br \/>\nmake &amp;&amp; make install<br \/>\nln -sv \/app\/apr-util-1.5.4\/ \/app\/apr-util<\/p>\n<p>httpd<br \/>\nyum install pcre-devel zlib-devel openssl-devel -y<br \/>\ncd ..<br \/>\ntar xf httpd-2.4.25.tar.gz<br \/>\ncd httpd-2.4.25<br \/>\n.\/configure &#8211;prefix=\/app\/httpd-2.4.25 &#8211;with-apr=\/app\/apr-1.5.2\/ \\<br \/>\n&#8211;with-apr-util=\/app\/apr-util-1.5.4\/ &#8211;enable-so &#8211;enable-deflate &#8211;enable-expires \\<br \/>\n&#8211;enable-headers &#8211;enable-ssl &#8211;enable-rewrite &#8211;enable-mpms-shared=all \\<br \/>\n&#8211;with-mpm=prefork &#8211;enable-mods-shared=most<br \/>\nmake<br \/>\nmake install<\/p>\n<p>ln -sv \/app\/httpd-2.4.25\/ \/app\/httpd<br \/>\nvi \/etc\/profile.d\/httpd.sh<br \/>\nexport PATH=\/app\/httpd\/bin:$PATH<br \/>\n. \/etc\/profile.d\/httpd.sh<\/p>\n<p>ls \/app\/httpd\/modules\/<\/p>\n<p>apachectl -t -D DUMP_MODULES<br \/>\nvi \/app\/httpd\/conf\/httpd.conf<br \/>\nServerName localhost:80<br \/>\napachectl start<br \/>\nnetstat -tunlp | grep httpd<br \/>\ncp .\/httpd \/etc\/init.d\/httpd<\/p>\n<p>pid?lock<br \/>\nvi \/etc\/init.d\/httpd<br \/>\napachectl=\/app\/httpd\/bin\/apachectl<br \/>\nhttpd=${HTTPD-\/app\/httpd\/bin\/httpd}<br \/>\nprog=httpd<br \/>\npidfile=${PIDFILE-\/app\/httpd\/logs\/httpd.pid}<br \/>\nlockfile=${LOCKFILE-\/app\/httpd\/logs\/httpd}<br \/>\napachectl stop<br \/>\nchmod +x \/etc\/init.d\/httpd<br \/>\n\/etc\/init.d\/httpd start<br \/>\nchkconfig &#8211;list | grep httpd<br \/>\nchkconfig &#8211;add httpd<br \/>\nchkconfig &#8211;list httpd<br \/>\nchkconfig httpd on<br \/>\nchkconfig &#8211;list httpd<\/p>\n<p>#!\/bin\/bash<br \/>\n#<br \/>\n# httpd\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Startup script for the Apache HTTP Server<br \/>\n#<br \/>\n# chkconfig: &#8211; 85 15<br \/>\n# description: The Apache HTTP Server is an efficient and extensible\u00a0 \\<br \/>\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 server implementing the current HTTP standards.<br \/>\n# processname: httpd<br \/>\n# config: \/etc\/httpd\/conf\/httpd.conf<br \/>\n# config: \/etc\/sysconfig\/httpd<br \/>\n# pidfile: \/var\/run\/httpd\/httpd.pid<br \/>\n#<br \/>\n### BEGIN INIT INFO<br \/>\n# Provides: httpd<br \/>\n# Required-Start: $local_fs $remote_fs $network $named<br \/>\n# Required-Stop: $local_fs $remote_fs $network<br \/>\n# Should-Start: distcache<br \/>\n# Short-Description: start and stop Apache HTTP Server<br \/>\n# Description: The Apache HTTP Server is an extensible server<br \/>\n#\u00a0 implementing the current HTTP standards.<br \/>\n### END INIT INFO<\/p>\n<p># Source function library.<br \/>\n. \/etc\/rc.d\/init.d\/functions<\/p>\n<p>if [ -f \/etc\/sysconfig\/httpd ]; then<br \/>\n. \/etc\/sysconfig\/httpd<br \/>\nfi<\/p>\n<p># Start httpd in the C locale by default.<br \/>\nHTTPD_LANG=${HTTPD_LANG-&#8220;C&#8221;}<\/p>\n<p># This will prevent initlog from swallowing up a pass-phrase prompt if<br \/>\n# mod_ssl needs a pass-phrase from the user.<br \/>\nINITLOG_ARGS=&#8221;&#8221;<\/p>\n<p># Set HTTPD=\/usr\/sbin\/httpd.worker in \/etc\/sysconfig\/httpd to use a server<br \/>\n# with the thread-based &#8220;worker&#8221; MPM; BE WARNED that some modules may not<br \/>\n# work correctly with a thread-based MPM; notably PHP will refuse to start.<\/p>\n<p># Path to the apachectl script, server binary, and short-form for messages.<br \/>\napachectl=\/app\/httpd\/bin\/apachectl<br \/>\nhttpd=${HTTPD-\/app\/httpd\/bin\/httpd}<br \/>\nprog=httpd<br \/>\npidfile=${PIDFILE-\/app\/httpd\/logs\/httpd.pid}<br \/>\nlockfile=${LOCKFILE-\/app\/httpd\/logs\/httpd}<br \/>\nRETVAL=0<br \/>\nSTOP_TIMEOUT=${STOP_TIMEOUT-10}<\/p>\n<p># The semantics of these two functions differ from the way apachectl does<br \/>\n# things &#8212; attempting to start while running is a failure, and shutdown<br \/>\n# when not running is also a failure.\u00a0 So we just do it the way init scripts<br \/>\n# are expected to behave here.<br \/>\nstart() {<br \/>\necho -n $&#8221;Starting $prog: &#8221;<br \/>\nLANG=$HTTPD_LANG daemon &#8211;pidfile=${pidfile} $httpd $OPTIONS<br \/>\nRETVAL=$?<br \/>\necho<br \/>\n[ $RETVAL = 0 ] &amp;&amp; touch ${lockfile}<br \/>\nreturn $RETVAL<br \/>\n}<\/p>\n<p># When stopping httpd, a delay (of default 10 second) is required<br \/>\n# before SIGKILLing the httpd parent; this gives enough time for the<br \/>\n# httpd parent to SIGKILL any errant children.<br \/>\nstop() {<br \/>\nstatus -p ${pidfile} $httpd &gt; \/dev\/null<br \/>\nif [[ $? = 0 ]]; then<br \/>\necho -n $&#8221;Stopping $prog: &#8221;<br \/>\nkillproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd<br \/>\nelse<br \/>\necho -n $&#8221;Stopping $prog: &#8221;<br \/>\nsuccess<br \/>\nfi<br \/>\nRETVAL=$?<br \/>\necho<br \/>\n[ $RETVAL = 0 ] &amp;&amp; rm -f ${lockfile} ${pidfile}<br \/>\n}<\/p>\n<p>reload() {<br \/>\necho -n $&#8221;Reloading $prog: &#8221;<br \/>\nif ! LANG=$HTTPD_LANG $httpd $OPTIONS -t &gt;&amp;\/dev\/null; then<br \/>\nRETVAL=6<br \/>\necho $&#8221;not reloading due to configuration syntax error&#8221;<br \/>\nfailure $&#8221;not reloading $httpd due to configuration syntax error&#8221;<br \/>\nelse<br \/>\n# Force LSB behaviour from killproc<br \/>\nLSB=1 killproc -p ${pidfile} $httpd -HUP<br \/>\nRETVAL=$?<br \/>\nif [ $RETVAL -eq 7 ]; then<br \/>\nfailure $&#8221;httpd shutdown&#8221;<br \/>\nfi<br \/>\nfi<br \/>\necho<br \/>\n}<\/p>\n<p># See how we were called.<br \/>\ncase &#8220;$1&#8243; in<br \/>\nstart)<br \/>\nstart<br \/>\n;;<br \/>\nstop)<br \/>\nstop<br \/>\n;;<br \/>\nstatus)<br \/>\nstatus -p ${pidfile} $httpd<br \/>\nRETVAL=$?<br \/>\n;;<br \/>\nrestart)<br \/>\nstop<br \/>\nstart<br \/>\n;;<br \/>\ncondrestart|try-restart)<br \/>\nif status -p ${pidfile} $httpd &gt;&amp;\/dev\/null; then<br \/>\nstop<br \/>\nstart<br \/>\nfi<br \/>\n;;<br \/>\nforce-reload|reload)<br \/>\nreload<br \/>\n;;<br \/>\ngraceful|help|configtest|fullstatus)<br \/>\n$apachectl $@<br \/>\nRETVAL=$?<br \/>\n;;<br \/>\n*)<br \/>\necho $&#8221;Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}&#8221;<br \/>\nRETVAL=2<br \/>\nesac<\/p>\n<p>exit $RETVAL<\/p>\n<p>MySQL<\/p>\n<p>wget -c http:\/\/mirrors.sohu.com\/mysql\/MySQL-5.7\/mysql-boost-5.7.16.tar.gz<br \/>\nwget -c https:\/\/cmake.org\/files\/v3.7\/cmake-3.7.1.tar.gz<br \/>\ntar xf cmake-3.7.1.tar.gz<br \/>\ncd cmake-3.7.1<br \/>\nless README.rst<br \/>\n.\/bootstrap &#8211;prefix=\/app\/cmake-3.7.1<br \/>\ngmake<br \/>\ngmake install<br \/>\ncd ..<br \/>\nln -sv \/app\/cmake-3.7.1\/ \/app\/cmake<br \/>\nexport PATH=\/app\/cmake\/bin:$PATH<br \/>\ntar xf mysql-boost-5.7.16.tar.gz<br \/>\ncd mysql-5.7.16\/<br \/>\nyum install ncurses-devel<br \/>\ncmake . -DCMAKE_INSTALL_PREFIX=\/app\/mysql-5.7.16 -DMYSQL_DATADIR=\/app\/mysql-5.7.16\/data \\<br \/>\n-DWITH_BOOST=\/app\/src\/mysql-5.7.16\/boost\/ -DENABLED_LOCAL_INFILE=1 -DDEFAULT_CHARSET=utf8 \\<br \/>\n-DDEFAULT_COLLATION=utf8_general_ci -DWITH_ARCHIVE_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1<br \/>\nmake<br \/>\nmake install<\/p>\n<p>cd \/app\/mysql-5.7.16<br \/>\nmkdir data<br \/>\nuseradd mysql -M -s \/sbin\/nologin<br \/>\nchown mysql.mysql \/app\/mysql-5.7.16\/ -R<\/p>\n<p>mv \/etc\/my.cnf \/etc\/my.cnf.ori<br \/>\nbin\/mysqld &#8211;initialize &#8211;user=mysql &#8211;basedir=\/app\/mysql-5.7.16\/ &#8211;datadir=\/app\/mysql-5.7.16\/data\/<br \/>\ncp support-files\/mysql.server \/etc\/init.d\/mysqld<br \/>\n\/etc\/init.d\/mysqld start<br \/>\nbin\/mysql -uroot -p<br \/>\nALTER USER root@localhost IDENTIFIED BY &#8216;root&#8217;;<\/p>\n<p>PHP<\/p>\n<p>cd \/app\/src<br \/>\ntar xf php-5.6.29.tar.gz<br \/>\ncd php-5.6.29<br \/>\nyum install libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel<br \/>\nwget -O \/etc\/yum.repos.d\/epel.repo http:\/\/mirrors.aliyun.com\/repo\/epel-6.repo<br \/>\nyum install libmcrypt-devel<br \/>\n.\/configure &#8211;prefix=\/app\/php-5.6.29 &#8211;with-apxs2=\/app\/httpd-2.4.25\/bin\/apxs \\<br \/>\n&#8211;with-mysql &#8211;with-mysqli &#8211;enable-pdo &#8211;with-pdo-mysql &#8211;with-mysql-sock \\<br \/>\n&#8211;enable-xml &#8211;with-libxml-dir &#8211;enable-sockets &#8211;with-curl \\<br \/>\n&#8211;with-gd &#8211;enable-gd-native-ttf &#8211;with-freetype-dir &#8211;with-jpeg-dir &#8211;with-png-dir &#8211;with-zlib \\<br \/>\n&#8211;with-mcrypt &#8211;with-openssl &#8211;with-mhash &#8211;enable-zip &#8211;enable-mbstring &#8211;enable-mbregex \\<br \/>\n&#8211;with-iconv &#8211;enable-static<br \/>\nmake<br \/>\nmake install<br \/>\nvi \/app\/httpd\/conf\/httpd.conf<br \/>\nDirectoryIndex index.php index.html<br \/>\nAddType application\/x-httpd-php .php<br \/>\nAddType application\/x-httpd-php-source .phps<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CentOS6.8 compiler installation Apache2.4.25, MySQL5.7.16, PHP5.6.29 initialization<\/p>\n<p># Fixed IP address vi \/etc\/sysconfig\/network-scripts\/ifcfg-eth0 ONBOOT=yes BOOTPROTO=none DNS1=202.96.209.133 IPADDR=192.168.159.68 PREFIX=24 GATEWAY=192.168.159.2<\/p>\n<p># The base library yum groupinstall base yum grouplist yum groupinstall &#8216;Development tools&#8217; yum groupinstall &#8216;Debugging Tools&#8217; yum groupinstall &#8216;Compatibility libraries&#8217;<\/p>\n<p>Apache<\/p>\n<p>mkdir \/app\/src -p cd \/app\/src\/ wget -c http:\/\/mirrors.aliyun.com\/apache\/apr\/apr-1.5.2.tar.gz wget -c http:\/\/mirrors.aliyun.com\/apache\/apr\/apr-util-1.5.4.tar.gz wget -c http:\/\/mirrors.aliyun.com\/apache\/httpd\/httpd-2.4.25.tar.gz [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6415"}],"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=6415"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6415\/revisions"}],"predecessor-version":[{"id":6416,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6415\/revisions\/6416"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}