Lamp部署
系统环境:CentOs6.6
下载安装包链接地址:https://pan.baidu.com/s/1wgOqgk2L3di_y2Z1ISkwQA
安装apache
mkdir /tools
cd /tools/
yum -y install lrzsz
yum -y install gcc gcc-c++
yum -y install pcre pcre-devel
yum -y install zlib
yum -y install openssl openssl-devel
yum -y install zlib-devel
yum -y install expat-devel
rz -y
tar -zxvf httpd-2.4.33.tar.gz
tar -zxvf apr-1.6.3.tar.gz
tar -zxvf apr-util-1.6.1.tar.gz
cd httpd-2.4.33
cd srclib/
cp -r /tools/apr-1.6.3 ./apr
cp -r /tools/apr-util-1.6.1 ./apr-util
cd /tools/
cd httpd-2.4.33
——————————————
./configure \
--prefix=/application/httpd-2.4.25 \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-modules=most \
--enable-so \
--enable-ssl \
--with-mpm=worker \
--enable-rewrit
——————————————
make && make install
echo $?
/application/httpd/bin/apachectl -t
/application/httpd/bin/apachectl start
安装mysql
cd /tools/
tar -zxvf cmake-3.11.2.tar.gz
cd cmake-3.11.2
./configure
echo $?
yum install libaio -y
cd /tools/
tar -zxvf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.40-linux-glibc2.12-x86_64 /application/mysql-5.6.40
cd /application/mysql-5.6.40
ln -s /application/mysql-5.6.40/ /application/mysql
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
cd ..
cd mysql
scripts/mysql_install_db --user=mysql \
--basedir=/application/mysql \
--datadir=/application/mysql/data
echo $?
cp support-files/mysql.server /etc/init.d/mysql
sed -i "s#/usr/local/mysql#/application/mysql#g" /etc/init.d/mysql
rm -rf etc/my.cnf
vim /etc/profile
添加:
export PATH=/application/mysql/bin/:$PATH 加入环境变量
source /etc/profile
/etc/init.d/mysql start
mysql -uroot -p
use mysql;
UPDATE user SET password=PASSWORD('password') WHERE user='root';
flush privileges;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; mysql授权root用户使用password从任何主机连接到mysql服务器
安装php
cd /tools/
tar -zxvf php-5.6.31.tar.gz
cd php-5.6.31
ll /application/httpd/bin/apxs
ln -s /application/httpd-2.4.25/ /application/httpd
ll /application/httpd/bin/apxs
yum install libxml2-devel -y
yum install libxml2
yum -y install curl curl-devel
yum -y install libjpeg-devel
yum install libpng-devel
yum install freetype-devel
yum install -y epel-release
yum install -y libmcrypt-devel
————————————————————
./configure \
--prefix=/application/php-5.6.31 \
--with-config-file-path=/application/php-5.6.31/etc \
--with-apxs2=/application/httpd/bin/apxs \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
--enable-sockets \
--enable-zip \
--enable-calendar \
--enable-bcmath \
--enable-soap \
--enable-opcache \
--enable-fpm \
--with-fpm-user=daemon \
--with-fpm-group=daemon \
--with-zlib \
--with-iconv \
--with-gd \
--with-xmlrpc \
--enable-mbstring \
--with-curl \
--enable-ftp \
--with-mcrypt \
--without-pear \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--disable-ipv6 \
--disable-debug \
--with-openssl
———————————————————
echo $?
make && make install
echo $?
mv php.ini-production /application/php-5.6.31/etc/php.ini
cd /application/php-5.6.31/etc
mv php-fpm.conf.default php-fpm.conf
cd /application/httpd/conf
vim httpd.conf
添加如下:
391行 AddType application/x-httpd-php .php
152行 LoadModule rewrite_module modules/mod_rewrite.so 注释掉
253行 DirectoryIndex index.html index.php 末尾添加index.php
cd /application/httpd/htdocs
vim index.php
添加如下:
phpinfo();
?>
/etc/init.d/iptables stop