노력과 삽질 퇴적물
AWS: APM tar버전 설치(컴파일 설치) 본문
0. 필요한 파일
파일명 |
예시 경로 |
apache httpd-2.4.7 [#아키이브] | /usr/local/apache httpd-2.4.7 -> httpd2.4 버젼부터는 1.4 이상의 apr과 apr-util이 필요 |
1.5.0.tar.gz apr-util-1.5.3.tar.gz | /usr/local/apr-1.5.0 /usr/local/apr-util-1.5.3 |
php-5.5.21.tar.gz [#아카이브] | /usr/local/php-5.5.21 |
mysql-5.6.15.tar.gz | /usr/local/mysql-5.6.15 -> 아카이브에서 상위경로-하위로 간 경우 [Source Code>MySQL Server Tarball]에 있는 파일 사용. |
test.php | /usr/local/workspace/test.php |
putty.exe [#다운로드] | (특이사항 없음) |
puttygen.exe [#다운로드] | (특이사항 없음) |
* 작업환경
아마존 AWS
Red Hat Enterprise Linux 7.0 (HVM), SSD Volume Type - ami-35556534
[root] # yum -y update 완료
[root] # yum -y install wget 완료
1. 필수 패키지
1 2 3 4 5 | [root] # yum -y install gcc.x86_64 gcc-c++.x86_64 wget.x86_64 bzip2-devel.x86_64 pkgconfig.x86_64 openssl-devel.x86_64 make.x86_64 man.x86_64 nasm.x86_64 gmp.x86_64 gdbm-devel.x86_64 readline-devel.x86_64 compat-readline43.x86_64 ncurses-devel.x86_64 db4-devel.x86_64 automake* autoconf* distcache-devel.x86_64 pcre-devel.x86_64 libxslt-devel.x86_64 GeoIP-devel.x86_64 gd-devel.x86_64 libmcrypt libmcrypt-devel [root] # yum -y install libtermcap-devel ncurses-devel [root] # yum -y install libxml* curl-devel libjpeg* libpng* freetype-devel [root] # yum -y install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel gcc make [root] # yum -y install perl-ExtUtils-Embed |
cmake에 필요한거.
1 2 3 | [root] # yum -y install make cmake [root] # yum -y install bison [root] # yum -y install wget unzip |
2. 아파치 httpd
1) 설치
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | [root] # wget https://archive.apache.org/dist/httpd/httpd-2.4.7.tar.gz [root] # tar -zxvf httpd-2.4.7.tar.gz [root] # cd /usr/local/httpd-2.4.7 [root] # ./configure --prefix=/usr/local/httpd-2.4.7 --with-mpm=prefork ... ... ... checking for APR-util... no configure: error: APR-util not found. Please read the documentation. [root] # wget https://archive.apache.org/dist/apr/apr-1.5.0.tar.gz [root] # tar -zxvf apr-1.5.0.tar.gz [root] # cd /usr/local/apr-1.5.0 [root] # ./configure --prefix=/usr/local/apr-1.5.0 [root] # make && make install [root] # wget https://archive.apache.org/dist/apr/apr-util-1.5.3.tar.gz [root] # tar -zxvf apr-util-1.5.3.tar.gz [root] # cd /usr/local/apr-util-1.5.3 [root] # ./configure \ --prefix=/usr/local/apr-util-1.5.3 \ --with-apr=/usr/local/apr-1.5.0 [root] # make && make install ... ... ... See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- /usr/bin/install -c -m 644 aprutil.exp /usr/local/apr-util-1.5.3/lib /usr/bin/install -c -m 755 apu-config.out /usr/local/apr-util-1.5.3/bin/apu-1-config [root] # cd /usr/local/httpd-2.4.7 [root] # ./configure \ --prefix=/usr/local/httpd-2.4.7 \ --with-mpm=prefork \ --with-apr=/usr/local/apr-1.5.0 \ --with-apr-util=/usr/local/apr-util-1.5.3 [root] # make & make install |
2) 서비스 등록
1 2 3 4 5 6 7 8 9 10 | [root] # vi /etc/ld.so.conf (vi 에디터중) include ld.so.conf.d/*.conf ... ... ... /usr/local/ec2/local/httpd-2.4.7/lib /usr/local/ec2/local/httpd-2.4.7/modules :wq [root] # ldconfig [root] # cp /usr/local/httpd-2.4.7/bin/apachectl /etc/init.d/httpd [root] #service httpd start |
3) conf 편집
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | [root] # mkdir /usr/local/workspace [root] # chmod 755 /usr/local/workspace [root] # vi /usr/local/httpd-2.4.7/conf/httpd.conf (vi 에디터중) ... ... ... ServerRoot "/usr/local/httpd-2.4.7" ... ... ... # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other # <Directory /> AllowOverride none Allow from all </Directory> ... ... ... # # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "/usr/local/workspace" <Directory "/usr/local/workspace"> ... ... ... :wq [root] # service httpd restart [root] # ps -ef | grep httpd root 1398 1 0 08:54 ? 00:00:00 ./httpd daemon 14054 1398 0 09:22 ? 00:00:00 ./httpd daemon 14055 1398 0 09:22 ? 00:00:00 ./httpd daemon 14056 1398 0 09:22 ? 00:00:00 ./httpd daemon 14057 1398 0 09:22 ? 00:00:00 ./httpd daemon 14058 1398 0 09:22 ? 00:00:00 ./httpd root 14060 1378 0 09:22 pts/1 00:00:00 grep --color=auto httpd |
*기타, 수동실행법
cd /usr/local/httpd-2.4.7/bin./httpd
ps -ef | grep httpd
4) 확인
웹 브라우저로 서버IP에 접속해서 'It works!'가 있으면 정상적으로 실행되고 있습니다.
만약 403 forbiden처럼 퍼미션 에러가 날 경우,
프로젝트 폴더에 권한을
chmod 750 /usr/local/workspace
or
chmod 701 /usr/local/workspace
등으로 권한을 바꿔서 재접속을 해보거나, 서버자체를 리부팅 해보면 됩니다.
5) 기타 에러
1 2 3 4 5 6 7 | ... ... ... libmysqlclient_r.so.16: cannot open shared object file: No such file or directory [root] # vi /etc/ld.so.conf ... /usr/local/mysql-5.6.15/lib/mysql #추가 :wq [root] # /sbin/ldconfig |
1 2 3 4 5 6 7 8 9 | [root] # service httpd restart ... ... ... httpd: Syntax error on line 150 of /usr/local/httpd-2.4.7/conf/httpd.conf: Cannot load modules/libphp5.so into server: libmysqlclient_r.so.16: cannot open shared object file: No such file or directory [root] # pwd /usr/local/mysql-5.6.15/libmysql_r/.libs [root] # cp libmysqlclient_r.so.16 /usr/local/mysql-5.6.15/lib/mysql/libmysqlclient_r.so.16 [root] # service httpd restart |
3. PHP
1) 필요 라이브러리
1 2 3 4 5 6 7 | yum -y install libvpx yum install libvpx-devel yum -y install libXpm libXpm-devel yum -y install t1lib t1lib-devel yum -y install gmp-devel yum -y install pam-devel yum -y install libicu libicu-devel yum -y install openldap-devel |
2) libmcrypt
-> 설치를 안 하면 PHP 설치중 아래와 같은 에러메시지가 나옵니다.
... ... ...
checking for stdarg.h... (cached) yes
checking for mcrypt support... yes
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
1 2 3 4 5 | [root] # wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz [root] # tar xzf libmcrypt-2.5.8.tar.gz [root] # cd /usr/local/libmcrypt-2.5.8 [root] # ./configure [root] # make & make install |
3) 설치
-> wget으로 받을 주소를 못찾아서 php소스파일은 파일질라로 업로드 했습니다.
개발이 하고 싶어요 :: 아마존 웹 서비스(AWS) EC2 파일 전송 FileZilla
-> '--enable-maintainer-zts'옵션이 없으면 libphp5.so 생성이 안 되는듯?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | [root] # cd /usr/local/php-5.4.25 [root] # ./configure \ -prefix=/usr/local/php-5.4.25 \ --with-config-file-path=/usr/local/php-5.4.25/lib \ --with-apxs2=/usr/local/httpd-2.4.7/bin/apxs \ --with-mysql=/usr/local/mysql-5.6.15 \ --with-mysqli=/usr/local/mysql-5.6.15/bin/mysql_config \ --with-libdir=lib64 \ --with-curl \ --disable-debug --enable-safe-mode \ --disable-fileinfo \ --enable-track-vars \ --enable-sockets --with-openssl --enable-ftp \ --with-mod_charset --with-charset=utf8 \ --with-xml \ --enable-mailparse \ --enable-calender \ --enable-sysvsem=yes --enable-sysvshm=yes \ --enable-magi-quotes \ --enable-gd-native-ttf \ --enable-url-includes \ --enable-trans-id \ --enable-inline-optimization \ --enable-bcmath \ --with-jpeg --with-png \ --with-zlib \ --with-jpeg-dir=/usr \ --with-png-dir=/usr/lib \ --with-freetype-dir=/usr \ --with-libxml-dir=/usr \ --enable-exif \ --with--gd \ --with-ttf \ --with-gettext \ --enable-sigchild \ --enable-mbstring --with-mcrypt \ --enable-maintainer-zts ... ... ... | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP. config.status: creating php5.spec ... ... ... [root] # make & make install |
3) 설정
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | [root] # find -name '*5.so' ./libs/libphp5.so ./.libs/libphp5.so [root] # cp /usr/local/php-5.4.25/libs/libphp5.so /usr/local/httpd-2.4.7/modules/libphp5.so [root] # cp /usr/local/php-5.4.25/php.ini-production /usr/local/httpd-2.4.7/conf/php.ini [root] # vi /usr/local/httpd-2.4.7/conf/httpd.conf (VI 에디터) ... ... ... #LoadModule rewrite_module modules/mod_rewrite.so LoadModule php5_module modules/libphp5.so <IfModule unixd_module> ... ... ... ... ... ... #AddEncoding x-compress .Z #AddEncoding x-gzip .gz .tgz # # If the AddEncoding directives above are commented-out, then you # probably should define those extensions to indicate media types: # AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php .htm .html .inc AddType application/x-httpd-php-source .phps PHPIniDir "/usr/local/php-5.4.25/lib" ... ... ... :wq [root] # service httpd restart |
만약, 아파치는 재시작에 에러 메시지 출력이 없는데도
브라우저상으로 페이지가 다운된 상태이면 php.ini을 다시금 확인해봅니다.
4. MySQL
1) 관련 라이브러리
1 2 3 4 5 6 7 8 9 10 11 | [root] # wget https://lnamp-web-server.googlecode.com/files/cmake-2.8.4.tar.gz [root] # tar -zxvf cmake-2.8.4.tar.gz [root] # cd cmake-2.8.4 [root] # ./bootstrap [root] # make & make install ... ... ... -- Installing: /usr/local/doc/cmake-2.8/cpack.txt -- Installing: /usr/local/doc/cmake-2.8/cpack.docbook -- Installing: /usr/local/doc/cmake-2.8/ccmake.txt -- Installing: /usr/local/doc/cmake-2.8/ccmake.docbook [1]+ Done make |
2) 설치
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | [root] # groupadd mysql [root] # useradd -g mysql mysql [root] # wget https://downloads.mariadb.com/archives/mysql-5.6/mysql-5.6.15.tar.gz [root] # tar zxvf mysql-5.6.15.tar.gz [root] # cd mysql-5.6.15 [root] # cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.15 \ -DSYSCONFDIR=/usr/local/mysql-5.6.15/config \ -DMYSQL_DATADIR=/usr/local/mysql-5.6.15/data \ -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \ -DMYSQL_TCP_PORT=3306 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS=all \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -LH ... ... ... ... ... ... [root] # make && make install ... ... ... -- Installing: /usr/local/mysql-5.6.15/man/man1/myisampack.1 -- Installing: /usr/local/mysql-5.6.15/man/man8/mysqld.8 -- Installing: /usr/local/mysql-5.6.15/support-files/solaris/postinstall-solaris |
2) 초기화
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | [root] # cd /usr/local/mysql-5.6.15/scripts [root] # /usr/local/mysql-5.6.15/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.6.15 --datadir=/usr/local/mysql-5.6.15/data bash: /usr/local/mysql-5.6.15/scripts/mysql_install_db: Permission denied [root] # chmod 750 /usr/local/mysql-5.6.15/scripts/mysql_install_db [root] # /usr/local/mysql-5.6.15/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.6.15 --datadir=/usr/local/mysql-5.6.15/data Installing MySQL system tables...2015-02-12 00:44:11 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. ... ... ... WARNING: Default config file /etc/my.cnf exists on the system This file will be read by default by the MySQL server If you do not want to use this, either remove it, or use the --defaults-file argument to mysqld_safe when starting the server [root] # vi /etc/profile (vi 에디터) ... ... ... unset i unset -f pathmunge export PATH=$PATH:/usr/local/mysql-5.6.15/bin :wq |
3) 서비스 등록
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | [root] # cp /usr/local/mysql-5.6.15/support-files/my-default.cnf /etc/my.cnf [root] # cp /usr/local/mysql-5.6.15/support-files/mysql.server /etc/rc.d/init.d [root] # cp /usr/local/mysql-5.6.15/support-files/mysql.server /etc/rc.d/init.d/mysqld [root] # chmod 755 /etc/rc.d/init.d/mysqld [root] # cd /etc/init.d [root] # chkconfig --add mysql.server [root] # chkconfig --level 2345 mysql.server on [root] # ln -s /usr/local/mysql-5.6.15/bin/mysql /usr/bin [root] # ln -s /usr/local/mysql-5.6.15/bin/mysqldump /usr/bin/ [root] # cd /usr/local/mysql-5.6.15/support-files [root] # chmod 755 mysql.server [root] # /usr/local/mysql-5.6.15/support-files/mysql.server start --skip-grant-tables Starting MySQL SUCCESS! [root] # ln -s /usr/local/mysql-5.6.15/bin/mysql /usr/bin [root] # ln -s /usr/local/mysql-5.6.15/bin/mysqldump /usr/bin/ [root] # cd /usr/local [root] # find -name 'libmysqlclient.so*' ... ... ... ./mysql-5.6.15/lib/libmysqlclient.so [root] # vi /etc/ld.so.conf (vi 에디터) include ld.so.conf.d/*.conf ... ... ... /usr/local/mysql-5.6.15/lib :wq [root] # /sbin/ldconfig |
4) 비밀번호
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | [root] # /usr/local/mysql-5.6.15/support-files/mysql.server start --skip-grant-tables Starting MySQL SUCCESS! [root] # cd /usr/local/mysql-5.6.15/bin [root] # ./mysqladmin -u root password '1234@' [root] # mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.15 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> |
기타. 참고자료
1) 아파치
뱀미의 블로그 :: [linux]apach 설치
2) MySQL
Redlamp :: [centos]APM 설치 3 - mysql 5.6 설치
3) PHP
기타. 변경이력
일자 |
변경이력 |
2015-02-12 | 초안 |
'📂게임개발 note > 클라우드 & 서버' 카테고리의 다른 글
AWS: 원격 캐싱서버, Redis&memcached (0) | 2019.06.06 |
---|---|
AWS: 우분투 SVN서버 (0) | 2018.04.10 |
팁: AWS EC2 하드용량 100% 활성화 (0) | 2015.02.06 |
AWS: 다수의 인스턴스&VPC 생성 (0) | 2015.01.31 |
AWS: EC2 인스턴스 서버 기본세팅 (0) | 2015.01.22 |