리눅스 APM(Apache+PHP+MySQL) 및 Openssl 설치하기
1. MySQL 소스설치
2. Openssl 소스설치
3. 아파치(Apache) 소스설치
4. PHP 소스설치
5. APM+OpenSSL 연동하기
gcc 설치 # yum -y install gcc*
1. 소스 다운로드(5.1.69버전)
(5.5 이상 버전은 cmake 사용하는데 여기서는 다루지 않습니다.)
MySQL 유저생성
# useradd -M -s /bin/false mysql
2. MySQL 데이터 파일 및 로그파일 디렉토리 생성. 권한설정(MySQL 유저)
[root@divweb3 mysql]# cd /home
[root@divweb3 home]# mkdir mysql
[root@divweb3 home]# cd mysql
[root@divweb3 mysql]# mkdir data
[root@divweb3 mysql]# mkdir log
[root@divweb3 mysql]# chown mysql.mysql data/
[root@divweb3 mysql]# chown mysql.mysql log/
3. 소스 압축풀기. configure
[root@divweb3 mysql]# cd /usr/local/src
[root@divweb3 src]# tar xvzf mysql-5.1.69.tar.gz
[root@divweb3 src]# cd mysql-5.1.69
[root@divweb3 mysql-5.1.69]# ./configure --prefix=/usr/local/mysql --datadir=/home/mysql/data --with-charset=utf8 --with-extra-charsets=complex
checking for tgetent in -lcurses... no
checking for tgetent in -ltermcap... no
checking for tgetent in -ltinfo... no
checking for termcap functions library... configure: error: No curses/termcap library found
1) MySQL 설치 에러 : configure: error : No curses/termcap library found
termcap 라이브러리 설치
[root@localhost ~]# yum -y install libtermcap-devel ncurses-devel
2) gcc* 설치 안하면 /depcomp: line 571: exec: g++: not found
g++ 라이브러리가 설치가 안될 경우, 에러 발생
# yum -y install gcc-c++
[root@divweb3 mysql-5.1.69]# ./configure --prefix=/usr/local/mysql --datadir=/home/mysql/data --with-charset=utf8 --with-extra-charsets=complex
/bin/rm: cannot remove `libtoolT': No such file or directory -- 무시하고 진행
config.status: executing default commands
Thank you for choosing MySQL!
Remember to check the platform specific part of the reference manual
for hints about installing MySQL on your platform.
Also have a look at the files in the Docs directory.
4. MySQL 설치
[root@divweb3 mysql-5.1.69]# make
[root@divweb3 mysql-5.1.69]# make install
5. MySQL 기본 DB 생성 스크립트 실행
[root@divweb3 mysql-5.1.69]# ./scripts/mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...
OK
Please report any problems with the /usr/local/mysql/bin/mysqlbug script!
6. MySQL 데몬 실행
[root@divweb3 mysql-5.1.69]# /usr/local/mysql/bin/mysqld_safe --user=root &
[1] 4384
[root@divweb3 mysql-5.1.69]# 160306 20:13:31 mysqld_safe Logging to '/var/log/mysqld.log'.
160306 20:13:31 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160306 20:13:31 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160306 20:13:31 [ERROR] /usr/local/mysql/libexec/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2)
160306 20:13:31 [ERROR] Can't start server: can't create PID file: No such file or directory
-- PID 생성오류
[root@divweb3 mysql-5.1.69]# cd /var/run/
[root@divweb3 run]# mkdir mysqld
[root@divweb3 run]# chown -R mysql.mysql mysqld/
[root@divweb3 run]# /usr/local/mysql/bin/mysqld_safe --user=root & --> 정상적으로 MySQL 데몬 실행됨
[root@divweb3 run]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) --socket '/tmp/mysql.sock' 접속오류
[root@divweb3 mysql]# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock 또는
[root@divweb3 mysql]# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
[root@divweb3 run]# /usr/local/mysql/bin/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.1.69 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> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> show character set; -- euckr, utf8 확인
+----------+-----------------------------+---------------------+--------+
| Charset | Description | Default collation | Maxlen |
+----------+-----------------------------+---------------------+--------+
| big5 | Big5 Traditional Chinese | big5_chinese_ci | 2 |
| dec8 | DEC West European | dec8_swedish_ci | 1 |
| cp850 | DOS West European | cp850_general_ci | 1 |
| hp8 | HP West European | hp8_english_ci | 1 |
| koi8r | KOI8-R Relcom Russian | koi8r_general_ci | 1 |
| latin1 | cp1252 West European | latin1_swedish_ci | 1 |
| latin2 | ISO 8859-2 Central European | latin2_general_ci | 1 |
| swe7 | 7bit Swedish | swe7_swedish_ci | 1 |
| ascii | US ASCII | ascii_general_ci | 1 |
| ujis | EUC-JP Japanese | ujis_japanese_ci | 3 |
| sjis | Shift-JIS Japanese | sjis_japanese_ci | 2 |
| hebrew | ISO 8859-8 Hebrew | hebrew_general_ci | 1 |
| tis620 | TIS620 Thai | tis620_thai_ci | 1 |
| euckr | EUC-KR Korean | euckr_korean_ci | 2 |
| koi8u | KOI8-U Ukrainian | koi8u_general_ci | 1 |
| gb2312 | GB2312 Simplified Chinese | gb2312_chinese_ci | 2 |
| greek | ISO 8859-7 Greek | greek_general_ci | 1 |
| cp1250 | Windows Central European | cp1250_general_ci | 1 |
| gbk | GBK Simplified Chinese | gbk_chinese_ci | 2 |
| latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 |
| armscii8 | ARMSCII-8 Armenian | armscii8_general_ci | 1 |
| utf8 | UTF-8 Unicode | utf8_general_ci | 3 |
| ucs2 | UCS-2 Unicode | ucs2_general_ci | 2 |
| cp866 | DOS Russian | cp866_general_ci | 1 |
| keybcs2 | DOS Kamenicky Czech-Slovak | keybcs2_general_ci | 1 |
| macce | Mac Central European | macce_general_ci | 1 |
| macroman | Mac West European | macroman_general_ci | 1 |
| cp852 | DOS Central European | cp852_general_ci | 1 |
| latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 |
| cp1251 | Windows Cyrillic | cp1251_general_ci | 1 |
| cp1256 | Windows Arabic | cp1256_general_ci | 1 |
| cp1257 | Windows Baltic | cp1257_general_ci | 1 |
| binary | Binary pseudo charset | binary | 1 |
| geostd8 | GEOSTD8 Georgian | geostd8_general_ci | 1 |
| cp932 | SJIS for Windows Japanese | cp932_japanese_ci | 2 |
| eucjpms | UJIS for Windows Japanese | eucjpms_japanese_ci | 3 |
+----------+-----------------------------+---------------------+--------+
36 rows in set (0.00 sec)
mysql> quit
Bye

