您好,登錄后才能下訂單哦!
最好是初始的linux Centos7版本 然后把所有安裝包和執行腳本都要拷貝到/mnt目錄下面
#!/usr/bin/bash
yum -y install gcc gcc-c++ make pcre-devel expat-devel perl apr* #安裝所有必須組件
####################安裝Apache
#安裝所需編譯器和組件包
if [ ! -d httpd-2.4.29 ];then
tar jxvf httpd-2.4.29.tar.bz2 ?#解壓Apache源碼包
fi
cd httpd-2.4.29/ #移動到解壓后目錄
./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 #編譯和安裝
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
chkconfig --add httpd #將httpd加入到SERVICE管理器
#備份httpd服務配置文件
[ ! -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/#//' /usr/local/httpd/conf/httpd.conf
rm -rf /etc/httpd.conf
ln -s /usr/local/httpd/conf/httpd.conf /etc/#創建配置文件的軟連接
ln -s /usr/local/httpd/bin/* /usr/local/bin/#創建命令的軟連接
wait?
#######################安裝MySQL##################################################
cd /mnt#回到mnt目錄
yum -y install git#安裝Git組件
yum install -y cmake#安裝cmake工具
yum install -y ncurses-devel autoconf#安裝ncurses組件
tar zxvf mysql-5.6.26.tar.gz
cd mysql-5.6.26#解壓MySQL 并cd到目錄
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
#定義安裝環境
#-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#進行編譯和安裝
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf#復制模板配置文件
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld#復制執行腳本
chmod 755 /etc/init.d/mysqld #給執行腳本添加執行權限
chkconfig --add /etc/init.d/mysqld && chkconfig ?mysqld --level 235 on#給service工具添加MySQL服務
#echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
#source /etc/profile#定義MySQL命令到系統環境變量
ln -s /usr/local/mysql/bin/* /usr/local/bin
useradd -s /sbin/nologin mysql#創建MySQL執行用戶
chown -R mysql:mysql /usr/local/mysql/#給該MySQL安裝目錄的屬主跟屬組
/usr/local/mysql/scripts/mysql_install_db \
--user=mysql \
--ldata=/var/lib/mysql \
--basedir=/usr/local/mysql \
--datadir=/home/mysql
sed -i '46s/.*/basedir=\/usr\/local\/mysql ?/' /etc/init.d/mysqld#添加MySQL執行腳本
sed -i '47s/.*/datadir=\/home\/mysql/' /etc/init.d/mysqld
#mysqladmin -u root -p password "abc123" #給root賬號設置密碼
############################安裝PHP#####################################
cd /mnt
yum -y install gd libpng libpng-devel pcre pcre-devel libxml2-devel #安裝必要組件
tar xjvf php-5.6.11.tar.bz2
cd php-5.6.11#解壓并進入到 解壓后目錄
./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#定義安裝環境
cp php.ini-development /usr/local/php5/php.ini#復制PHP配置模板文件為新配置文件
ln -s /usr/local/php5/bin/* /usr/local/bin/
ln -s /usr/local/php5/sbin/* /usr/local/sbin/#創建命令的軟連接
echo "
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps" >> /etc/httpd.conf#申明http支持php
sed -i ?'258s/index.html/index.php index.html/' /etc/httpd.conf#修改http主頁格式為PHP結尾
以下是 源碼包的的地址:
鏈接:https://pan.baidu.com/s/1M0p7skMwgXSsfvVoJm0kjQ?
提取碼:10pj?
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。