'Perl'에 해당되는 글 2건

  1. 2014.11.10 Ubuntu Server에 tomcat 설치
  2. 2014.11.10 Ubuntu Server에 Apache httpd 설치하기
2014. 11. 10. 22:36

1. tomcat 다운로드
 tomcat.apache.org로 이동하여 좌측의 Download에서 적당한 버전을 선택하고 Binary Distributions에서 Core: tar.gz를 다운로드 받는다.

2. 다운로드한 파일을 압축해제한 후 /opt밑으로 이동한다.
$ tar xvfz apache-tomcat-8.0.14.tar.gz
$ sudo mv 
apache-tomcat-8.0.14  /opt/tomcat8

3. tomcat의 버전정보와 시스템 정보를 확인해보자
$ cd /opt/tomcat8/bin
$ ./version.sh

Using CATALINA_BASE:   /opt/tomcat8
Using CATALINA_HOME:   /opt/tomcat8
Using CATALINA_TMPDIR: /opt/tomcat8/temp
Using JRE_HOME:        /usr/lib/jvm/jdk1.8.0/jre
Using CLASSPATH:       /opt/tomcat8/bin/bootstrap.jar:/opt/tomcat8/bin/tomcat-juli.jar
Server version: Apache Tomcat/8.0.14
Server built:   Sep 24 2014 09:01:51
Server number:  8.0.14.0
OS Name:        Linux
OS Version:     3.16.0-24-generic
Architecture:   amd64
JVM Version:    1.8.0_25-b17
JVM Vendor:     Oracle Corporation 

4. 시스템 설정을 검토해 보자
$ ./configtest.sh
◎ 만약 tomcat을 이미 실행했다면 종료를 한 후에 test를 진행해야 한다.

5. 사용자를 추가해봅시다.
$ sudo vi /opt/tomcat8/bin/
tomcat-users.xml 

...

  <role rolename="manager-gui"/>
  <role rolename="admin-gui"/>
  <user username="username" password="password" roles="manager-gui,admin-gui"/>
</tomcat-users>

username/password를 알맞게 설정해주세요.

6. 실행 및 종료
$ ./startup.sh         # 실행
$ ./shutdown.sh     # 종료

7. 실행/종료를 위한 스크립트를 init.d에 생성하자.
$ sudo vi /etc/init.d/tomcat8

#!/bin/sh
### BEGIN INIT INFO
# Provides:          tomcat8
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Should-Start:      $named
# Should-Stop:       $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start Tomcat.
# Description:       Start the Tomcat servlet engine.
### END INIT INFO 
if [ `id -u` -ne 0 ]; then
    echo "You need root privileges to run this script"
    exit 1
fi
# Make sure tomcat is started with system locale
if [ -r /etc/default/locale ]; then
    . /etc/default/locale
    export LANG
fi
if [ -r /etc/default/rcS ]; then
    . /etc/default/rcS
fi
. /lib/lsb/init-functions

export CATALINA_HOME=/opt/tomcat8
PATH=/sbin:/bin:/usr/sbin:/usr/bin
start() {
 sh $CATALINA_HOME/bin/startup.sh
}
stop() {
 sh $CATALINA_HOME/bin/shutdown.sh
}
case $1 in
  start|stop) $1;;
  restart) stop; start;;
  *) echo "Run as $0 <start|stop|restart>"; exit 1;;
esac

$ sudo chmod 755 /etc/init.d/tomcat8

8. tomcat이 부팅시  자동 실행될 수 있도록 등록해줍시다.
$ sudo update-rc.d tomcat8 defaults

자동 실행을 해제
$ sudo update-rc.d tomcat8 remove

OSX의 Terminal에서 ssh로 로그인을 해서 작업중이라면 Perl locale error가 발생할 수 있다. [해결방법]
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8”).

9. tomcat을 실행하고 Server Status를 확인해봅시다.
$ sudo /etc/init.d/tomcat8 start

http://localhost:8080을 오픈하여 보세요.
"Server Status" 버튼을 눌러서 5.에서 설정한 username과 password를 입력하여 Server Status를 확인해보세요.



참고) Apache + Tomcat + MySQL 설치 (우분투)


'Tip > 우분투' 카테고리의 다른 글

MySQL 유저관리  (0) 2014.11.12
Ubuntu의 명령라인에서 패키지 관리  (0) 2014.11.11
Ubuntu Server에 Apache httpd 설치하기  (0) 2014.11.10
Ubuntu Server에 GNU GCC컴파일러 설치  (0) 2014.11.10
Ubuntu에 SSH Server 설치하기  (0) 2014.11.10
Posted by 모바일헌터
2014. 11. 10. 20:54

0. 사전 준비

0.1 PCRE 최신 라이브러리 다운로드
pcre.org -> anonymous FTP를 이용해 최신 버전을 다운로드 받을 수 있는 사이트에 접속하여 최신 버전 다운로드

0.2 컴파일하고 설치하기
$ tar xvfz pcre-8.36
$ cd pcre-8.36
$ ./configure
$ make
$ sudo make install

0.3 pcre 라이브러리를 /usr/local/lib에 설치된다. 로드가 되지 않을 경우, 다음의 명령어를 입력한다.
$ sudo ldconfig


1. apache사이트에서 관련 파일 다운로드 받기

1.1 httpd 다운로드 하기
www.apache.org -> download -> mirror 사이트로 이동 -> httpd 선택 -> 최신 버전을 다운로드 (httd-2.4.10.tar.gz)를 다운로드

1.2 apr과 apr-util 다운로드 하기
www.apache.org -> download -> mirror 사이트로 이동 -> apr 선택택


2. 압축해제
$ tar xvfz httd-2.4.10.tar.gz
$ tar xvfz apr-1.5.1
$ tar xvfz apr-util-1.5.4

3. 이동
mv apr-1.5.1 httpd-2.4.10/srclib/apr
mv apr-util-1.5.4 httpd-2.4.10/srclib/apr-util


4. apache 컴파일 하고 설치하기 
$ cd httpd-2.4.10
$ ./configure --prefix=/usr/local/apache2
$ make
$ sudo make install


5. apache 시작 및 종료 
$ sudo /usr/local/apache2/bin/apachectl start

$ sudo /usr/local/apache2/bin/apachectl /etc/init.d/apache2
$ sudo invoke-rc.d apache2 start   $ sudo /etc/init.d/apache2 start  : 시작
$ sudo invoke-rc.d apache2 stop   $ sudo /etc/init.d/apache2 stop   : 종료

6. apache 정상동작 확인하기
$ sudo netstat -anp | grep httpd

7.  부팅 시 자동실행
$ sudo vi /etc/init.d/apache2

#!/bin/sh
### BEGIN INIT INFO
# Provides:          apache2
# Required-Start:    $local_fs $remote_fs $network $syslog $named
# Required-Stop:     $local_fs $remote_fs $network $syslog $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# X-Interactive:     true
# Short-Description: Apache2 web server
# Description:       Start the web server and associated helpers
### END INIT INFO
if [ `id -u` -ne 0 ]; then
    echo "You need root privileges to run this script"
    exit 1
fi
# Make sure tomcat is started with system locale
if [ -f /etc/default/locale ]; then
    . /etc/default/locale
    export LANG
fi
if [ -f /etc/default/rcS ]; then
    . /etc/default/rcS
fi
/lib/lsb/init-functions

$ sudo update-rc.d apache2 defaults 

자동실행을 중단하기위해서는
$ sudo update-rc.d apache2 remove
 

OSX의 Terminal에서 ssh로 로그인을 해서 작업중이라면 Perl locale error가 발생할 수 있다. [해결방법]
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8”).

참고) Apache + Tomcat + MySQL 설치 (우분투)

Posted by 모바일헌터