RabbitMQ : Ubuntu에 설치

Programming/Java 2021. 4. 18. 21:54 Posted by 파란크리스마스

출처

저장소 추가

bluesanta@bluesanta-desktop:~$ sudo apt list --installed rabbitmq-server
나열 중... 완료

RabbitMQ 설치

bluesanta@bluesanta-desktop:~$ sudo apt install rabbitmq-server
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다       
상태 정보를 읽는 중입니다... 완료
다음의 추가 패키지가 설치될 것입니다 :
  erlang-asn1 erlang-base erlang-crypto erlang-eldap erlang-ftp erlang-inets erlang-mnesia erlang-os-mon erlang-parsetools
  erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl libsctp1
  locales-all
제안하는 패키지:
  erlang erlang-manpages erlang-doc lksctp-tools
다음 새 패키지를 설치할 것입니다:
  erlang-asn1 erlang-base erlang-crypto erlang-eldap erlang-ftp erlang-inets erlang-mnesia erlang-os-mon erlang-parsetools
  erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl libsctp1
  locales-all rabbitmq-server
0개 업그레이드, 20개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.
38.1 M바이트 아카이브를 받아야 합니다.
이 작업 후 276 M바이트의 디스크 공간을 더 사용하게 됩니다.

RabbitMQ 실행 상태 확인

bluesanta@bluesanta-desktop:~$ systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ Messaging Server
     Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2021-04-18 14:23:53 KST; 4min 59s ago
   Main PID: 2625 (beam.smp)
     Status: "Initialized"
      Tasks: 163 (limit: 18897)
     Memory: 85.5M
     CGroup: /system.slice/rabbitmq-server.service
             ├─2608 /bin/sh /usr/sbin/rabbitmq-server
             ├─2625 /usr/lib/erlang/erts-10.6.4/bin/beam.smp -W w -A 128 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs 30 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -K true -- -root /usr/lib/erlang -progname erl -- -home /var/lib/rabbit>
             ├─2970 erl_child_setup 65536
             ├─3007 inet_gethost 4
             └─3008 inet_gethost 4
 
 4월 18 14:23:50 bluesanta-desktop systemd[1]: Starting RabbitMQ Messaging Server...
 4월 18 14:23:53 bluesanta-desktop systemd[1]: rabbitmq-server.service: Supervising process 2625 which is not our child. We'll most likely not notice when it exits.
 4월 18 14:23:53 bluesanta-desktop systemd[1]: Started RabbitMQ Messaging Server.
 4월 18 14:23:53 bluesanta-desktop systemd[1]: rabbitmq-server.service: Supervising process 2625 which is not our child. We'll most likely not notice when it exits.

Management UI 플러그인 활성화

bluesanta@bluesanta-desktop:~$ sudo rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@bluesanta-desktop:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@bluesanta-desktop...
The following plugins have been enabled:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
 
started 3 plugins.

사용자 추가

사용자 목록 조회

bluesanta@bluesanta-desktop:~$ sudo rabbitmqctl list_users
Listing users ...
user    tags
guest   [administrator]

사용자 추가

bluesanta@bluesanta-desktop:~$ sudo rabbitmqctl add_user admin 'passwd'
Adding user "admin" ...

사용자 권한 부여

bluesanta@bluesanta-desktop:~$ sudo rabbitmqctl set_user_tags admin administrator
Setting tags for user "admin" to [administrator] ...

암호 변경

bluesanta@bluesanta-desktop:~$ sudo rabbitmqctl change_password admin 'passwd'
Changing password for user "admin" ...

RabbitMQ 포트

  • 4369 : epmd, 여러 rabbitmq 서버끼리 서로를 찾을 수 있는 네임 서버 역할을 하는 데몬에서 사용
  • 5672, 5671 : AMQP 를 사용한 메시지 전달
  • 25672 : inter-node 와 CLI Tool 연결
  • 15672 : HTTP API, Management UI

RabbitMQ 관리페이지

웹브라우저로 http://serverip:15672/에 접속

MQTT 플러그인 활성화

bluesanta@bluesanta-desktop:~$ sudo rabbitmq-plugins enable rabbitmq_mqtt
Enabling plugins on node rabbit@bluesanta-desktop:
rabbitmq_mqtt
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_mqtt
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@bluesanta-desktop...
The following plugins have been enabled:
  rabbitmq_mqtt
 
started 1 plugins.
bluesanta@bluesanta-desktop:~$ netstat -nao | grep 1883
tcp6       0      0 :::1883                 :::*                    LISTEN      off (0.00/0/0)

댓글을 달아 주세요

Apache로 Tomcat 로드밸런싱 설정

Programming/Apache, PHP 2021. 4. 10. 13:04 Posted by 파란크리스마스

출처

필수 라이브러리 설치

bluesanta@bluesanta-desktop:~$ sudo apt install libexpat1-dev libssl-dev

PCRE 설치

bluesanta@bluesanta-desktop:~$ wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
bluesanta@bluesanta-desktop:~$ tar xvf pcre-8.44.tar.gz 
bluesanta@bluesanta-desktop:~$ cd pcre-8.44/
bluesanta@bluesanta-desktop:~/pcre-8.44$ ./configure --prefix=/usr/local/pcre-8.44
bluesanta@bluesanta-desktop:~/pcre-8.44$ make
bluesanta@bluesanta-desktop:~/pcre-8.44$ sudo make install

Apache 웹서버 설치

bluesanta@bluesanta-desktop:~$ wget https://archive.apache.org/dist/httpd/httpd-2.4.39.tar.gz
bluesanta@bluesanta-desktop:~$ tar xvf httpd-2.4.39.tar.gz 
bluesanta@bluesanta-desktop:~$ cd httpd-2.4.39/
bluesanta@bluesanta-desktop:~/httpd-2.4.39$ cd srclib
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ wget https://archive.apache.org/dist/apr/apr-1.7.0.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ tar xvfz apr-1.7.0.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ mv apr-1.7.0 apr
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ wget https://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ tar xvfz apr-util-1.6.1.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ mv apr-util-1.6.1 apr-util
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ tar xvfz pcre-8.44.tar.gz
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ mv pcre-8.44 pcre
bluesanta@bluesanta-desktop:~/httpd-2.4.39/srclib$ cd ..
bluesanta@bluesanta-desktop:~/httpd-2.4.39$ ./configure --prefix=/opt/apache24 --with-pcre=/usr/local/pcre-8.44 --enable-cgi --enable-info --enable-deflate --enable-ssl --enable-proxy --enable-proxy-connect --enable-proxy-http --enable-proxy-ftp --enable-expires --enable-headers --enable-rewrite --enable-so --with-included-apr --with-included-apr-util --with-included-pcre
bluesanta@bluesanta-desktop:~/httpd-2.4.39$ make
bluesanta@bluesanta-desktop:~/httpd-2.4.39$ make install

mod_jk 설치

bluesanta@bluesanta-desktop:~$ wget https://archive.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.46-src.tar.gz
bluesanta@bluesanta-desktop:~$ tar xvf tomcat-connectors-1.2.46-src.tar.gz
bluesanta@bluesanta-desktop:~$ cd tomcat-connectors-1.2.46-src/native/
bluesanta@bluesanta-desktop:~$ ./configure --with-apxs=/opt/apache24//bin/apxs
bluesanta@bluesanta-desktop:~/tomcat-connectors-1.2.46-src/native$ make
bluesanta@bluesanta-desktop:~/tomcat-connectors-1.2.46-src/native$ make install

로드밸런싱 설정

bluesanta@bluesanta-desktop:~$ cd /opt/apache24/conf/
bluesanta@bluesanta-desktop:/opt/apache24/conf$ vi workers.properties

workers.properties

worker.list=load_balancer

worker.load_balancer.type=lb
worker.load_balancer.balance_workers=tomcat1,tomcat2
#worker.load_balancer.balance_workers=tomcat2

# tomcat/conf/server.xml - ajp 포트
worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=1

# tomcat/conf/server.xml - ajp 포트
worker.tomcat2.port=7009
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=1

httpd.conf

bluesanta@bluesanta-desktop:/opt/apache24/conf$ vi httpd.conf

LoadModule jk_module modules/mod_jk.so

... 생략 ...

<IfModule jk_module>
    JkWorkersFile    conf/workers.properties
    JkLogFile        logs/mod_jk.log
    JkLogLevel       info
    JkMount /* 	load_balancer
</IfModule>

Apache 웹서버 환경 설정

bluesanta@bluesanta-desktop:~$ cd /opt/apache24/conf/
bluesanta@bluesanta-desktop:/opt/apache24/conf$ vi httpd.conf

ServerName 주석을 풀고 localhost로 설정

#ServerName www.example.com:80
ServerName localhost

서비스 등록 파일 apache2.service 생성

bluesanta@bluesanta-desktop:/opt/apache24/conf$ cd /opt/apache24/bin/
bluesanta@bluesanta-desktop:/opt/apache24/bin$ vi apache2.service

apache2.service 내용

[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=https://httpd.apache.org/docs/2.4/

[Service]
Type=forking
Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/opt/apache24/bin/apachectl start
ExecStop=/opt/apache24/bin/apachectl stop
ExecReload=/opt/apache24/bin/apachectl graceful
PrivateTmp=true
Restart=on-abort

[Install]
WantedBy=multi-user.target

apache2.service 파일 /etc/systemd/system 디렉토리에 복사

bluesanta@bluesanta-desktop:/opt/apache24/bin$ sudo chmod +x apache2.service
bluesanta@bluesanta-desktop:/opt/apache24/bin$ sudo cp apache2.service /etc/systemd/system

Apache 서비스 등록

bluesanta@bluesanta-desktop:/opt/apache24/bin$ sudo systemctl enable apache2
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /etc/systemd/system/apache2.service.

Apache 서비스 실행

bluesanta@bluesanta-desktop:/opt/apache24/bin$ sudo systemctl start apache2

Apache 서비스 상태 확인

bluesanta@bluesanta-desktop:/opt/apache24/bin$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/etc/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-04-10 14:22:21 KST; 57s ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 284736 (httpd)
      Tasks: 82 (limit: 18898)
     Memory: 7.2M
     CGroup: /system.slice/apache2.service
             ├─284736 /opt/apache24/bin/httpd -k start
             ├─284737 /opt/apache24/bin/httpd -k start
             ├─284738 /opt/apache24/bin/httpd -k start
             └─284739 /opt/apache24/bin/httpd -k start
 
 4월 10 14:22:21 bluesanta-desktop systemd[1]: Starting The Apache HTTP Server...
 4월 10 14:22:21 bluesanta-desktop systemd[1]: Started The Apache HTTP Server.

댓글을 달아 주세요

git 파일 추가

Programming 2021. 4. 3. 12:10 Posted by 파란크리스마스

출처

추가할 파일이 있는지 확인

$ git status
On branch master
Your branch is up to date with 'origin/master'.
 
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        dist_admin.sh
 
nothing added to commit but untracked files present (use "git add" to track)

git 파일 추가

$ git add dist_admin.sh

추가한 파일 Repository에 commit

$ git commit -m "add dist_admin.sh"
[master de5e9a98] add dist_admin.sh
 Committer: EC2 Default User <ec2-user@-------------------------->
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:
 
    git config --global --edit
 
After doing this, you may fix the identity used for this commit with:
 
    git commit --amend --reset-author
 
 1 file changed, 7 insertions(+)
 create mode 100755 dist_admin.sh

원격 저장소에 push

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
 
nothing to commit, working tree clean
$ git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 2 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 441 bytes | 441.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/-----/--------
   b9b9e27d..de5e9a98  master -> master

댓글을 달아 주세요

출처

Python 설치

bluesanta@Kubuntu:~$ sudo apt install python

Android NDK(C/C++) 다운로드, 압축 해제

bluesanta@Kubuntu:~$ wget https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip
bluesanta@Kubuntu:~$ sudo mv android-ndk-r20b-linux-x86_64.zip /opt/
bluesanta@Kubuntu:~$ cd /opt/
bluesanta@Kubuntu:/opt$ sudo unzip android-ndk-r20b-linux-x86_64.zip

NDK 경로 path에 추가

bluesanta@Kubuntu:/opt$ echo 'export ANDROID_NDK_ROOT=/opt/android-ndk-r20b' | tee -a ~/.bashrc
bluesanta@Kubuntu:/opt$ echo 'export PATH=$PATH:$ANDROID_NDK_ROOT' | tee -a ~/.bashrc

.profile-ndk 파일 작성

bluesanta@Kubuntu:/opt$ vi ~/.profile_ndk

.profile-ndk 내용

export ANDROID_NDK_ROOT=/opt/android-ndk-r20b
export NDK_TOOLCHAIN_VERSION=4.8
export TOOLCHAIN=/opt/android-21-toolchain
 
export PATH=$TOOLCHAIN/bin:$PATH

.profile-ndk 실행 (NDK 빌드시 사용)

bluesanta@Kubuntu:/opt$ chmod a+x ~/.profile_ndk
bluesanta@Kubuntu:/opt$ source ~/.profile_ndk

toolchain 설치

bluesanta@Kubuntu:/opt$ sudo $ANDROID_NDK_ROOT/build/tools/make-standalone-toolchain.sh \
  --verbose \
  --install-dir=$TOOLCHAIN \
  --platform=android-21
HOST_OS=linux
HOST_EXE=
HOST_ARCH=x86_64
HOST_TAG=linux-x86_64
HOST_NUM_CPUS=4
BUILD_NUM_CPUS=8
Auto-config: --arch=arm
## COMMAND: python /opt/android-ndk-r20b/build/tools/make_standalone_toolchain.py --arch arm --api 21 --stl gnustl --install-dir=/opt/android-21-toolchain
WARNING:__main__:make_standalone_toolchain.py is no longer necessary. The
$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin directory contains target-specific scripts that perform
the same task. For example, instead of:
 
    $ python $NDK/build/tools/make_standalone_toolchain.py \
        --arch arm --api 21 --install-dir toolchain
    $ toolchain/bin/clang++ src.cpp
 
Instead use:
 
    $ $NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++ src.cpp
 
Toolchain installed to /opt/android-21-toolchain.

toolchain 환경설정

bluesanta@Kubuntu:/opt$ echo 'export TOOLCHAIN=/opt/android-21-toolchain' | tee -a ~/.bashrc
bluesanta@Kubuntu:/opt$ echo 'export PATH=$TOOLCHAIN/bin:$PATH' | tee -a ~/.bashrc

예제

Android.mk

LOCAL_PATH := $(call my-dir)
 
include $(CLEAR_VARS)
 
LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := hello-jni.c
 
include $(BUILD_SHARED_LIBRARY)

hello-jni.c

#include <string.h>
#include <jni.h>

JNIEXPORT jstring JNICALL
Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
                                                  jobject thiz )
{
#if defined(__arm__)
    #if defined(__ARM_ARCH_7A__)
    #if defined(__ARM_NEON__)
      #if defined(__ARM_PCS_VFP)
        #define ABI "armeabi-v7a/NEON (hard-float)"
      #else
        #define ABI "armeabi-v7a/NEON"
      #endif
    #else
      #if defined(__ARM_PCS_VFP)
        #define ABI "armeabi-v7a (hard-float)"
      #else
        #define ABI "armeabi-v7a"
      #endif
    #endif
  #else
   #define ABI "armeabi"
  #endif
#elif defined(__i386__)
#define ABI "x86"
#elif defined(__x86_64__)
#define ABI "x86_64"
#elif defined(__mips64)  /* mips64el-* toolchain defines __mips__ too */
#define ABI "mips64"
#elif defined(__mips__)
#define ABI "mips"
#elif defined(__aarch64__)
#define ABI "arm64-v8a"
#else
#define ABI "unknown"
#endif

    return (*env)->NewStringUTF(env, "Hello from JNI !  Compiled with ABI " ABI ".");
}

컴파일

bluesanta@Kubuntu:/bluesanta/workspace.cmx/hello_ndk$ ndk-build NDK_PROJECT_PATH=`pwd` APP_BUILD_SCRIPT=Android.mk
Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-16.    
[arm64-v8a] Compile        : hello-jni <= hello-jni.c
[arm64-v8a] SharedLibrary  : libhello-jni.so
[arm64-v8a] Install        : libhello-jni.so => libs/arm64-v8a/libhello-jni.so
[armeabi-v7a] Compile thumb  : hello-jni <= hello-jni.c
[armeabi-v7a] SharedLibrary  : libhello-jni.so
[armeabi-v7a] Install        : libhello-jni.so => libs/armeabi-v7a/libhello-jni.so
[x86] Compile        : hello-jni <= hello-jni.c
[x86] SharedLibrary  : libhello-jni.so
[x86] Install        : libhello-jni.so => libs/x86/libhello-jni.so
[x86_64] Compile        : hello-jni <= hello-jni.c
[x86_64] SharedLibrary  : libhello-jni.so
[x86_64] Install        : libhello-jni.so => libs/x86_64/libhello-jni.so

Java 사용 예제

package com.example.hellojni;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloJni extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_hello_jni);
        TextView tv = (TextView)findViewById(R.id.hello_textview);
        tv.setText( stringFromJNI() );
    }
 
    public native String  stringFromJNI();

    public native String  unimplementedStringFromJNI();

    static {
        System.loadLibrary("hello-jni");
    }
}

댓글을 달아 주세요

Ubuntu 20.04 : PHP5 설치

Programming/Apache, PHP 2020. 11. 25. 00:43 Posted by 파란크리스마스

출처

필요 라이브러리 설치

bluesanta@Kubuntu:~$ sudo apt install libc-client2007e-dev libgdbm-dev libgmp-dev libkrb5-dev

libmcrypt 설치

bluesanta@Kubuntu:~$ wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
bluesanta@Kubuntu:~$ tar xvfz libmcrypt-2.5.8.tar.gz
bluesanta@Kubuntu:~$ cd libmcrypt-2.5.8/
bluesanta@Kubuntu:~/libmcrypt-2.5.8$ ./configure
bluesanta@Kubuntu:~/libmcrypt-2.5.8$ make
bluesanta@Kubuntu:~/libmcrypt-2.5.8$ sudo make install

mhash 설치

bluesanta@Kubuntu:~$ wget https://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
bluesanta@Kubuntu:~$ tar xvfz mhash-0.9.9.9.tar.gz
bluesanta@Kubuntu:~$ cd mhash-0.9.9.9/
bluesanta@Kubuntu:~/mhash-0.9.9.9$ ./configure
bluesanta@Kubuntu:~/mhash-0.9.9.9$ make
bluesanta@Kubuntu:~/mhash-0.9.9.9$ sudo make install

FreeTDS 설치

bluesanta@Kubuntu:~$ wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-patched.tar.gz
bluesanta@Kubuntu:~$ tar xvfz freetds-patched.tar.gz
bluesanta@Kubuntu:~$ cd freetds-1.2.12/
bluesanta@Kubuntu:~/freetds-1.2.12$ ./configure -prefix=/usr/local/freetds --disable-odbc --disable-debug --enable-msdblib
bluesanta@Kubuntu:~/freetds-1.2.12$ make
bluesanta@Kubuntu:~/freetds-1.2.12$ sudo make install

freetype2 설치

bluesanta@Kubuntu:~$ wget https://downloads.sourceforge.net/freetype/freetype-2.10.4.tar.xz
bluesanta@Kubuntu:~$ tar xvf freetype-2.10.4.tar.xz
bluesanta@Kubuntu:~$ cd freetype-2.10.4/
bluesanta@Kubuntu:~/freetype-2.10.4$ ./configure --prefix=/usr --enable-freetype-config 
bluesanta@Kubuntu:~/freetype-2.10.4$ make -j4
bluesanta@Kubuntu:~/freetype-2.10.4$ sudo make install

openssl 설치

bluesanta@Kubuntu:~$ wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz
bluesanta@Kubuntu:~$ tar xvfz openssl-1.0.2u.tar.gz
bluesanta@Kubuntu:~$ cd openssl-1.0.2u
bluesanta@Kubuntu:~/openssl-1.0.2u$ ./config -fPIC shared --prefix=/opt/openssl-1.0.2u
bluesanta@Kubuntu:~/openssl-1.0.2u$ make -j4
bluesanta@Kubuntu:~/openssl-1.0.2u$ sudo make install
bluesanta@Kubuntu:~/openssl-1.0.2u$/opt/openssl-1.0.2u/bin/openssl version
OpenSSL 1.0.2u  20 Dec 2019

libcurl 설치

bluesanta@Kubuntu:~$ wget https://curl.haxx.se/download/curl-7.73.0.tar.gz
bluesanta@Kubuntu:~$ tar xvfz curl-7.73.0.tar.gz 
bluesanta@Kubuntu:~$ cd curl-7.73
bluesanta@Kubuntu:~/curl-7.73.0$ env PKG_CONFIG_PATH=/opt/openssl-1.0.2u/lib/pkgconfig ./configure --prefix=/opt/curl-7.73.0 --with-openssl
... 생략 ...
  SSL:              enabled (OpenSSL)
... 생략 ...
bluesanta@Kubuntu:~/curl-7.73.0$ make
bluesanta@Kubuntu:~/curl-7.73.0$ sudo make install
bluesanta@Kubuntu:~/curl-7.73.0$ sudo ln -s /opt/openssl-1.0.2u/lib/libssl.so.1.0.0 /usr/lib/libssl.so.1.0.0
bluesanta@Kubuntu:~/curl-7.73.0$ sudo ln -s /opt/openssl-1.0.2u/lib/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.1.0.0
bluesanta@Kubuntu:~/curl-7.73.0$ /opt/curl-7.73.0/bin/curl --version
curl 7.73.0 (x86_64-pc-linux-gnu) libcurl/7.73.0 OpenSSL/1.0.2u zlib/1.2.11
Release-Date: 2020-10-14
Protocols: dict file ftp ftps gopher http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets

PHP5 설치

1. PHP5 컴파일 오류 수정

오류 메시지

configure: error: Unable to locate gmp.h

해결방법

bluesanta@Kubuntu:~$ sudo ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h

2. PHP5 컴파일 오류 수정

오류 메시지

configure: error: wrong mysql library version or lib not found. Check config.log for more information.

해결방법

bluesanta@Kubuntu:~/php-5.6.40$ sudo ln -s /bluesanta/mysql-5.7.23/lib/libmysqlclient.so /bluesanta/mysql-5.7.23/lib/libmysqlclient_r.so

2. PHP5 컴파일 오류 회피

오류 메시지

/bin/bash: line 1: 3884732 세그멘테이션 오류 (core dumped) ` if test -x "/home/bluesanta/php-5.6.40/sapi/cli/php"; then /home/bluesanta/php-5.6.40/build/shtool echo -n -- "/home/bluesanta/php-5.6.40/sapi/cli/php -n"; if test "x" != "x"; then /home/bluesanta/php-5.6.40/build/shtool echo -n -- " -d extension_dir=/home/bluesanta/php-5.6.40/modules"; for i in bz2 zlib phar; do if test -f "/home/bluesanta/php-5.6.40/modules/$i.la"; then . /home/bluesanta/php-5.6.40/modules/$i.la; /home/bluesanta/php-5.6.40/build/shtool echo -n -- " -d extension=$dlname"; fi; done; fi; else /home/bluesanta/php-5.6.40/build/shtool echo -n -- "/home/bluesanta/php-5.6.40/sapi/cli/php"; fi;` -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0 -d 'safe_mode=0' /home/bluesanta/php-5.6.40/ext/phar/build_precommand.php > ext/phar/phar.php
make: *** [Makefile:381: ext/phar/phar.php] 오류 139
make: *** 끝나지 않은 작업을 기다리고 있습니다....

configure 해당 옵션 제거

--with-imap=/usr/local/imap-2007f \
--with-imap-ssl \

PHP5 컴파일

bluesanta@Kubuntu:~$ wget https://www.php.net/distributions/php-5.6.40.tar.gz
bluesanta@Kubuntu:~$ tar xvfz php-5.6.40.tar.gz
bluesanta@Kubuntu:~$ bluesanta@Kubuntu:~$ cd php-5.6.40/
bluesanta@Kubuntu:~/php-5.6.40$ env PKG_CONFIG_PATH=/opt/openssl-1.0.2u/lib/pkgconfig \
./configure --prefix=/bluesanta/apps/php-5.6.40 \
--enable-fpm \
--with-apxs2=/bluesanta/apps/apache24_php5/bin/apxs \
--with-libdir=/lib \
--with-gettext \
--with-gmp \
--with-gd \
--with-jpeg-dir=/usr/local/jpeg \
--with-png-dir=/usr/local/lib \
--with-mcrypt=/usr/local/lib \
--with-iconv \
--with-freetype-dir=/usr/local/freetype \
--with-config-file-path=/usr/local/lib \
--enable-gd-native-ttf \
--enable-bcmath \
--enable-exif \
--with-mcrypt \
--with-zlib \
--with-bz2 \
--enable-mbstring \
--enable-opcache \
--with-openssl=/opt/openssl-1.0.2u \
--with-curl=/opt/curl-7.73.0/bin/curl \
--with-mysql-sock=/bluesanta/mysql-5.7.23/mysql.sock \
--with-mysqli=/bluesanta/mysql-5.7.23/bin/mysql_config \
--with-pdo-mysql=/bluesanta/mysql-5.7.23 \
--with-mysql \
--with-mssql=/usr/local/freetds \
--enable-pcntl \
--enable-mbregex \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-libxml-dir=/usr \
--with-kerberos \
--disable-debug \
--enable-soap \
--with-gdbm \
--enable-ftp \
--enable-calendar \
--enable-shmop \
--enable-inline-optimization \
--enable-sigchild \
--enable-sockets \
--enable-maintainer-zts
bluesanta@Kubuntu:~/php-5.6.40$ make -j4
 
... 생략 ...
 
/usr/bin/ld: warning: libssl.so.1.1, needed by /usr/local/freetds/lib/libsybdb.so, may conflict with libssl.so.1.0.0
/usr/bin/ld: warning: libcrypto.so.1.1, needed by /usr/local/freetds/lib/libsybdb.so, may conflict with libcrypto.so.1.0.0
/usr/bin/ld: warning: libssl.so.1.1, needed by /usr/local/freetds/lib/libsybdb.so, may conflict with libssl.so.1.0.0
/usr/bin/ld: warning: libcrypto.so.1.1, needed by /usr/local/freetds/lib/libsybdb.so, may conflict with libcrypto.so.1.0.0
Generating phar.php
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
directorytreeiterator.inc
clicommand.inc
directorygraphiterator.inc
invertedregexiterator.inc
pharcommand.inc
phar.inc
/usr/bin/ld: warning: libssl.so.1.1, needed by /usr/local/freetds/lib/libsybdb.so, may conflict with libssl.so.1.0.0
/usr/bin/ld: warning: libcrypto.so.1.1, needed by /usr/local/freetds/lib/libsybdb.so, may conflict with libcrypto.so.1.0.0
bluesanta@Kubuntu:~/php-5.6.40$ make test

PHP5 설치

bluesanta@Kubuntu:~/php-5.6.40$ make install
/bin/bash /home/bluesanta/php-5.6.40/libtool --silent --preserve-dup-deps --mode=install cp ext/opcache/opcache.la /home/bluesanta/php-5.6.40/modules
Installing PHP SAPI module:       apache2handler
/bluesanta/apps/apache24/build/instdso.sh SH_LIBTOOL='/bluesanta/apps/apache24/build/libtool' libphp5.la /bluesanta/apps/apache24/modules
/bluesanta/apps/apache24/build/libtool --mode=install install libphp5.la /bluesanta/apps/apache24/modules/
libtool: install: install .libs/libphp5.so /bluesanta/apps/apache24/modules/libphp5.so
libtool: install: install .libs/libphp5.lai /bluesanta/apps/apache24/modules/libphp5.la
libtool: warning: remember to run 'libtool --finish /home/bluesanta/php-5.6.40/libs'
chmod 755 /bluesanta/apps/apache24/modules/libphp5.so
[activating module `php5' in /bluesanta/apps/apache24/conf/httpd.conf]
Installing shared extensions:     /bluesanta/apps/php-5.6.40/lib/php/extensions/no-debug-zts-20131226/
Installing PHP CLI binary:        /bluesanta/apps/php-5.6.40/bin/
Installing PHP CLI man page:      /bluesanta/apps/php-5.6.40/php/man/man1/
Installing PHP FPM binary:        /bluesanta/apps/php-5.6.40/sbin/
Installing PHP FPM config:        /bluesanta/apps/php-5.6.40/etc/
Installing PHP FPM man page:      /bluesanta/apps/php-5.6.40/php/man/man8/
Installing PHP FPM status page:   /bluesanta/apps/php-5.6.40/php/php/fpm/
Installing PHP CGI binary:        /bluesanta/apps/php-5.6.40/bin/
Installing PHP CGI man page:      /bluesanta/apps/php-5.6.40/php/man/man1/
Installing build environment:     /bluesanta/apps/php-5.6.40/lib/php/build/
Installing header files:           /bluesanta/apps/php-5.6.40/include/php/
Installing helper programs:       /bluesanta/apps/php-5.6.40/bin/
  program: phpize
  program: php-config
Installing man pages:             /bluesanta/apps/php-5.6.40/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /bluesanta/apps/php-5.6.40/lib/php/
[PEAR] Archive_Tar    - already installed: 1.4.4
[PEAR] Console_Getopt - already installed: 1.4.1
[PEAR] Structures_Graph- already installed: 1.1.1
[PEAR] XML_Util       - already installed: 1.4.3
[PEAR] PEAR           - already installed: 1.10.7
Wrote PEAR system config file at: /bluesanta/apps/php-5.6.40/etc/pear.conf
You may want to add: /bluesanta/apps/php-5.6.40/lib/php to your php.ini include_path
/home/bluesanta/php-5.6.40/build/shtool install -c ext/phar/phar.phar /bluesanta/apps/php-5.6.40/bin
ln -s -f phar.phar /bluesanta/apps/php-5.6.40/bin/phar
Installing PDO headers:           /bluesanta/apps/php-5.6.40/include/php/ext/pdo/




php.ini 복사

bluesanta@Kubuntu:~/php-5.6.40$ cp php.ini-production /bluesanta/apps/php-5.6.40/php.ini

libphp5.so 복사

bluesanta@Kubuntu:~/php-5.6.40$ cp /bluesanta/apps/apache24/modules/libphp5.so /bluesanta/apps/apache24_php5/modules/libphp5.so

/bluesanta/apps/apache24_php5/conf/httpd.conf 내용 추가

bluesanta@Kubuntu:~/php-5.6.40$ vi /bluesanta/apps/apache24_php5/conf/httpd.conf

#Listen 12.34.56.78:80
Listen 5050

# php 
LoadModule php5_module        modules/libphp5.so
PHPIniDir "/bluesanta/apps/php-5.6.40"

... 생략 ...

    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
    AddHandler application/x-httpd-php .php4 .php .phtml .ph .inc

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
    AddType application/x-httpd-php .php4 .php .phtml .ph .inc

</IfModule>

서비스 등록 파일 apache2_php5.service 생성

bluesanta@Kubuntu:~$ cd /bluesanta/apps/apache24_php5/bin/
bluesanta@Kubuntu:/bluesanta/apps/apache24_php5/bin$ vi apache2_php5.service

apache2_php5.service 내용

[Unit]
Description=The Apache HTTP Server(PHP5)
After=network.target remote-fs.target nss-lookup.target
Documentation=https://httpd.apache.org/docs/2.4/

[Service]
Type=forking
Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/bluesanta/apps/apache24_php5/bin/apachectl start
ExecStop=/bluesanta/apps/apache24_php5/bin/apachectl stop
ExecReload=/bluesanta/apps/apache24_php5/bin/apachectl graceful
PrivateTmp=true
Restart=on-abort

[Install]
WantedBy=multi-user.target

apache2_php5.service 파일 /etc/systemd/system 디렉토리에 복사

bluesanta@Kubuntu:/bluesanta/apps/apache24_php5/bin$ chmod +x apache2_php5.service
bluesanta@Kubuntu:/bluesanta/apps/apache24_php5/bin$ sudo cp apache2_php5.service /etc/systemd/system

Apache 서비스 등록

bluesanta@Kubuntu:/bluesanta/apps/apache24_php5/bin$ sudo systemctl enable apache2_php5
Created symlink /etc/systemd/system/multi-user.target.wants/apache2_php5.service → /etc/systemd/system/apache2_php5.service.

Apache 서비스 실행

pi@Kubuntu:/bluesanta/apps/apache24/bin$ sudo systemctl start apache2_php5

Apache 서비스 상태 확인

bluesanta@Kubuntu:/bluesanta/apps/apache24_php5/bin$ sudo systemctl status apache2_php5
● apache2_php5.service - The Apache HTTP Server(PHP5)
     Loaded: loaded (/etc/systemd/system/apache2_php5.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Thu 2020-11-26 01:05:49 KST; 13s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 4178335 ExecStart=/bluesanta/apps/apache24_php5/bin/apachectl start (code=exited, status=0/SUCCESS)
    Process: 4178350 ExecStop=/bluesanta/apps/apache24_php5/bin/apachectl stop (code=exited, status=0/SUCCESS)
 
11월 26 01:05:48 Kubuntu systemd[1]: Starting The Apache HTTP Server(PHP5)...
11월 26 01:05:49 Kubuntu apachectl[4178337]: httpd (pid 1179212) already running
11월 26 01:05:49 Kubuntu systemd[1]: apache2_php5.service: Succeeded.
11월 26 01:05:49 Kubuntu systemd[1]: Started The Apache HTTP Server(PHP5).

댓글을 달아 주세요

Ubuntu 20.04 : Apache 웹서버 컴파일 설치

Programming/Apache, PHP 2020. 11. 18. 22:48 Posted by 파란크리스마스

출처

필수 라이브러리 설치

$ sudo apt install libexpat1-dev

PCRE 설치

pi@Kubuntu:/bluesanta/apps$ wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
pi@Kubuntu:/bluesanta/apps$ tar xvfz pcre-8.44.tar.gz
pi@Kubuntu:/bluesanta/apps$ cd pcre-8.44/
pi@Kubuntu:/bluesanta/apps/pcre-8.44$ ./configure --prefix=/usr/local/pcre-8.44
pi@Kubuntu:/bluesanta/apps/pcre-8.44$ make
pi@Kubuntu:/bluesanta/apps/pcre-8.44$ sudo make install

Apache 웹서버 컴파일 & 설치

pi@Kubuntu:~$ cd /bluesanta/apps
pi@Kubuntu:/bluesanta/apps$ wget https://downloads.apache.org//httpd/httpd-2.4.46.tar.gz
pi@Kubuntu:/bluesanta/apps$ tar xvfz httpd-2.4.46.tar.gz
pi@Kubuntu:/bluesanta/apps$ cd httpd-2.4.46/
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46$ cd srclib
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46/srclib$ wget https://archive.apache.org/dist/apr/apr-1.7.0.tar.gz
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46/srclib$ tar xvfz apr-1.7.0.tar.gz
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46/srclib$ mv apr-1.7.0 apr
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46/srclib$ wget https://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46/srclib$ tar xvfz apr-util-1.6.1.tar.gz
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46/srclib$ mv apr-util-1.6.1 apr-util
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46/srclib$ wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46/srclib$ tar xvfz pcre-8.44.tar.gz
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46/srclib$ mv pcre-8.44 pcre
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46$ cd ..
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46$ ./configure --prefix=/bluesanta/apps/apache24 --with-pcre=/usr/local/pcre-8.44 --enable-cgi --enable-info --enable-deflate --enable-ssl --enable-proxy --enable-proxy-connect --enable-proxy-http --enable-proxy-ftp --enable-expires --enable-headers --enable-rewrite --enable-so --with-included-apr --with-included-apr-util --with-included-pcre
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46$ make
pi@Kubuntu:/bluesanta/apps/httpd-2.4.46$ make install

Apache 웹서버 환경 설정

pi@Kubuntu:/bluesanta/apps/apache24$ cd conf
pi@Kubuntu:/bluesanta/apps/apache24/conf$ vi httpd.conf

ServerName 주석을 풀고 localhost로 설정

#ServerName www.example.com:80
ServerName localhost

서비스 등록 파일 apache2.service 생성

pi@Kubuntu:~$ cd /bluesanta/apps/apache24/bin/
pi@Kubuntu:/bluesanta/apps/apache24/bin$ vi apache2.service

apache2.service 내용

[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=https://httpd.apache.org/docs/2.4/

[Service]
Type=forking
Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/bluesanta/apps/apache24/bin/apachectl start
ExecStop=/bluesanta/apps/apache24/bin/apachectl stop
ExecReload=/bluesanta/apps/apache24/bin/apachectl graceful
PrivateTmp=true
Restart=on-abort

[Install]
WantedBy=multi-user.target

apache2.service 파일 /etc/systemd/system 디렉토리에 복사

pi@Kubuntu:/bluesanta/apps/apache24/bin$ chmod +x apache2.service
pi@Kubuntu:/bluesanta/apps$ sudo cp apache2.service /etc/systemd/system

Apache 서비스 등록

pi@Kubuntu:/bluesanta/apps/apache24/bin$ sudo systemctl enable apache2
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /etc/systemd/system/apache2.service.

Apache 서비스 실행

pi@Kubuntu:/bluesanta/apps/apache24/bin$ sudo systemctl start apache2

Apache 서비스 상태 확인

$ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/etc/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2020-11-19 00:06:39 KST; 3s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 154499 ExecStart=/bluesanta/apps/apache24/bin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 154519 (httpd)
      Tasks: 82 (limit: 18693)
     Memory: 6.9M
     CGroup: /system.slice/apache2.service
             ├─154519 /bluesanta/apps/apache24/bin/httpd -k start
             ├─154520 /bluesanta/apps/apache24/bin/httpd -k start
             ├─154521 /bluesanta/apps/apache24/bin/httpd -k start
             └─154522 /bluesanta/apps/apache24/bin/httpd -k start
 
11월 19 00:06:39 Kubuntu systemd[1]: Starting The Apache HTTP Server...
11월 19 00:06:39 Kubuntu systemd[1]: Started The Apache HTTP Server.



Apache 웹서버 컴파일 참조 라이브러리 설치

srclib 디렉토리 사용전에 사용했던 것으로 불필요 - 나중에 참고용으로 남겨둠

apr 라이브러리 설치

pi@Kubuntu:/bluesanta/apps$ wget https://archive.apache.org/dist/apr/apr-1.7.0.tar.gz
pi@Kubuntu:/bluesanta/apps$ tar xvfz apr-1.7.0.tar.gz
pi@Kubuntu:/bluesanta/apps$ cd apr-1.7.0/
pi@Kubuntu:/bluesanta/apps/apr-1.7.0$ ./configure
pi@Kubuntu:/bluesanta/apps/apr-1.7.0$ make
pi@Kubuntu:/bluesanta/apps/apr-1.7.0$ sudo make install
 
... 생략 ...
 
----------------------------------------------------------------------
/usr/bin/install -c -m 644 apr.exp /usr/local/apr/lib/apr.exp
/usr/bin/install -c -m 644 apr.pc /usr/local/apr/lib/pkgconfig/apr-1.pc
for f in libtool shlibtool; do \
    if test -f ${f}; then /usr/bin/install -c -m 755 ${f} /usr/local/apr/build-1; fi; \
done
/usr/bin/install -c -m 755 /bluesanta/apps/apr-1.7.0/build/mkdir.sh /usr/local/apr/build-1
for f in make_exports.awk make_var_export.awk; do \
    /usr/bin/install -c -m 644 /bluesanta/apps/apr-1.7.0/build/${f} /usr/local/apr/build-1; \
done
/usr/bin/install -c -m 644 build/apr_rules.out /usr/local/apr/build-1/apr_rules.mk
/usr/bin/install -c -m 755 apr-config.out /usr/local/apr/bin/apr-1-config

apr-util 라이브러리 설치

pi@Kubuntu:/bluesanta/apps$ wget https://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz
pi@Kubuntu:/bluesanta/apps$ tar xvfz apr-util-1.6.1.tar.gz
pi@Kubuntu:/bluesanta/apps$ cd apr-util-1.6.1/
pi@Kubuntu:/bluesanta/apps/apr-util-1.6.1$ ./configure -with-apr=/usr/local/apr
pi@Kubuntu:/bluesanta/apps/apr-util-1.6.1$ make
pi@Kubuntu:/bluesanta/apps/apr-util-1.6.1$ sudo make install
 
... 생략 ...
 
----------------------------------------------------------------------
/usr/bin/install -c -m 644 aprutil.exp /usr/local/apr/lib
/usr/bin/install -c -m 755 apu-config.out /usr/local/apr/bin/apu-1-config

댓글을 달아 주세요

Ubuntu 20.04 : Tomcat 서비스 등록

Programming/Java 2020. 11. 14. 13:25 Posted by 파란크리스마스

출처

tomcat 설치

pi@Kubuntu:~$ cd /bluesanta/apps
pi@Kubuntu:/bluesanta/apps$ wget https://downloads.apache.org/tomcat/tomcat-8/v8.5.59/bin/apache-tomcat-8.5.59.tar.gz
pi@Kubuntu:/bluesanta/apps$ tar xvfz apache-tomcat-8.5.59.tar.gz

tomcat /opt 디렉토리에 소프트 링크 걸기

pi@Kubuntu:/bluesanta/apps$ sudo ln -s /bluesanta/apps/apache-tomcat-8.5.59 /opt/apache-tomcat-8.5.59

서비스 등록 파일 tomcat.service 생성

pi@Kubuntu:/bluesanta/apps$ cd /etc/systemd/system
pi@Kubuntu:/etc/systemd/system$ sudo vi /etc/systemd/system/tomcat.service

tomcat.service 내용

[Unit]
Description=tomcat 8
After=network.target syslog.target

[Service]
Type=forking
Environment="JAVA_HOME=/opt/jdk1.8.0_271"
User=root
Group=root
ExecStart=/opt/apache-tomcat-8.5.59/bin/startup.sh
ExecStop=/opt/apache-tomcat-8.5.59/bin/shutdown.sh

[Install]
WantedBy=multi-user.target

tomcat 서비스 등록

pi@Kubuntu:/etc/systemd/system$ sudo systemctl enable tomcat.service
Created symlink /etc/systemd/system/multi-user.target.wants/tomcat.service → /etc/systemd/system/tomcat.service.

tomcat 서비스 실행

pi@Kubuntu:/etc/systemd/system$ sudo systemctl start tomcat.service

tomcat 서비스 상태 확인

pi@Kubuntu:/etc/systemd/system$ sudo systemctl status tomcat.service
● tomcat.service - tomcat 8
     Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2020-11-14 14:27:13 KST; 39s ago
    Process: 103228 ExecStart=/opt/apache-tomcat-8.5.59/bin/startup.sh (code=exited, status=0/SUCCESS)
   Main PID: 103256 (java)
      Tasks: 33 (limit: 18694)
     Memory: 119.5M
     CGroup: /system.slice/tomcat.service
             └─103256 /usr/bin/java -Djava.util.logging.config.file=/opt/apache-tomcat-8.5.59/conf/logging.properties -Djava.util.logging.manager=org.ap>

11월 14 14:27:13 Kubuntu systemd[1]: Starting tomcat 8...
11월 14 14:27:13 Kubuntu startup.sh[103228]: Tomcat started.
11월 14 14:27:13 Kubuntu systemd[1]: Started tomcat 8.

댓글을 달아 주세요

Apache 2.4 : phpMyAdmin 설치

Programming/Apache, PHP 2020. 11. 11. 02:19 Posted by 파란크리스마스

출처

1. 다운로드

phpMyAdmin에서 phpMyAdmin-5.0.4-all-languages.zip 파일 다운로드

2. 압축풀기

phpMyAdmin-5.0.4-all-languages.zip 압축파일을 C:\usr\local\phpMyAdmin-5.0.4-all-languages 폴더에 압축 해제

3. config.inc.php 파일 생성

C:\usr\local\phpMyAdmin-5.0.4-all-languages\config.sample.inc.php 파일을 config.inc.php로 복사

4. 환경파일 수정(config.inc.php)

/**
 * This is needed for cookie based authentication to encrypt password in
 * cookie. Needs to be 32 chars long.
 */
$cfg['blowfish_secret'] = 'gNsWq$%#%$#%EDFSsffsegbVp6LCJw6w'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/**
 * Servers configuration
 */
$i = 0;

/**
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
// $cfg['Servers'][$i]['user'] = 'root';

5. httpd.conf 가상폴더 추가

Tomcat 연동이 없는 경우

Alias /mysql "C:/usr/local/phpMyAdmin-5.0.4-all-languages"

<Directory "C:/usr/local/phpMyAdmin-5.0.4-all-languages">
    Options FollowSymLinks
    DirectoryIndex index.html index.htm index.php *.jsp *.php
    Order allow,deny
    Allow from all
</Directory>

Tomcat 연동의 경우

# Tomcat 연동
<IfModule jk_module>
    JkWorkersFile    conf/workers.properties
    JkLogFile        logs/mod_jk.log
    JkLogLevel       info
    JkMount /* 	load_balancer
</IfModule>

AddDefaultCharset Off 

# phpMyAdmin
<VirtualHost *:80>
    ServerAdmin admin@phpmyadmin.abc.kr
    DocumentRoot "C:/usr/local/phpMyAdmin-5.0.4-all-languages"
    ServerName localhost
#    ServerAlias /mysql
#    DirectoryIndex index.php
    Alias /mysql "C:/usr/local/phpMyAdmin-5.0.4-all-languages"

    <Directory "C:/usr/local/phpMyAdmin-5.0.4-all-languages">
        AllowOverride ALL
        Options FollowSymLinks MultiViews
        DirectoryIndex index.html index.htm index.php *.jsp *.php
        Require all granted
    </Directory>
    
</VirtualHost>

6. php.ini 수정

; When the extension library to load is not located in the default extension
; directory, You may specify an absolute path to the library file:
;
;   extension=/path/to/extension/mysqli.so
extension=php_mysqli.dll
;extension=mbstring
extension=php_mbstring.dll
;extension=pdo_mysql
extension=php_pdo_mysql.dll

댓글을 달아 주세요

출처

RSA 개인키를 생성

$ openssl genrsa -out private.key 2048
Generating RSA private key, 2048 bit long modulus
....................................+++++
..........+++++
e is 65537 (0x10001)

RSA 개인키를 이용해서 RSA 공개키를 생성

$ openssl rsa -in private.key -pubout -out public.key
writing RSA key

CSR(인증요청서) 생성

$ openssl req -new -key private.key -out private.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:KR
State or Province Name (full name) [Some-State]:_
Locality Name (eg, city) []:Seoul
Organization Name (eg, company) [Internet Widgits Pty Ltd]:bluexmas
Organizational Unit Name (eg, section) []:root CA
Common Name (e.g. server FQDN or YOUR name) []:test.iptime.org
Email Address []:test@test.com
 
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:test
An optional company name []:test

CRT(인증서)만들기

CA 역할을 할 CA 대칭키 생성

$ openssl genrsa -aes256 -out rootCA.key 2048
Generating RSA private key, 2048 bit long modulus
..................................................+++++
....................+++++
e is 65537 (0x10001)
Enter pass phrase for rootCA.key:test
Verifying - Enter pass phrase for rootCA.key:test

rootCA.key를 이용해서 rootCA.pem 생성

$ openssl req -x509 -new -nodes -key rootCA.key -days 2650 -out rootCA.pem
Enter pass phrase for rootCA.key:test
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:KR
State or Province Name (full name) [Some-State]:_
Locality Name (eg, city) []:Seoul
Organization Name (eg, company) [Internet Widgits Pty Ltd]:bluexmas
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:test
Email Address []:test

웹서버에 HTTPS적용을 위해 필요한 CRT 인증서를 생성

$ openssl x509 -req -in private.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out private.crt -days 3650
Signature ok
subject=/C=KR/ST=_/L=Seoul/O=bluexmas/OU=root CA/CN=lastxmas.iptime.org/emailAddress=test@test.com
Getting CA Private Key
Enter pass phrase for rootCA.key:test

C:\usr\local\Apache24\conf\httpd.conf

# Secure (SSL/TLS) connections
Include conf/httpd-ssl.conf

LoadModule rewrite_module modules/mod_rewrite.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule ssl_module modules/mod_ssl.so

C:\usr\local\Apache24\conf\httpd-ssl.conf

#
# When we also provide SSL we have to listen to the 
# standard HTTP port (see above) and to the HTTPS port
#
Listen 443

#   Pass Phrase Dialog:
#   Configure the pass phrase gathering process.
#   The filtering dialog program (`builtin' is an internal
#   terminal dialog) has to provide the pass phrase on stdout.
SSLPassPhraseDialog  builtin

#   Inter-Process Session Cache:
#   Configure the SSL Session Cache: First the mechanism 
#   to use and second the expiring timeout (in seconds).
#SSLSessionCache         "dbm:c:/Apache24/logs/ssl_scache"
SSLSessionCache        "shmcb:C:/usr/local/Apache24/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300

##
## SSL Virtual Host Context
##

<virtualhost _default_:443="">

#   General setup for the virtual host
# DocumentRoot "C:/usr/local/Apache24/htdocs"
DocumentRoot "C:/usr/local/Apache24/public_html"
ServerName www.example.com:443
ServerAdmin admin@example.com
ErrorLog "C:/usr/local/Apache24/logs/error.log"
TransferLog "C:/usr/local/Apache24/logs/access.log"

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on

#   Server Certificate:
#   Point SSLCertificateFile at a PEM encoded certificate.  If
#   the certificate is encrypted, then you will be prompted for a
#   pass phrase.  Note that a kill -HUP will prompt again.  Keep
#   in mind that if you have both an RSA and a DSA certificate you
#   can configure both in parallel (to also allow the use of DSA
#   ciphers, etc.)
#   Some ECC cipher suites (http://www.ietf.org/rfc/rfc4492.txt)
#   require an ECC certificate which can also be configured in
#   parallel.
SSLCertificateFile "C:/usr/local/Apache24/conf/private.crt"

#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you've both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)
#   ECC keys, when in use, can also be configured in parallel
SSLCertificateKeyFile "C:/usr/local/Apache24/conf/private.key"

댓글을 달아 주세요

Jenkins - Svn, Ant, Tomcat 원격 배포

Programming/Java 2020. 10. 29. 01:50 Posted by 파란크리스마스

출처

Subversion 플로그인 설치

Deploy to container 플로그인 설치

프로젝트 생성

[새로운 Item] 메뉴 선택

item name(프로젝트 이름) 설정, Freestyle project, [OK] 버튼 선택

Subversion 선택, URL 주소 설정, Svn 접속 계정 추가 

Svn 계정 설정, [Add] 버튼 선택

추가 Svn 주소가 있는 경우, [Add module] 버튼 선택

Subversion 선택, URL 주소 설정

Build에서 [Invoke Ant] 설정

Ant - Target과 빌드 파일 설정

빌드 후 조치(배포), [Deploy war/ear to a container] 선택

베포 웹서버 설정 

댓글을 달아 주세요

Tomcat 관리자 페이지 설정

Programming/Java 2020. 10. 29. 00:08 Posted by 파란크리스마스

출처

%TOMCAT_HOME%/conf/tomcat-users.xml

관리자 페이지는 manager-gui 권한의 활성화와 계정 정보가 설정되어야 사용이 가능하므로 %TOMCAT_HOME%/conf/tomcat-users.xml 파일을 열어서 아래와 같이 manager-gui 권한을 추가합니다.

<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
  <user username="role1" password="<must-be-changed>" roles="role1"/>
-->
	
	<!-- manager-gui 권한 추가 -->
	<role rolename="manager-gui"/>
	<role rolename="manager-script"/>
	<role rolename="manager-status"/>
	<user username="admin" password="admin" roles="manager-gui,manager-script,manager-status"/>
</tomcat-users>

관리자 페이지 접속

관리자 암호를 설정하고 [로그인] 버튼 선택

관리자 페이지

댓글을 달아 주세요

Jenkins 설치

Programming/Java 2020. 10. 13. 01:11 Posted by 파란크리스마스

출처

Jenkins war 다운로드

Jenkins 사이트의 war 파일 다운로드

Jenkins war 복사

%TOMCAT_HOME%/warapps 폴더에 jenkins.war 파일 복사

Jenkins 접속

웹브라우져에서 https://localhost:8080/jenkins 접속

Unlock Jenkins

아래 경로에 비밀번호가 적힌 파일(initialAdminPassword)에 적힌 비밀번호를 확인 후 비밀번호를 입력하고, [Continue] 버튼 선택

플로그인 설치

[Install suggested plugins] 선택하고 설치 - 나중에 플러그인을 추가, 삭제 가능

플러그인 설치 과정

사용자 추가

Jenkins URL 정의

Jenkins 실행

Jenkins 설치 관료후 메인 화면

댓글을 달아 주세요