April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

CentOS6.8 compiler installation Apache2.4.25, MySQL5.7.16, PHP5.6.29 initialization

CentOS6.8 compiler installation Apache2.4.25, MySQL5.7.16, PHP5.6.29
initialization

# 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

# The base library
yum groupinstall base
yum grouplist
yum groupinstall ‘Development tools’
yum groupinstall ‘Debugging Tools’
yum groupinstall ‘Compatibility libraries’

Apache

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
tar xf apr-1.5.2.tar.gz

apr
cd apr-1.5.2
./configure –prefix=/app/apr-1.5.2
make && make install
ln -sv /app/apr-1.5.2/ /app/apr

apr-util
cd ..
tar xf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure –prefix=/app/apr-util-1.5.4 –
-with-apr=/app/apr-1.5.2/
make && make install
ln -sv /app/apr-util-1.5.4/ /app/apr-util

httpd
yum install pcre-devel zlib-devel openssl-devel -y
cd ..
tar xf httpd-2.4.25.tar.gz
cd httpd-2.4.25
./configure –prefix=/app/httpd-2.4.25 –with-apr=/app/apr-1.5.2/ \
–with-apr-util=/app/apr-util-1.5.4/ –enable-so –enable-deflate –enable-expires \
–enable-headers –enable-ssl –enable-rewrite –enable-mpms-shared=all \
–with-mpm=prefork –enable-mods-shared=most
make
make install

ln -sv /app/httpd-2.4.25/ /app/httpd
vi /etc/profile.d/httpd.sh
export PATH=/app/httpd/bin:$PATH
. /etc/profile.d/httpd.sh

ls /app/httpd/modules/

apachectl -t -D DUMP_MODULES
vi /app/httpd/conf/httpd.conf
ServerName localhost:80
apachectl start
netstat -tunlp | grep httpd
cp ./httpd /etc/init.d/httpd

pid?lock
vi /etc/init.d/httpd
apachectl=/app/httpd/bin/apachectl
httpd=${HTTPD-/app/httpd/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/app/httpd/logs/httpd.pid}
lockfile=${LOCKFILE-/app/httpd/logs/httpd}
apachectl stop
chmod +x /etc/init.d/httpd
/etc/init.d/httpd start
chkconfig –list | grep httpd
chkconfig –add httpd
chkconfig –list httpd
chkconfig httpd on
chkconfig –list httpd

#!/bin/bash
#
# httpd        Startup script for the Apache HTTP Server
#
# chkconfig: – 85 15
# description: The Apache HTTP Server is an efficient and extensible  \
#          server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
#  implementing the current HTTP standards.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi

# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-“C”}

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=””

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based “worker” MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/app/httpd/bin/apachectl
httpd=${HTTPD-/app/httpd/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/app/httpd/logs/httpd.pid}
lockfile=${LOCKFILE-/app/httpd/logs/httpd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}

# The semantics of these two functions differ from the way apachectl does
# things — attempting to start while running is a failure, and shutdown
# when not running is also a failure.  So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $”Starting $prog: ”
LANG=$HTTPD_LANG daemon –pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}

# When stopping httpd, a delay (of default 10 second) is required
# before SIGKILLing the httpd parent; this gives enough time for the
# httpd parent to SIGKILL any errant children.
stop() {
status -p ${pidfile} $httpd > /dev/null
if [[ $? = 0 ]]; then
echo -n $”Stopping $prog: ”
killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
else
echo -n $”Stopping $prog: ”
success
fi
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}

reload() {
echo -n $”Reloading $prog: ”
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=6
echo $”not reloading due to configuration syntax error”
failure $”not reloading $httpd due to configuration syntax error”
else
# Force LSB behaviour from killproc
LSB=1 killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
if [ $RETVAL -eq 7 ]; then
failure $”httpd shutdown”
fi
fi
echo
}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart|try-restart)
if status -p ${pidfile} $httpd >&/dev/null; then
stop
start
fi
;;
force-reload|reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $”Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}”
RETVAL=2
esac

exit $RETVAL

MySQL

wget -c http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-boost-5.7.16.tar.gz
wget -c https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz
tar xf cmake-3.7.1.tar.gz
cd cmake-3.7.1
less README.rst
./bootstrap –prefix=/app/cmake-3.7.1
gmake
gmake install
cd ..
ln -sv /app/cmake-3.7.1/ /app/cmake
export PATH=/app/cmake/bin:$PATH
tar xf mysql-boost-5.7.16.tar.gz
cd mysql-5.7.16/
yum install ncurses-devel
cmake . -DCMAKE_INSTALL_PREFIX=/app/mysql-5.7.16 -DMYSQL_DATADIR=/app/mysql-5.7.16/data \
-DWITH_BOOST=/app/src/mysql-5.7.16/boost/ -DENABLED_LOCAL_INFILE=1 -DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1
make
make install

cd /app/mysql-5.7.16
mkdir data
useradd mysql -M -s /sbin/nologin
chown mysql.mysql /app/mysql-5.7.16/ -R

mv /etc/my.cnf /etc/my.cnf.ori
bin/mysqld –initialize –user=mysql –basedir=/app/mysql-5.7.16/ –datadir=/app/mysql-5.7.16/data/
cp support-files/mysql.server /etc/init.d/mysqld
/etc/init.d/mysqld start
bin/mysql -uroot -p
ALTER USER root@localhost IDENTIFIED BY ‘root’;

PHP

cd /app/src
tar xf php-5.6.29.tar.gz
cd php-5.6.29
yum install libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum install libmcrypt-devel
./configure –prefix=/app/php-5.6.29 –with-apxs2=/app/httpd-2.4.25/bin/apxs \
–with-mysql –with-mysqli –enable-pdo –with-pdo-mysql –with-mysql-sock \
–enable-xml –with-libxml-dir –enable-sockets –with-curl \
–with-gd –enable-gd-native-ttf –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib \
–with-mcrypt –with-openssl –with-mhash –enable-zip –enable-mbstring –enable-mbregex \
–with-iconv –enable-static
make
make install
vi /app/httpd/conf/httpd.conf
DirectoryIndex index.php index.html
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>