amazon linux 2 install memo

LAMP
$ sudo yum update -y
$ sudo amazon-linux-extras install lamp-mariadb10.2-php7.2 php7.2
$ sudo yum install -y httpd mariadb-server
$ sudo systemctl start httpd
$ sudo systemctl enable httpd

Folder Permission
$ sudo usermod -a -G apache ec2-user
$ exit
$ groups #ec2-user adm wheel apache systemd-journal
$ sudo chown -R ec2-user:apache /var/www
$ sudo chmod 2775 /var/www && find /var/www -type d -exec sudo chmod 2775 {} \;
$ find /var/www -type f -exec sudo chmod 0664 {} \;

MariaDB
$ sudo systemctl start mariadb
$ sudo mysql_secure_installation
$ sudo systemctl enable mariadb

PHP
$ sudo yum install php-mbstring php-gd php-xml php-soap -y
$ sudo yum install php-pear php-devel gcc libzip-devel zlib-devel
$ sudo yum install php-zip

Imagick
$ sudo yum install ImageMagick ImageMagick-devel ImageMagick-perl
$ sudo pecl install imagick
add "extension=imagick.so" to /etc/php.d/20-imagick.ini

TimeZone
sudo vim /etc/sysconfig/clock
ZONE="Asia/Taipei"
UTC=true
sudo ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime

#修改php.ini timezone設定

Composer
cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer

GIT
$ sudo yum install git

sudo reboot