목차
apache 설치
$> sudo apt-get install apache2참고로 ubuntu 에서 apache 는 아래 경로에 설치된다. conf 의 path 는 아래와 같다.
- /etc/apache2/apache2.conf
ubuntu@ip-161-31-42-145:~$ sudo apt-get install apache2 Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: apache2-bin apache2-data libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert Suggested packages: apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils openssl-blacklist The following NEW packages will be installed: apache2 apache2-bin apache2-data libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert 0 upgraded, 8 newly installed, 0 to remove and 48 not upgraded. Need to get 1,284 kB of archives. After this operation, 5,337 kB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libapr1 amd64 1.5.0-1 [85.1 kB] Get:2 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libaprutil1 amd64 1.5.3-1 [76.4 kB] Get:3 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libaprutil1-dbd-sqlite3 amd64 1.5.3-1 [10.5 kB] Get:4 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libaprutil1-ldap amd64 1.5.3-1 [8,634 B] Get:5 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main apache2-bin amd64 2.4.7-1ubuntu4 [839 kB] Get:6 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main apache2-data all 2.4.7-1ubuntu4 [160 kB] Get:7 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main apache2 amd64 2.4.7-1ubuntu4 [87.7 kB] Get:8 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main ssl-cert all 1.0.33 [16.6 kB] Fetched 1,284 kB in 1s (771 kB/s) Preconfiguring packages ... Selecting previously unselected package libapr1:amd64. (Reading database ... 51050 files and directories currently installed.) Preparing to unpack .../libapr1_1.5.0-1_amd64.deb ... Unpacking libapr1:amd64 (1.5.0-1) ... Selecting previously unselected package libaprutil1:amd64. Preparing to unpack .../libaprutil1_1.5.3-1_amd64.deb ... Unpacking libaprutil1:amd64 (1.5.3-1) ... Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64. Preparing to unpack .../libaprutil1-dbd-sqlite3_1.5.3-1_amd64.deb ... Unpacking libaprutil1-dbd-sqlite3:amd64 (1.5.3-1) ... Selecting previously unselected package libaprutil1-ldap:amd64. Preparing to unpack .../libaprutil1-ldap_1.5.3-1_amd64.deb ... Unpacking libaprutil1-ldap:amd64 (1.5.3-1) ... Selecting previously unselected package apache2-bin. Preparing to unpack .../apache2-bin_2.4.7-1ubuntu4_amd64.deb ... Unpacking apache2-bin (2.4.7-1ubuntu4) ... Selecting previously unselected package apache2-data. Preparing to unpack .../apache2-data_2.4.7-1ubuntu4_all.deb ... Unpacking apache2-data (2.4.7-1ubuntu4) ... Selecting previously unselected package apache2. Preparing to unpack .../apache2_2.4.7-1ubuntu4_amd64.deb ... Unpacking apache2 (2.4.7-1ubuntu4) ... Selecting previously unselected package ssl-cert. Preparing to unpack .../ssl-cert_1.0.33_all.deb ... Unpacking ssl-cert (1.0.33) ... Processing triggers for man-db (2.6.7.1-1) ... Processing triggers for ureadahead (0.100.0-16) ... Processing triggers for ufw (0.34~rc-0ubuntu2) ... Setting up libapr1:amd64 (1.5.0-1) ... Setting up libaprutil1:amd64 (1.5.3-1) ... Setting up libaprutil1-dbd-sqlite3:amd64 (1.5.3-1) ... Setting up libaprutil1-ldap:amd64 (1.5.3-1) ... Setting up apache2-bin (2.4.7-1ubuntu4) ... Setting up apache2-data (2.4.7-1ubuntu4) ... Setting up apache2 (2.4.7-1ubuntu4) ... Enabling module mpm_event. Enabling module authz_core. Enabling module authz_host. Enabling module authn_core. Enabling module auth_basic. Enabling module access_compat. Enabling module authn_file. Enabling module authz_user. Enabling module alias. Enabling module dir. Enabling module autoindex. Enabling module env. Enabling module mime. Enabling module negotiation. Enabling module setenvif. Enabling module filter. Enabling module deflate. Enabling module status. Enabling conf charset. Enabling conf localized-error-pages. Enabling conf other-vhosts-access-log. Enabling conf security. Enabling conf serve-cgi-bin. Enabling site 000-default. * Starting web server apache2 * Setting up ssl-cert (1.0.33) ... Processing triggers for libc-bin (2.19-0ubuntu6) ... Processing triggers for ureadahead (0.100.0-16) ... Processing triggers for ufw (0.34~rc-0ubuntu2) ...
방화벽 설정
EC2 에서 만든 instance 는 기본적으로 아래처럼 security group 을 만들어서 ssh port 만 열어놓는다. 그래서 http server 용으로 inbound 80 을 열어줘야 한다. 80 port 를 열고나서 ip-address 로 접속하면 default page 를 볼 수 있다.
PHP 설치
이제 php 를 설치 해 보자.
$>sudo apt-get install php5
를 사용하면 된다.
ubuntu@ip-161-31-42-145:~$ sudo apt-get install php5 Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libapache2-mod-php5 php5-cli php5-common php5-json php5-readline Suggested packages: php-pear php5-user-cache The following NEW packages will be installed: libapache2-mod-php5 php5 php5-cli php5-common php5-json php5-readline 0 upgraded, 6 newly installed, 0 to remove and 48 not upgraded. Need to get 4,860 kB of archives. After this operation, 20.5 MB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main php5-json amd64 1.3.2-2build1 [34.4 kB] Get:2 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main php5-common amd64 5.5.9+dfsg-1ubuntu4 [439 kB] Get:3 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main php5-cli amd64 5.5.9+dfsg-1ubuntu4 [2,163 kB] Get:4 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main php5-readline amd64 5.5.9+dfsg-1ubuntu4 [12.1 kB] Get:5 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main libapache2-mod-php5 amd64 5.5.9+dfsg-1ubuntu4 [2,210 kB] Get:6 http://us-west-2.ec2.archive.ubuntu.com/ubuntu/ trusty/main php5 all 5.5.9+dfsg-1ubuntu4 [1,302 B] Fetched 4,860 kB in 0s (5,078 kB/s) Selecting previously unselected package php5-json. (Reading database ... 51693 files and directories currently installed.) Preparing to unpack .../php5-json_1.3.2-2build1_amd64.deb ... Unpacking php5-json (1.3.2-2build1) ... Selecting previously unselected package php5-common. Preparing to unpack .../php5-common_5.5.9+dfsg-1ubuntu4_amd64.deb ... Unpacking php5-common (5.5.9+dfsg-1ubuntu4) ... Selecting previously unselected package php5-cli. Preparing to unpack .../php5-cli_5.5.9+dfsg-1ubuntu4_amd64.deb ... Unpacking php5-cli (5.5.9+dfsg-1ubuntu4) ... Selecting previously unselected package php5-readline. Preparing to unpack .../php5-readline_5.5.9+dfsg-1ubuntu4_amd64.deb ... Unpacking php5-readline (5.5.9+dfsg-1ubuntu4) ... Selecting previously unselected package libapache2-mod-php5. Preparing to unpack .../libapache2-mod-php5_5.5.9+dfsg-1ubuntu4_amd64.deb ... Unpacking libapache2-mod-php5 (5.5.9+dfsg-1ubuntu4) ... Selecting previously unselected package php5. Preparing to unpack .../php5_5.5.9+dfsg-1ubuntu4_all.deb ... Unpacking php5 (5.5.9+dfsg-1ubuntu4) ... Processing triggers for man-db (2.6.7.1-1) ... Setting up php5-json (1.3.2-2build1) ... php5_invoke: Enable module json for apache2 SAPI php5_invoke: Enable module json for cli SAPI Setting up php5-common (5.5.9+dfsg-1ubuntu4) ... Creating config file /etc/php5/mods-available/pdo.ini with new version php5_invoke: Enable module pdo for apache2 SAPI php5_invoke: Enable module pdo for cli SAPI Creating config file /etc/php5/mods-available/opcache.ini with new version php5_invoke: Enable module opcache for apache2 SAPI php5_invoke: Enable module opcache for cli SAPI Setting up php5-cli (5.5.9+dfsg-1ubuntu4) ... update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode Creating config file /etc/php5/cli/php.ini with new version php5_invoke json: already enabled for cli SAPI php5_invoke pdo: already enabled for cli SAPI php5_invoke opcache: already enabled for cli SAPI Setting up php5-readline (5.5.9+dfsg-1ubuntu4) ... Creating config file /etc/php5/mods-available/readline.ini with new version php5_invoke: Enable module readline for apache2 SAPI php5_invoke: Enable module readline for cli SAPI Setting up libapache2-mod-php5 (5.5.9+dfsg-1ubuntu4) ... Creating config file /etc/php5/apache2/php.ini with new version php5_invoke json: already enabled for apache2 SAPI php5_invoke pdo: already enabled for apache2 SAPI php5_invoke readline: already enabled for apache2 SAPI php5_invoke opcache: already enabled for apache2 SAPI Module mpm_event disabled. Enabling module mpm_prefork. apache2_switch_mpm Switch to prefork * Restarting web server apache2 [ OK ] apache2_invoke: Enable module php5 * Restarting web server apache2 [ OK ] Setting up php5 (5.5.9+dfsg-1ubuntu4) ...
혹시 설치 중간에 error 가 발생한다면
$> apt-get update
를 이용하면 된다.
php5-mysql
추가로 php5-mysql 을 설치하자$>sudo apt-get install php5-mysql
아파치 재시작
php5 library 를 apache 에 load 시키기 위해 restart 를 하자.$> sudo /etc/init.d/apache2 restart
ubuntu@ip-161-31-42-145:~$ sudo /etc/init.d/apache2 restart * Restarting web server apache2 [ OK ]
테스트 페이지 만들기
php 가 잘 동작하는 지 확인하기 위해 info.php 를 만들어서 웹으로 접근해 보자. 아래처럼 info.php 를 만들면 된다. 참고로 경로는- /var/www/html
이다.
ubuntu@ip-161-31-42-145:/var/www/html$ ll total 20 drwxr-xr-x 2 root root 4096 Jun 4 14:21 ./ drwxr-xr-x 3 root root 4096 Jun 4 14:21 ../ -rw-r--r-- 1 root root 11510 Jun 4 14:21 index.html ubuntu@ip-161-31-42-145:/var/www/html$ sudo vi info.php ubuntu@ip-161-31-42-145:/var/www/html$ ll total 24 drwxr-xr-x 2 root root 4096 Jun 7 11:04 ./ drwxr-xr-x 3 root root 4096 Jun 4 14:21 ../ -rw-r--r-- 1 root root 11510 Jun 4 14:21 index.html -rw-r--r-- 1 root root 19 Jun 7 11:04 info.php ubuntu@ip-161-31-42-145:/var/www/html$info.php 의 내용은 아래와 같다.
<?php phpinfo() ?>vi 사용법은 각자 알아서 해결하도록 하자.^^;;;
테스트 페이지를 웹에서 접근
위에서 사용한 ip 주소를 이용해서 info.php 로 접속해 보자. 아래와 같은 화면이 뜨면 성공적으로 설치된 것이다.wordpress 설치하기
이제 wordpress(워드프레스) 를 설치해 보자.- $> cd /var/www/html
- $> sudo wget http://wordpress.org/latest.tar.gz
- $> sudo tar -zxvf latest.tar.gz
- $> sudo /etc/init.d/apache2 restart (필요?)
ubuntu@ip-161-31-42-145:/$ cd /var/www/html ubuntu@ip-161-31-42-145:/var/www/html$ sudo wget http://wordpress.org/latest.tar.gz --2014-06-07 11:15:36-- http://wordpress.org/latest.tar.gz Resolving wordpress.org (wordpress.org)... 66.155.40.249, 66.155.40.250 Connecting to wordpress.org (wordpress.org)|66.155.40.249|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 5812042 (5.5M) [application/octet-stream] Saving to: ‘latest.tar.gz’ 100%[======================================>] 5,812,042 5.19MB/s in 1.1s 2014-06-07 11:15:37 (5.19 MB/s) - ‘latest.tar.gz’ saved [5812042/5812042]
ubuntu@ip-161-31-42-145:/var/www/html$ sudo tar -zxvf ./latest.tar.gz
이 wordpress directory 에 있는 것을 /var/www/html 로 옮기면 된다. 옮기지 않으면 아래처럼 접근하면 된다.- http://111.111.11.1/wordpress/index.php
이제 아파치 서버를 restart 시키면 위의 경로로 접근할 수 있다.
결과화면
아래와 같은 화면을 본다면 php-mysql 이 설치가 안돼서 일 것이다.php.ini 을 확인 해 보자.
좀 더 제대로 된 화면은 4번째 post 에서 확인 하자.
References
- 좋은 프로그램은 마음의 여유에서 나온다. :: AWS EC2(우분투)에 워드프레스 설치하기
- Using Amazon RDS with your WordPress installation | The Pragmatic Integrator
- Installing WordPress on AWS
댓글 없음:
댓글 쓰기