서버 - AWS EC2 Ubuntu 16.04 LAMP
Apache
설치 준비: 패키지 업그레이드
패키지 목록 갱신
패키지 최신 버전 패치
Apache2 설치
Apache 설치
1
| $ apt-get install apache2 |
Aapache 현재 설치 버전 확인
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2018-06-07T19:43:03apache
가상 서버 확인
http://서버IP
Apache 설정
apache 서비스 시작
1
| $ sudo /etc/init.d/apache2 start |
[ ok ] Starting apache2 (via systemctl): apache2.service.
apache 서비스 중지
1
| $ sudo /etc/init.d/apache2 stop |
[ ok ] Stopping apache2 (via systemctl): apache2.service.
apache 서비스 재시작 명령어
1
| $ sudo /etc/init.d/apache2 restart |
$ [ ok ] Restarting apache2 (via systemctl): apache2.service.
PHP
PHP 7.0 설치
PHP 7.0 설치
PHP-아파치 연동 모듈 설치
1
| $ apt-get install libapache2-mod-php7.0 |
암호화 모듈 설치
1
| $ apt-get install php-mcrypt |
다국어 처리 모듈 설치
1
| $ apt-get install php-mbstring |
이미지 처리 모듈 설치
1
| $ apt-get install php-gd |
원격지 정보 부르는 모듈 설치
1
| $ apt-get install php-curl php-xml |
PHP 적용을 위한 Apache 재시작
1
| $ apt-get install php-curl php-xml |
PHP 설정
PHP 버전 확인
PHP 7.0.32-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.32-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies
PHP 주요 설정 변경
1
| $ vi /etc/php/7.0/apache2/php.ini |
| 변경 전 |
변경 후 |
| default_charset =”UTF-8″ |
default_charset=”UTF-8″ ..수정없음 |
| ;mbstring.substitute_character = none; |
mbstring.substitute_character = none; |
| ;mbstring.language = Japanese |
mbstring.language = Korean |
| ;mbstring.internal_encoding = |
mbstring.internal_encoding = UTF-8 |
| ;mbstring.http_output = |
mbstring.http_output = pass |
| ;mbstring.http_input = |
mbstring.http_input = UTF-8 |
| ;mbstring.encoding_translation = Off |
mbstring.encoding_translation = On |
| ;mbstring.detect_order = auto |
mbstring.detect_order = UTF-8 |
| ;date.timezone= |
date.timezone=”Asia/Seoul” |
MariaDB 설치
설치준비
Ubuntu 버전 확인
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
현재 Ubuntu가 가진 mariadb-server 설치정보 확인
1
| $ apt-cache policy mariadb-server |
mariadb-server:
Installed: (none)
Candidate: 10.0.36-0ubuntu0.16.04.1
Version table:
10.0.36-0ubuntu0.16.04.1 500
500 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
500 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
10.0.24-7 500
500 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
MariaDB 설치정보 업데이트
1
2
3
4
| $ 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.3/ubuntu xenial main'
$ apt update |
현재 Ubuntu가 가진 mariadb-server 설치정보 재확인
1
| $ apt-cache policy mariadb-server |
mariadb-server:
Installed: (none)
Candidate: 1:10.3.11+maria~xenial
Version table:
1:10.3.11+maria~xenial 500
500 http://ftp.kaist.ac.kr/mariadb/repo/10.3/ubuntu xenial/main i386 Packages
500 http://ftp.kaist.ac.kr/mariadb/repo/10.3/ubuntu xenial/main arm64 Packages
500 http://ftp.kaist.ac.kr/mariadb/repo/10.3/ubuntu xenial/main ppc64el Packages
500 http://ftp.kaist.ac.kr/mariadb/repo/10.3/ubuntu xenial/main amd64 Packages
10.0.36-0ubuntu0.16.04.1 500
500 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
500 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
10.0.24-7 500
500 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
MariaDB 설치
MariaDB 10.3 설치
1
| $ apt install mariadb-server |
MariaDB 서비스 상태 확인

MariaDB 로그인
MariaDB 기본 character set UTF8 설정
character set 설정 파일 생성
1
| $ vi /etc/mysql/conf.d/mariadb.cnf |
mariadb.cnf 내용
1
2
3
4
5
6
7
8
9
10
| [client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
collation-server = utf8mb4_unicode_ci
init-connect = 'SET NAMES utf8mb4'
character-set-server = utf8mb4 |
MariaDB 재시작
1
| $ service mysql restart |
character set 변경 확인
1
| show variables like 'c%'; |
+----------------------------------+----------------------------+
| Variable_name | Value |
+----------------------------------+----------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| check_constraint_checks | ON |
| collation_connection | utf8mb4_general_ci |
| collation_database | utf8mb4_unicode_ci |
| collation_server | utf8mb4_unicode_ci |
| column_compression_threshold | 100 |
| column_compression_zlib_level | 6 |
| column_compression_zlib_strategy | DEFAULT_STRATEGY |
| column_compression_zlib_wrap | OFF |
| completion_type | NO_CHAIN |
| concurrent_insert | ALWAYS |
| connect_timeout | 5 |
| core_file | OFF |
+----------------------------------+----------------------------+
PHP - MariaDB 연동 모듈 설치
모듈 확인
1
| $ apt-cache policy php-mysql |
php-mysql:
Installed: (none)
Candidate: 1:7.0+35ubuntu6.1
Version table:
1:7.0+35ubuntu6.1 500
500 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
1:7.0+35ubuntu6 500
500 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
PHP - MariaDB 연동 모듈 설치
1
| $ apt-get install php-mysql |
참고자료