设为首页 加入收藏

TOP

实现LAMP(二)
2017-10-16 18:18:50 】 浏览:1453
Tags:实现 LAMP
1.6.2.tar.gz httpd-2.4.27.tar.bz2 php-7.1.10.tar.xz apr-util-1.6.0.tar.gz mariadb-10.2.8-linux-x86_64.tar.gz

centos6

apr-1.6.2.tar.gz
httpd-2.4.27.tar.bz2
php-5.6.31.tar.xz
xcache-3.2.0.tar.bz2
apr-util-1.6.0.tar.gz
mariadb-5.5.57-linux-x86_64.tar.gz

3)编写脚本

#!/bin/bash
#-------------------------------------------------
#Filename:lamp-script.sh
#Description:
#Revision:2.0
#Date:
#-------------------------------------------------
creat_lamp_on_centos6 ()
{
####1.编译httpd2.4
yum groupinstall "development tools" -y

yum install openssl-devel pcre-devel expat-devel -y

cd  /app

tar xvf apr-1.6.2.tar.gz 

tar xvf apr-util-1.6.0.tar.gz 

tar xvf httpd-2.4.27.tar.bz2 

cp -r /app/apr-1.6.2  /app/httpd-2.4.27/srclib/apr

cp -r /app/apr-util-1.6.0  /app/httpd-2.4.27/srclib/apr-util

cd httpd-2.4.27/

./configure --prefix=/app/httpd24 --enable-so --enable-ssl --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork

make && make install

cat > /etc/profile.d/lamp.sh <<eof
PATH=/app/httpd24/bin/:$PATH
eof

bash /etc/profile.d/lamp.sh

yum install httpd -y

cp  /etc/rc.d/init.d/httpd /etc/init.d/httpd24

sed  -i 's@apachectl=/usr/sbin/apachectl@apachectl=/app/httpd24/bin/apachectl@ ;s@httpd=${HTTPD-/usr/sbin/httpd}@httpd=${HTTPD-/app/httpd24/bin/httpd}@ ; s@pidfile=${PIDFILE-/var/run/httpd/httpd.pid}@pidfile=${PIDFILE-/app/httpd24/logs/httpd.pid}@ ; s@lockfile=${LOCKFILE-/var/lock/subsys/httpd}@lockfile=${LOCKFILE-/var/lock/subsys/httpd24}@' /etc/init.d/httpd

chkconfig --add httpd24

chkconfig httpd24 on

service httpd24 start

####2.二进制安装mariadb
####可以在另台主机上进行安装,这里是在本地安装
cd /app

tar xvf /app/mariadb-5.5.57-linux-x86_64.tar.gz  -C /usr/local/

cd /usr/local/

ln -s mariadb-5.5.57-linux-x86_64/ mysql

useradd -r -m -d /app/mysqldb -s /sbin/nologin mysql 

cd mysql/

./scripts/mysql_install_db --datadir=/app/mysqldb --user=mysql

mkdir /etc/mysql

cp support-files/my-large.cnf   /etc/mysql/my.cnf

sed -i '27a\datadir = /app/mysqldb \ninnodb_file_per_table = ON \nskip_name_resolve = ON' /etc/mysql/my.cnf

cp support-files/mysql.server /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig mysqld on 

touch /var/log/mysqld.log

chown mysql /var/log/mysqld.log

service mysqld start

cat >/etc/profile.d/lamp.sh <<end
PATH=/app/httpd24/bin/:/usr/local/mysql/bin/:$PATH
end

bash /etc/profile.d/lamp.sh

/usr/local/mysql/bin/mysqladmin -u root password 'xm1234'

cat > /app/mysql-file.txt <<eof
create database wpdb;
grant all on wpdb.* to shenxm@'%' identified by 'xm1234';
eof

mysql -uroot -pxm1234< /app/mysql-file.txt

###3.源码编译php
yum install libxml2-devel bzip2-devel libmcrypt-devel  -y #(epel源)

cd /app

tar xvf php-5.6.31.tar.xz 

cd /app/php-5.6.31

./configure --prefix=/app/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-png-dir --with-jpeg-dir --with-freetype-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/app/httpd24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc
首页 上一页 1 2 3 4 下一页 尾页 2/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇linux_base_commond_two 下一篇在ubuntu16.04中安装apache2+mods..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目