IT/linux

CentOS 6에 JBoss, NGINX 설치 및 기본 연동

울티마 2015. 9. 12. 15:52

1. ftp 설치
- 패키지 설치
# yum list vsftpd
# yum install vsftpd
# yum install ftp
- ftp config 설정
# vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_umask=022
dirmessage_enable=YES
- root login enable 설정
# vi ftpusers
#root   --> comment out
# vi user_list
#root   --> comment out
- 서비스 재가동 및 reboot 후 자동 실행
# service vsftpd restart
# chkconfig vsftpd on
# chkconfig --list | grep vsftpd
vsftpd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
- SELinux 설정 및 rebooting 후 자동적용 설정
# setsebool -P allow_ftpd_full_access on  --> -P 옵션은 서버 재가동 후 자동 설정
# setsebool -P ftp_home_dir on

2. Java 설치
- 기존 default 패지제 제거
# rpm -qa | grep jdk
# yum remove java-1.6.0-openjdk-1.6.0.0-11.1.13.4.el6.x86_64
# yum remove java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el6_5.x86_64

- jdk 다운로드 및 설치
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u75-b13/jdk-7u75-linux-x64.tar.gz"

# mkdir -p /usr/java
# mv jdk-7u75-linux-x64.tar.gz /usr/java
# cd /usr/java
# tar zxvf jdk-7u75-linux-x64.tar.gz
# rm jdk-7u75-linux-x64.tar.gz

- 사용자 환경 설정
# vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.7.0_75
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH="."

3. JBoss 설치
- JBoss 사용자 생성 : ctinc user
# useradd -m -d /home/ctinc ctinc
# passwd ctinc
# vi .bash_profile
##### JAVA ENV ###############
export JAVA_HOME=/usr/java/jdk1.7.0_75
export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib

- 패키지 설치
# mkdir jboss
# mv jboss-eap-6.4.0.zip jboss
# cd jboss
# unzip jboss-eap-6.4.0.zip
# vi .bash_profile
export JAVA_HOME=/usr/java/jdk1.7.0_75
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export JBOSS_HOME=/home/ctinc/jboss/jboss-eap-6.4

- 관리자 추가
# cd $JBOSS_HOME/bin
#  ./add-user.sh
   mgmt user add :  ctinc // Ctinc0808!
   To represent the user add the following to the server-identities definition <secret value="Q3RpbmMwODA4IQ==" />

- Standalone 가동
# $JBOSS_HOME/bin/standalone.sh &

4. NGINX 설치
- 웹서비스를 위한 SELinux 설정
setsebool -P httpd_can_network_connect=1
setsebool -P httpd_can_network_connect_db=1
setsebool -P httpd_can_network_relay=1
setsebool -P user_tcp_server=1

- 방화벽 open
iptables -I INPUT 1 -i eth0 -p tcp -m multiport --dports 22,80,443,8080 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp -m multiport --sports 22,80,443,8080 -m state --state ESTABLISHED -j ACCEPT

- 패키지 설치 및 서비스 가동
# yum install epel-release
# yum install nginx
# service nginx start
Starting nginx:                                            [  OK  ]
# chkconfig nginx on
# chkconfig --list | grep nginx
nginx           0:off   1:off   2:on    3:on    4:on    5:on    6:off

# links http://localhost

- JBoss 연동 (proxy_pass 설정)
# service nginx stop
# vi /etc/nginx/conf.d/default.conf
server {
    ...
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        proxy_pass http://127.0.0.1:8080;     ==> proxy_pass 옵션 추가
     }
...
# service nginx start
# links http://localhost

- NGINX 관련 폴더
# find / -name nginx -print
/etc/nginx
/etc/sysconfig/nginx
/etc/rc.d/init.d/nginx
/etc/logrotate.d/nginx
/var/lib/nginx
/var/lock/subsys/nginx
/var/log/nginx
/usr/sbin/nginx
/usr/lib64/perl5/vendor_perl/auto/nginx
/usr/share/nginx