http://www.superuser.co.kr/home/lecture/index.php?cateNo=1&secNo=27&theNo=&leccode=90
http://www.superuser.co.kr/home/lecture/index.php?cateNo=1&secNo=27&theNo=&leccode=118

mysql 은 간단한 dbms로 apache+php 와 많이 연동에서 사용합니다.
처음 배우기에 쉽고 구조 자체가 간단하여 공부하기에는 수월할 것입니다.

요즘 들어와서 소스로 설치 할 필요 없이 그냥 설정 몇가지만 바꿔 주면 사용이 가능해 졌습니다.

일단 소스 디렉터리로 이동합니다.
1) [root@localhost /]# cd /usr/local/src

아래 주소에서 MYSQL5.x버전을 받습니다.
2) [root@localhost /]# wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-standard-5.0.19-linux-i686-icc-glibc23.tar.gz/from/http://mysql.holywar.net/

압축을 풉니다.
3) [root@localhost /]# tar xvfz mysql-standard-5.0.19-linux-i686-icc-glibc23.tar.gz

해당 디렉터리 자체를 /usr/local 로 이동시킵니다.
4) [root@localhost /]# mv mysql-standard-5.0.19-linux-i686-icc-glibc23 /usr/local/mysql

mysql을 mysql권한으로 사용할 수 있게 사용자를 추가합니다.
5) [root@localhost /]# useradd mysql

설치된 디렉터리로 이동합니다.
6) [root@localhost /]# cd /usr/local/mysql

기본 database를 생성합니다.
7) [root@localhost /]# sudo scripts/mysql_install_db

소유자와 그룹 권한을 조정합니다.
8) [root@localhost /]# sudo chown -R root /usr/local/mysql
9) [root@localhost /]# sudo chown -R mysql /usr/local/mysql/data
10) [root@localhost /]# sudo chgrp -R mysql /usr/local/mysql
11) [root@localhost /]# sudo chown -R root /usr/local/mysql/bin

db를 스타트 시킵니다.
12) [root@localhost /]# sudo bin/safe_mysqld &

mysql 관리자(root) 비밀번호를 변경합니다.
13) [root@localhost /]# ./bin/mysqladmin -u root password '새로운패스워드'


mysql 접속방법

[root@localhost mysql]# cd bin
[root@localhost /]# ./mysql -u root -p mysql


Apache2.0.X

[root@localhost bin]# rpm -qa | grep httpd  - rpm 확인
※ rpm 없으면 장땡
[root@localhost bin]# rpm -e --nodeps 이름 - 삭제할때사용


1) [root@localhost /]# cd /usr/local/src
2) [root@localhost /]# wget http://ftp.kaist.ac.kr/pub/Apache/httpd/httpd-2.2.0.tar.gz
3) [root@localhost /]# tar xvfz httpd-2.2.0.tar.gz
4) [root@localhost /]# >> install-httpd.sh
5) [root@localhost /]# cd httpd-2.2.0
6) [root@localhost /]# make clean
7) [root@localhost /]# ./configure --prefix=/usr/local/apache2 --with-mpm=prefork --disable-status --disable-asis --disable-cgi --disable-userdir --enable-speling=shared --enable-rewrite=shared --enable-modules=so

8) [root@localhost /]# make
9) [root@localhost /]# make install
10) [root@localhost /]# vi /usr/local/apache2/conf/httpd.conf

98번째 줄 ServerName www.example.com:80
주석을 풀고
서버네임을 변경해준다.

[root@localhost httpd-2.2.0]# cd /usr/local/apache2/bin
[root@localhost bin]# ./apachectl start

설치 확인

#++++++++++++++++++++#
/usr/local/apache2/bin/httpd -t
#++++++++++++++++++++#

확인 http:// 아이피 - It works! 확인

jdk를 설치한다.
http://java.sun.com 에가서 j2SE 1.5.X 버전을 다운받으면된다..
[root@localhost /]# cd /usr/local/src
[root@localhost /]# wget http://192.18.108.138/ECom/EComTicketServlet/BEGIN0571E016C90D0526676507AB03056784/-2147483648/1465630035/1/681986/681842/1465630035/2ts+/westCoastFSEND/jdk-1.5.0_06-oth-JPR/jdk-1.5.0_06-oth-JPR:4/jdk-1_5_0_06-linux-i586.bin
[root@localhost /]# chmod 700 jdk-1_5_0_06-linux-i586.bin
[root@localhost /]# ./jdk-1_5_0_06-linux-i586.bin
--more--
yes
[root@localhost /]# mv jdk1.5.0_06 /usr/local/jdk

파일을 열어서 환경 설정을 해줍니다.
[root@localhost /]# vi /etc/profile

###########JAVACONF##################
   JAVA_HOME=/usr/local/java
   CATALINA_HOME=/usr/local/tomcat5
   MYSQL_HOME=/bangke/mysql5
   PATH=$PATH:$JAVA_HOME/bin:$MYSQL_HOME/bin:$CATALINA_HOME/bin
   export JAVA_HOME PATH
   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/hbangke/mysql5/lib/mysql:/usr/X11R6/lib/liXp.so.6


[root@localhost /]# source /etc/profile


톰켓 Tomcat5.0.x 설치
 
[root@localhost /]# cd /usr/local/src
[root@localhost /]# wget http://ftp.kaist.ac.kr/pub/Apache/tomcat/tomcat-5/v5.5.16/bin/apache-tomcat-5.5.16.tar.gz

[root@localhost /]# tar xzvf apache-tomcat-5.5.16.tar.gz
[root@localhost /]# mv apache-tomcat-5.5.16 /usr/local/tomcat
[root@localhost /]# cd /usr/local/tomcat/bin
[root@localhost /]# ./catalina.sh start

http://localhost:8080 으로 접속하여 고양이가 보이면 성공!

[root@localhost /]# ./catalina.sh stop


tomcat-connectors

[root@localhost /]# cd /usr/local/src
[root@localhost /]# wget http://ftp.kaist.ac.kr/pub/Apache/tomcat/tomcat-connectors/jk2/jakarta-tomcat-connectors-jk2-src-current.tar.gz

[root@localhost /]# tar xzvf jakarta-tomcat-connectors-jk2-src-current.tar.gz
[root@localhost /]# cd jakarta-tomcat-connectors-jk2-2.0.4-src
[root@localhost /]# cd jk/native2
[root@localhost /]# ./buildconf.sh

#[ apache 2.X.X ]
[root@localhost /]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs
[root@localhost /]# make
[root@localhost /]# cd ../build/jk2/apache2
[root@localhost /]# apxs -n jk2 -i mod_jk2.so

#[ apache 1.3.X ]
[root@localhost /]# ./configure --with-apxs=/usr/local/apache/bin/apxs
--with-apr=/usr/local/src/httpd-1.3.X/srclib/apr
--with-apr-util=/usr/local/src/httpd-1.3.X/srclib/apr-util
[root@localhost /]# make
[root@localhost /]# cd ../build/jk2/apache13
[root@localhost /]# apxs -n jk2 -i mod_jk2.so


[root@localhost /]# cd /usr/local/apache2/modules
[root@localhost /]# ls
 mod_jk2.so 확인


환경설정(톰캣 + 아파치 연동)

[root@localhost bin]# cd /usr/local/apache2/conf
[root@localhost conf]# vi httpd.conf

add line -->> 56번째줄
#------------------------------------------------------------
LoadModule jk2_module modules/mod_jk2.so 추가

<IfModule dir_module>
 DirectoryIndex index.html index.htm index.jsp index.cgi index.lzx index.php 추가
</IfModule>


#++++++++++++++++++++++++++++++++#
# HTTP jk2 환경 파일 수정 :
# /usr/local/apache2/conf/workers2.properties
#++++++++++++++++++++++++++++++++#

[shm]
file=/usr/local/apache2/logs/jk2.shm
size=1048576

[channel.socket:localhost:8009]
port=8009
host=127.0.0.1


# Defile The Worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009

# Anounce Status Worker
# [status:status]

# Announce Uri mapping
[uri:/examples/*]
worker=ajp13:localhost:8009

# Uri mapping
[uri:/*]
worker=ajp13:localhost:8009

# Uri status
[uri:/status/*]
worker=status:status


#+++++++++++++++++++++++++++#
# 톰캣 JK2 환경 파일 수정 :
# /usr/local/tomcat/conf/jk2.properties
#+++++++++++++++++++++++++++#

channelSocket.port=8009
shm.file=/usr/local/apache2/logs/jk2.shm
apr.jniModeSo=inprocess


서비스 구동

[root@localhost /]# /usr/local/tomcat/bin/catalina.sh start
[root@localhost /]# /usr/local/apache2/bin/apachectl start

포트번호가 빠졌다.
눈치를 챘으리라. Apache와 Tomcat가 연동이 되었다는 증거가 여기서 나오는 것이다.


사용자계정

[root@localhost conf]# vi tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager"/>
  <user username="jara" password="jara412" roles="manager"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>

댓글을 달아 주세요