首页 > Web开发 > 详细

Web群集----LAMP 架构

时间:2020-11-10 10:27:35      阅读:26      评论:0      收藏:0      [点我收藏+]
Web群集----LAMP 架构 脚本
LAMP 架构 脚本
#######编译安装Apache############################################################################3
iptables -F
setenforce 0
cd /opt
mkdir apache  mysql php
cd apache

#上传压缩包  apr-1.6.2.tar.gz       httpd-2.4.29.tar.bz2    apr-util-1.6.0.tar.gz
tar zxvf apr-1.6.2.tar.gz
tar zxvf apr-util-1.6.0.tar.gz 
tar jxvf httpd-2.4.29.tar.bz2
mv apr-1.6.2 httpd-2.4.29/srclib/apr
mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util
yum -y install gcc gcc-c++ make pcre-devel expat-devel perl

#配置
cd httpd-2.4.29/
./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi --enable-deflate --enable-cgi
#编译安装
make && make install

#添加启动脚本到service管理
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vim /etc/init.d/httpd
行首添加下面两行
   # chkconfig: 35 85 21 //35级别自动运行 第85个启动 第21个关闭
   # description: Apache is a world wide web server
   # chkconfig: 35 85 21 
   # description: Apache is a world wide web server

   这里注意添加的行要有#
chkconfig --add httpd

ln -s /usr/local/httpd/conf/httpd.conf /etc/httpd.conf
vim /etc/httpd.conf
ServerName www.abc.com:80
Listen 192.168.100.120:80

#添加systemctl 管理
ln -s /usr/local/httpd/bin/* /usr/local/bin/

httpd -t
101和97取消注释
systemctl start httpd
netstat -ntap | grep 80

###############编译安装Mysql################################################
cd /opt/mysql
yum install ncurses-devel autoconf cmake -y
#上传 mysql-5.6.26.tar.gz
tar zxvf mysql-5.6.26.tar.gz
cd mysql-5.6.26

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

make && make install

rm -rf /etc/my.cnf
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld

cd /etc/init.d/
chmod 755 mysqld

chkconfig --add /etc/init.d/mysqld
chkconfig  mysqld --level 35 on

echo "PATH=$PATH:/usr/local/mysql/bin">> /etc/profile
source /etc/profile

useradd -s /sbin/nologin mysql
chown -R mysql.mysql /usr/local/mysql

cd /opt/mysql/mysql-5.6.26
/usr/local/mysql/scripts/mysql_install_db  --user=mysql  --ldata=/var/lib/mysql  --basedir=/usr/local/mysql  --datadir=/home/mysql

vim /etc/init.d/mysqld 
basedir=/usr/local/mysql
datadir=/home/mysql 
‘//添加工作路径‘

‘//添加数据路径‘

service mysqld start
netstat -ntap|grep 3306
mysqladmin -u root -p password "abc123"   回车
mysql -u root -p

#######################源码编译安装PHP###################################333

yum install -y gd libpng libpng-devel pcre pcre-devel libxml2-devel libjpeg-devel
cd /opt/php
#上传PHP程序包
tar jxvf 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  --enable-mbstring    

make && make install

cp php.ini-development /usr/local/php5/php.ini
ln -s /usr/local/php5/bin/* /usr/local/bin/

vim /etc/httpd.conf
    AddType application/x-httpd-php .php    ‘//添加此行‘
    AddType application/x-httpd-php-source .phps    ‘//添加此行‘

    DirectoryIndex index.html index.php     ‘//在此段文字后添加index.php‘

cd /usr/local/httpd/htdocs/
vim index.php
    ‘//原本内容可以删除,添加以下字段‘
<?php
phpinfo();
?>
mv index.html index.php
service httpd stop  
service httpd start

####################################LAMP架构搭建论坛##########################
mysql -u root -p
create database bbs;
grant all on bbs.* to ‘bbsuser ‘@‘%‘ identified by ‘admin123‘;
flush privileges;

cd /opt
unzip Discuz_X2.5_SC_UTF8.zip
cp -r upload/ /usr/local/httpd/htdocs/bbs
cd /usr/local/httpd/htdocs/bbs
chown -R daemon ./config
chown -R daemon ./data
chown -R daemon ./uc_client/
chown -R daemon ./uc_server/data/
#下面输入192.168.100.130/bbs/install 进行页面配置
192.168.100.180/bbs/install

Web群集----LAMP 架构

原文:https://blog.51cto.com/14625831/2548326

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!