项目一:部署 LAMP ecshop电商平台

网络

vim /etc/sysconfig/network-scripts/ifcfg-ens32 
ip mask dns gateway

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenfore 0

systemctl disabled firewalld
systemctl stop firewalld

iptables -F

yum源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
vim /etc/yum.repos.d/CentOS-Media.repo
mount /dev/sr0 /media
echo "/dev/sr0 /media iso9660 defaults 0 0" >> /etc/fstab
mount -a

安装依赖

yum install -y gcc*



链接:https://pan.baidu.com/s/1xnLWr1GGugu79oL2vyj_tA?pwd=6j5z 
提取码:6j5z 
--来自百度网盘超级会员V3的分享

[root@localhost software]# ll
total 70364
-rw-r--r--. 1 root root 72049715 Jun 27 07:18 LAMP.zip

unzip LAMP.zip

mv /root/LAMP/ /lamp

[root@localhost lamp]# ll
total 71524
-rw-r--r--. 1 root root   982243 Feb 24  2020 apr-1.4.6.tar.gz
-rw-r--r--. 1 root root   774770 Feb 24  2020 apr-util-1.4.1.tar.gz
-rw-r--r--. 1 root root  1775673 Feb 24  2020 freetype-2.3.5.tar.gz
-rw-r--r--. 1 root root  6747087 Feb 24  2020 httpd-2.4.7.tar.gz
-rw-r--r--. 1 root root   613261 Feb 24  2020 jpegsrc.v6b.tar.gz
-rw-r--r--. 1 root root  1335178 Feb 24  2020 libmcrypt-2.5.8.tar.gz
-rw-r--r--. 1 root root   792139 Feb 24  2020 libpng-1.2.31.tar.gz
-rw-r--r--. 1 root root  5172503 Feb 24  2020 libxml2-2.9.1.tar.gz
-rw-r--r--. 1 root root   471915 Nov 22  2008 mcrypt-2.6.8.tar.gz
-rw-r--r--. 1 root root   326970 Feb 25  2020 memcached-1.4.17.tar.gz
-rw-r--r--. 1 root root   931437 Dec  8  2008 mhash-0.9.9.9.tar.gz
-rw-r--r--. 1 root root 21201193 Feb 24  2020 mysql-5.5.48.tar.gz
-rw-r--r--. 1 root root  2826473 Feb 24  2020 ncurses-5.9.tar.gz
-rw-r--r--. 1 root root  1933734 Feb 24  2020 pcre-8.34.tar.gz
-rw-r--r--. 1 root root   401230 Feb 25  2020 pecl-memcache-php7.zip
-rw-r--r--. 1 root root 18218591 Feb 24  2020 php-7.0.7.tar.gz
-rw-r--r--. 1 root root  8198197 Feb 24  2020 phpMyAdmin-4.1.4-all-languages.tar.gz
-rw-r--r--. 1 root root      242 Feb 24  2020 tar.sh
-rw-r--r--. 1 root root   496597 Feb 24  2020 zlib-1.2.3.tar.gz

sh tar.sh

# 开始安装依赖
yum install -y libxml2-devel python-devel

cd /lamp/libxml2-2.9.1
./configure --prefix=/usr/local/libxml2/ && make -j 4 && make install && echo $?


cd /lamp/libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt/ && make -j 4 && make install && echo $?

cd /lamp/libmcrypt-2.5.8/libltdl
./configure --enable-ltdl-install && make -j 4 && make install && echo $?

cd /lamp/mhash-0.9.9.9
./configure  && make -j 4 && make install && echo $?

cd /lamp/mcrypt-2.6.8
export LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/lib
# 变量:LD_LIBRARY_PATH用于指定libmcrypt和mhash的库的位置
./configure --with-libmcrypt-prefix=/usr/local/libmcrypt  && make -j 4 && make install && echo $?


cd /lamp/zlib-1.2.3
./configure
# 然后修改配置文件,否则无法正常安装此软件

vim Makefile
CFLAGS=-O3 -DUSE_MMAP -fPIC
# 找到CFLAGS=-O3 -DUSE_MMAP,在后面加入-fPIC 变成(注意:小f大PIC,空格)
make -j 4 && make install && echo $?

cd /lamp/libpng-1.2.31
./configure --prefix=/usr/local/libpng && make -j 4 && make install && echo $?

mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man/man1
yum -y install libtool*
cd /lamp/jpeg-6b
cp -a /usr/share/libtool/config/config.sub ./
cp -a /usr/share/libtool/config/config.guess ./
# 复制libtool中的文件,覆盖jpeg-6b中的文件(64位中的问题)
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static && make -j 4 && make install && echo $?

cd /lamp/freetype-2.3.5
./configure --prefix=/usr/local/freetype/  && make -j 4 && make install && echo $?

apache

cp -a /lamp/apr-1.4.6/lamp/httpd-2.4.7/srclib/apr
cp -a /lamp/apr-util-1.4.1/lamp/httpd-2.4.7/srclib/apr-util

 cd /lamp/pcre-8.34
 ./configure && make -j 4 && make install && echo $?

yum -y install openssl-devel

cd /lamp/httpd-2.4.7

./configure \
--prefix=/usr/local/apache2 \
--sysconfdir=/usr/local/apache2/etc \
--with-included-apr \
--enable-so \
--enable-deflate=shared \
--enable-expires=shared \
--enable-rewrite=shared --enable-ssl

make -j 4 && make install && echo $?

/usr/local/apache2/bin/apachectl start
ps aux | grep httpd
netstat -tlun | grep :80

yum -y install ncurses-devel
cd /lamp/ncurses-5.9
./configure --with-shared \
--without-debug --without-ada \
--enable-overwrite && make -j 4 && make install && echo $?

yum -y install cmake bison

mysql

useradd -r -s /sbin/nologin mysql

cd /lamp/mysql-5.5.48
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 \
-DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 && make && make install && echo $?

cd /usr/local/mysql/
chown -R root .
chown -R mysql data
cp -a /lamp/mysql-5.5.48/support-files/my-medium.cnf /etc/my.cnf

cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql

/usr/local/mysql/bin/mysqld_safe --user=mysql &
/usr/local/mysql/bin/mysqladmin -uroot password 123456

/usr/local/mysql/bin/mysql -u root -p

PHP

cd /lamp/php-7.0.7
./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ \
--with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr/local/libxml2/  \
--with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/libpng/ \
--with-freetype-dir=/usr/local/freetype/ --with-mcrypt=/usr/local/libmcrypt/ \
--with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all \
--enable-sockets --with-pdo-mysql=/usr/local/mysql --with-gd --without-pear && make && make install && echo $?

mkdir /usr/local/php/etc
cp /lamp/php-7.0.7/php.ini-production /usr/local/php/etc/php.ini

vim /usr/local/apache2/etc/httpd.conf
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start

vim /usr/local/apache2/htdocs/test.php
<?php
phpinfo();
?>

http://192.168.222.101/test.php

cd /lamp/php-7.0.7/ext/openssl
mv config0.m4 config.m4
/usr/local/php/bin/phpize
./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config && make && make install && echo $?

vi /usr/local/php/etc/php.ini
# 加最后即可
extension_dir="/usr/local/php/lib/php/extensions/no-debug-zts-20151012/"

extension="openssl.so";
extension="memcache.so";
添加以上两个库文件的调用
重启 apache,刷新 phpinfo 页面,并查看是否有两个新增的模块
cd /lamp
# 坏了 wget ftp://ftp.pbone.net/mirror/ftp.centos.org/7.6.1810/os/x86_64/Packages/libevent-devel-2.0.21-4.el7.x86_64.rpm
yum -y install libevent-devel
cd /lamp/memcached-1.4.17
./configure --prefix=/usr/local/memcache && make && make install && echo $?

 useradd -r -s /sbin/nologin memcache
添加 memcache用户,此用户不用登录,不设置密码
/usr/local/memcache/bin/memcached -umemcache &
启动 memcache服务,并设置为后台运行
netstat -an | grep :11211
检查 memcache是否正常启动,并监听了 11211端口

phpmyadmin

cp -a /lamp/phpMyAdmin-4.1.4-all-languages /usr/local/apache2/htdocs/phpmyadmin
cd /usr/local/apache2/htdocs/phpmyadmin
cp -a config.sample.inc.php config.inc.php
vim config.inc.php
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['auth_type'] = 'http';
设置 auth_type为 http ,即设置为 HTTP身份认证模式(新增即可)

通过浏览器输入地址访问:http://Apache服务器地址/phpmyadmin/index.php

# vi /etc/rc.local
/usr/local/apache2/bin/apachectl start
/usr/local/mysql/bin/mysqld_safe --user=mysql &
/usr/local/memcache/bin/memcached -umemcache &

在这里插入图片描述

HEXO

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值