Lamp source code compilation installation script + source package
Preferably the initial linux Centos7 version and then copy all the installation packages and execution scripts to the / mnt directory
#! / usr/bin/bash
Yum-y install gcc gcc-c++ make pcre-devel expat-devel perl apr* # installs all required components
# install Apache
# install required compilers and component packages
If [!-d httpd-2.4.29]; then
Tar jxvf httpd-2.4.29.tar.bz2 # decompress the Apache source code package
Fi
Cd httpd-2.4.29/ # move to unzipped directory
. / configure-prefix=/usr/local/httpd-enable-so-enable-rewrite-enable-charest-lite-enable-cgi
#-prefix=/usr/local/httpd
#-enable-so
#-enable-rewrite
#-enable-charest-lite
#-enable-cgi
Make-j16 & & make install # compilation and installation
Cp / usr/local/httpd/bin/apachectl / etc/init.d/httpd
Chkconfig-- add httpd # adds httpd to the SERVICE Manager
# backup httpd service configuration file
[!-d / usr/local/httpd/conf/httpd.conf.bak] & & cp / usr/local/httpd/conf/httpd.conf / usr/local/httpd/conf/httpd.conf.bak
Sed-I '199s Greater Greater / usr/local/httpd/conf/httpd.conf
Rm-rf / etc/httpd.conf
Ln-s / usr/local/httpd/conf/httpd.conf / etc/# create a soft connection for the configuration file
Ln-s / usr/local/httpd/bin/* / usr/local/bin/# create a soft connection for the command
Wait
# install MySQL###
Cd / mnt# returns to the mnt directory
Yum-y install git# installs Git components
Yum install-y cmake# install cmake tool
Yum install-y ncurses-devel autoconf# installs ncurses components
Tar zxvf mysql-5.6.26.tar.gz
Cd mysql-5.6.26# unzips MySQL and cd to directory
Cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all-DSYSCONFIDIR=/etc-DMYSQL_DATADIR=/home/mysql/-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock
# define the installation environment
#-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\
#-DDEFAULT_COLLATION=utf8_general_ci\
#-DEXTRA_CHARSETS=all\
#-DSYSCONFIDIR=/etc\
#-DMYSQL_DATADIR=/home/mysql/\
#-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock
Make-j16 & & make install# for compilation and installation
Cp / usr/local/mysql/support-files/my-default.cnf / etc/my.cnf# replication template configuration file
Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysqld# replication execution script
Chmod 755 / etc/init.d/mysqld # add execution permissions to the execution script
Chkconfig-- add / etc/init.d/mysqld & & chkconfig mysqld-- level 235 on# add MySQL services to the service tool
# echo "PATH=$PATH:/usr/local/mysql/bin" > > / etc/profile
# source / etc/profile# defines MySQL commands to system environment variables
Ln-s / usr/local/mysql/bin/* / usr/local/bin
Useradd-s / sbin/nologin mysql# create MySQL execution user
Chown-R mysql:mysql / usr/local/mysql/# to the master and subordinate group of the MySQL installation directory
/ usr/local/mysql/scripts/mysql_install_db\
-- user=mysql\
-- ldata=/var/lib/mysql\
-- basedir=/usr/local/mysql\
-- datadir=/home/mysql
Sed-I '46sUnip. MySQL MySQL execution script adding MySQL to etc/init.d/mysqld#
Sed-I '47sUnip. Accountablesdatadir =\ / home\ / mysql/' / etc/init.d/mysqld
# mysqladmin-u root-p password "abc123" # set a password for the root account
# # installing PHP##
Cd / mnt
Yum-y install gd libpng libpng-devel pcre pcre-devel libxml2-devel # install the necessary components
Tar xjvf php-5.6.11.tar.bz2
Decompress cd php-5.6.11# and enter the directory after decompression.
/ configure-- prefix=/usr/local/php5-- with-gd-- with-zlib-- with-apxs2=/usr/local/httpd/bin/apxs-- with-mysql=/usr/local/mysql-- with-config-file-path=/usr/local/php5
Make-j16 & & make install# defines the installation environment
Cp php.ini-development / usr/local/php5/php.ini# copy PHP configuration template file as new configuration file
Ln-s / usr/local/php5/bin/* / usr/local/bin/
Ln-s / usr/local/php5/sbin/* / usr/local/sbin/# create a soft connection for the command
Echo "
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps "> > / etc/httpd.conf# states that http supports php
Sed-I '258s/index.html/index.php index.html/' / etc/httpd.conf# modifies the http home page format to end with PHP
The following is the address of the source packet:
Link: https://pan.baidu.com/s/1M0p7skMwgXSsfvVoJm0kjQ
Extraction code: 10pj