Ubuntu16.04 APM(Apache2.4, PHP7.3, MariaDB10.4) 설치

-- 저장소 추가, 업데이트
# add-apt-repository ppa:ondrej/apache2
# apt update

-- OpenSSL 설치
# apt install openssl
# openssl version

-- Apache 설치
# apt install apache2
# apachectl -v

-- Apache 설정
# a2enmod rewrite headers ssl
# a2dismod -f autoindex 
# cd /etc/apache2
# cp apache2.conf apache2.conf_orig
# sed -i "s/KeepAlive On/KeepAlive Off/g" apache2.conf
# sed -i "s/Timeout 300/Timeout 20/" apache2.conf
# cd /etc/apache2/conf-available
# cp charset.conf charset.conf_orig
# sed -i "s/#AddDefaultCharset UTF-8/AddDefaultCharset UTF-8/g" charset.conf
# cp security.conf security.conf_orig
# sed -i "s/#<Directory \/>/<Directory \/>/g" security.conf
# sed -i "s/#   AllowOverride None/   AllowOverride None/g" security.conf
# sed -i "s/#   Require all denied/   Require all denied/g" security.conf
# sed -i "s/#<\/Directory>/<\/Directory>/g" security.conf
# sed -i "s/#<DirectoryMatch \"\/\\\.svn\">/<DirectoryMatch \"\/\\\.svn\">/g" security.conf
# sed -i "s/#   Require all denied/   Require all denied/g" security.conf
# sed -i "s/#<\/DirectoryMatch>/<\/DirectoryMatch>/g" security.conf
# sed -i "s/ServerTokens OS/ServerTokens Prod/g" security.conf
# sed -i "s/ServerSignature On/ServerSignature Off/g" security.conf
# sed -i "s/#Header set X-Content-Type-Options: \"nosniff\"/Header set X-Content-Type-Options: \"nosniff\"/g" security.conf
# sed -i "s/#Header set X-Frame-Options: \"sameorigin\"/Header set X-Frame-Options: \"sameorigin\"/g" security.conf
# systemctl restart apache2
-- 저장소 추가, 업데이트
# add-apt-repository ppa:ondrej/php
# apt update

-- PHP 설치
# apt install php7.3 
# apt install php7.3-mbstring php7.3-gd php7.3-curl php7.3-xml php7.3-zip php7.3-intl php7.3-bcmath php7.3-mysql
# php -v

-- PHP Mcrypt 설치
# apt install php-pear php7.3-dev pkg-config libmcrypt-dev
# pecl channel-update pecl.php.net
# pecl install mcrypt-1.0.2
# echo "extension=/usr/lib/php/20180731/mcrypt.so" > /etc/php/7.3/cli/conf.d/mcrypt.ini
# echo "extension=/usr/lib/php/20180731/mcrypt.so" > /etc/php/7.3/apache2/conf.d/mcrypt.ini

-- PHP 설정
# cd /etc/php/7.3/apache2
# cp php.ini php.ini_orig
# sed -i "s/;date.timezone =/date.timezone = Asia\/Seoul/g" php.ini
# sed -i "s/;error_log = syslog/error_log = \/var\/log\/php\/error.log/g" php.ini
# cd /etc/php/7.3/cli
# cp php.ini php.ini_orig
# sed -i "s/;error_log = syslog/error_log = \/var\/log\/php\/error.log/g" php.ini
# sed -i "s/;date.timezone =/date.timezone = Asia\/Seoul/g" php.ini
# mkdir -p /var/log/php
# chown www-data /var/log/php
# systemctl restart apache2
-- 저장소 추가, 업데이트
# apt-get install software-properties-common
# apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
# add-apt-repository "deb [arch=amd64,arm64,i386,ppc64el] http://ftp.kaist.ac.kr/mariadb/repo/10.4/ubuntu xenial main"
# apt update

-- MariaDB 설치
# apt install mariadb-server
# mariadb -V

-- MariaDB 설정
# cd /etc/mysql
# cp my.cnf my.cnf_orig
# sed -i "s/127.0.0.1/0.0.0.0/g" my.cnf
# sed -i "/\[client\]/a default-character-set = utf8mb4" my.cnf
# sed -i "/\[mysqld\]/a character-set-server = utf8mb4" my.cnf
# sed -i "/\[mysqld\]/a collation-server = utf8mb4_unicode_ci" my.cnf
# sed -i "/\[mysqld\]/a skip-name-resolve" my.cnf
# sed -i "/\[mysqldump\]/a default-character-set = utf8mb4" my.cnf
# systemctl restart mariadb

댓글(0)