在EC2上搭建最新的非托管LAMP堆栈
环境
-
- Amazon EC2
Amazon Linux 2015.09
MariaDB 10.1
PHP 7.0.4
Apache 2.4.18
亚马逊 Linux
- Development Toolsのインストール
# yum groupinstall -y 'Development Tools'
# yum groupinstall -y "Development Libraries"
MariaDB 10.1是一个数据库管理系统。
$ sudo vi /etc/yum.repos.d/MariaDB.repo
# MariaDB 10.1 CentOS repository list - created 2016-03-13 07:22 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
$ sudo yum install -y MariaDB-server MariaDB-client
$ sudo /etc/init.d/mysql start
$ mysql_secure_installation
Apache 2.4 可以进行改写为:阿帕奇2.4
# yum install apr*
# yum install pcre-devel
# cd /usr/local/src/
# wget http://ftp.meisei-u.ac.jp/mirror/apache/dist//httpd/httpd-2.4.18.tar.bz2
# tar xfj httpd-2.4.18.tar.bz2
# cd httpd-2.4.18
# ./configure --enable-so --prefix=/usr/local/apache2
# make
# make install
# cp build/rpm/httpd.init /etc/rc.d/init.d/httpd2
# vi /etc/init.d/httpd2
#httpd=${HTTPD-/usr/sbin/httpd}
#pidfile=${PIDFILE-/var/run/${prog}.pid}
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
pidfile=${PIDFILE-/usr/local/apache2/logs/httpd.pid}
#CONFFILE=/etc/httpd/conf/httpd.conf
CONFFILE=/usr/local/apache2/conf/httpd.conf
# chkconfig --add httpd2
# chkconfig --level 35 httpd2 on
# chkconfig --list | grep httpd2
# vi /usr/local/apache2/conf/httpd.conf
LoadModule php7_module modules/libphp7.so
AddType application/x-httpd-php .php
PHP 7.0 是什么意思?
# yum install -y libicu-devel
# cd /usr/local/src/
# wget http://jp2.php.net/distributions/php-7.0.4.tar.bz2
# tar xvfj php-7.0.4.tar.bz2
# cd cd php-7.0.4
./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-openssl \
--enable-mbstring \
--enable-opcache \
--enable-intl \
--with-zlib-dir
# make
# make install
# php -v
PHP 7.0.4 (cli) (built: Mar 13 2016 08:50:50) ( ZTS )
# cp /usr/local/src/php-7.0.4/php.ini-production /etc/php.ini