lamp快速部署

(一)、软件包的准备:

1、下载apache: http://www.apache.org/dist/httpd/httpd-2.4.1.tar.gz
2、下载MySQL:http://mysql.mirror.kangaroot.net/Downloads/MySQL-5.5/mysql-5.5.21.tar.gz
3、下载php:http://cn.php.net/distributions/php-5.3.10.tar.gz
4、下载cmake(MySQL编译工具):http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz
5、下载libmcrypt(PHPlibmcrypt模块):
ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
6、下载apr(Apache库文件):http://mirror.bit.edu.cn/apache/apr/apr-1.4.6.tar.gz
7、下载apr-util(Apache库文件):http://mirror.bit.edu.cn/apache/apr/apr-util-1.4.1.tar.gz

根据需求下载不同版本。

(二)、安装

1、安装libmcrypt

yum install gcc -y
tar xf libmcrypt-2.5.7.tar.gz
cd  libmcrypt-2.5.7 
./configure
make
make install

2、安装cmake

cd ..
tar xf cmake-2.8.7.tar.gz
yum install gcc* -y
cd cmake-2.8.7
./configure
make 
make install

3、安装apr

cd ..
tar xf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make
make install

4、安装apr-util

cd ..
tar xf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make install

5、安装pcre

cd ..
tar xf pcre-8.36.tar.gz
cd pcre-8.36
./configure prefix=/usr/local/pcre
make
make install

6、安装mysql

 

groupadd mysql
useradd -s /sbin/nologin  -g mysql -M mysql  
mkdir -p /usr/local/mysql/data
chown -R mysql /usr/local/mysql

  

tar xf mysql-5.5.44.tar.gz 
cd mysql-5.5.44
yum install ncurses-devel -y
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc
make && make install

  

cd /usr/local/mysql
rm -rf /etc/my.cnf 
cp ./support-files/my-huge.cnf /etc/my.cnf 
echo "datadir = /usr/local/mysql/data" >>/etc/my.cnf 
/usr/local/mysql/scripts/mysql_install_db --user=mysql
cp ./support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig mysqld on

vim /etc/rc.d/init.d/mysqld 
修改
basedir=/usr/local/mysql #安装路径
datadir=/usr/local/mysql/data #数据库路径

  

vim /etc/profile       #把mysql服务器加入系统环境变量,在最后添加下面这一行
export PATH=$PATH:/usr/local/mysql/bin
source /etc/profile
ln -s /usr/local/mysql/lib /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql

/etc/init.d/mysqld start

mysqladmin -u root password 'db*Ms@ql!104'          #设置密码

  

7、安装apache

yum install openssl* -y
tar xf httpd-2.4.12.tar.gz
cd  httpd-2.4.12 
 ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-ssl --enable-ssl --enable-module=so 
 --enable-rewrite --enable-cgid --enable-cgi  --with-pcre=/usr/local/pcre  --enable-so --with-mpm=worker --enable-cache --enable-disk-cache 
 --enable-mem-cache --enable-file-cache --enable-nonportable-atomic
 --enable-rewrite --enable-speling --enable-forward --enable-static-support --disable-userdir11
make
make install  
/usr/local/apache/bin/apachectl start  启动  

  

根据需求修改配置文件
vim /usr/local/apache/conf/httpd.conf

 ServerName localhost:80  #去掉注释,改为localhost
       <Directory /> #找到Directory修改
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
       </Directory>

      AllowOverride All #修改为ALL

      Order allow,deny
      Allow from all

       <IfModule dir_module>  #添加index.php
          DirectoryIndex index.html index.php index.html
       </IfModule>

       <Files ".ht*">
          Order allow,deny
          Deny from all
          Satisfy All
       </Files>

      <Directory "/usr/local/apache/cgi-bin">
         AllowOverride All
         Options None
         Order allow,deny
         Allow from all
      </Directory>

      #添加这两行

     AddType application/x-httpd-php .php
     AddType application/x-httpd-php-source .phps

      Include conf/extra/httpd-vhosts.conf  #去掉注释
View Code

8、安装php

yum -y install libjpeg-devel
yum -y install libpng-devel
yum install freetype-devel -y
yum install libxml2 libxml2-devel -y

cd ..
tar xf php-5.3.18.tar.gz
cd php-5.3.18
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql 
--with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-freetype-dir --with-jpeg-dir 
--with-png-dir --with-zlib --with-libxml-dir --enable-xml --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem 
--enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl 
--enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt

make && make install

  

 mkdir /usr/local/php/etc
 cp php.ini-production /usr/local/php/etc/php.ini 
 rm -rf /etc/php.ini 
 ln -s /usr/local/php/etc/php.ini /etc/php.ini

  

根据公司要求进行修改配置文件

vim /usr/local/php/etc/php.ini

 

 

 

 

 

 

 

 

转载于:https://www.cnblogs.com/wangjiazhe/p/7998919.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值