오늘의 삽질을 까먹지 않기 위해.

 

출처:  https://www.lesstif.com/php-and-laravel/windows-rhel-centos-xdebug-phpstorm-20775640.html

 

Windows RHEL/CentOS 리눅스에 xdebug 설치 및 PHPStorm 연동

remote_port 의 기본 값은 9000 이지만 php-fpm 기본 포트와 충돌하므로 다른 값으로 변경한다.

www.lesstif.com

https://xdebug.org/wizard

 

Xdebug: Support — Tailored Installation Instructions

Installation Wizard This page helps you finding which file to download, and how to configure PHP to get Xdebug running. Please paste the full output of phpinfo() (either a copy & paste of the HTML version, the HTML source or php -i output) and submit the f

xdebug.org

 

에서 현재 php에 맞는 xdebug버전을 알려줌.

 

php -i 로 해서 나오는것을 전부 복붙해서 확인. 

나 같은 경우는 xdebug 3.1.5!

 

xdebug 3.1.5를 다운받아 설치. 위 페이지에서 설치과정도 다 알려줌..

 

vi /etc/php.d/99-xdebug.ini

> zend_extension = xdebug

 

vi /etc/php.ini 하단에

> xdebug.start_with_request=yes
> xdebug.mode=debug
> xdebug.client_host=127.0.0.1

 

이후 nginx, php-fpm 재시작

 

php -i 나 phpinfo()로 설치된것 확인.

 

 

phpstorm 설정에 들어가서 

PHP탭에서 php 버전, 인터프리터 설정함.

디버그 탭에서 포트(9003) 설정

 

https://www.jetbrains.com/help/phpstorm/2022.1/remote-debugging-via-ssh-tunnel.html#prepare-the-debugging-engine

 

Remote debugging via SSH tunnel | PhpStorm

 

www.jetbrains.com

xdebug 2.x와 3.x 에서 많은게 바껴서 여길보고 참고하였다.

 

phpstorm 터미널을 열고

> ssh -R 9003:localhost:9003 username@hostname -p <port>

 

이후 위의 디버그 연결 리스닝을 누르고, 

postman으로 호출시 잡히는것을 확인.

 

 

빠진게 있을까..

https://zetawiki.com/wiki/CentOS_JDK_%EC%84%A4%EC%B9%98

 

CentOS JDK 설치 - 제타위키

다음 문자열 포함...

zetawiki.com

jdk 설치 참고

 

[jdk 설치]

> yum list java*jdk-devel

> yum install java-1.8.0-openjdk-devel.x86_64

 

[jdk 설치 확인]

> javac -version

 

 

http://blog.naver.com/PostView.nhn?blogId=dawning160723&logNo=220977208322&categoryNo=60&parentCategoryNo=0&viewDate=¤tPage=1&postListTopCurrentPage=1&from=postView

 

CentOS 6 tomcat 설치, 설정

CentOS 6 tomcat 설치, 설정 § Apache Tomcat 9.0.0.M19 버전 설치 환경 : centos 6. jdk-8u121 http...

blog.naver.com

tomcat 설치 참고

 

[tomcat 다운로드]

> cd /usr/local

> wget apache.mirror.cdnetworks.com/tomcat/tomcat-9/v9.0.35/bin/apache-tomcat-9.0.35.tar.gz

> tar -vxzf apache-tomcat-9.0.35.tar.gz

> ln -s apache-tomcat-9.0.35/ /usr/local/apache-tomcat

 

[방화벽 설정]

> vi /etc/sysconfig/iptable

 

추가, - A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

 

> service iptables restart

 

[웹브라우저 확인]

http://localhost:8080

1. Dockerfile 작성

# vi Dockerfile

 


FROM rabbitmq

ENV RABBITMQ_DEFAULT_USER admin
ENV RABBITMQ_DEFAULT_PASS admin

RUN rabbitmq-plugins enable --offline rabbitmq_management
RUN rabbitmq-plugins enable --offline rabbitmq_mqtt

EXPOSE 15672
EXPOSE 5672
EXPOSE 1883


 

 

2. 빌드

# docker build -t rmq-mqtt .

 

3. 실행

# docker run -it \
> -p 15672:15672 -p 5672:5672 -p 1883:1883 \
> rmq-mqtt

이왕 도커로 세팅하는데 golang 환경도 도커로 할수있지 않을까 싶어서 찾아보았다.

 

1. golang 이미지 다운로드

# docker search golang

# docker pull golang:latest

 

2. 빌드하기

: 테스트로 "hello, world!" 를 출력하는 코드를 샘플로 작성하였다.

# docker run --rm -v "$PWD":/usr/src/goTest -w /usr/src/goTest golang:latest go build -v

: --rm은 명령어가 끝나면 컨테이너를 삭제한다.

: -v [HOST경로]:[컨테이너경로]. $PWD는 현재 경로를 뜻하며, golang컨테이너 내의 /usr/src/goTest 와 공유한다.

: -w 빌드할 작업디렉토리

: goTest 라는 이름의 실행파일 생성

 

# ./goTest

 

-v 옵션으로 pkg받은 경로까지 상위 디렉토리를 공유하며, 빌드할 디렉토리만 -w로 설정하면 될듯한데.. 옵션이 너무 길다. docker-compose를 사용하거나 Dockerfile을 작성하여 각종 옵션까지 포함된 이미지를 만들면 되지 않을까..

1. VM 백그라운드 실행

: 백그라운드 실행되는지 확인용이기때문에 굳이 하지 않고 2번으로 바로 넘어가도 된다.

: 윈도우 cmd에서 VBoxManage.exe 있는 경로로 이동.

# VBoxManage.exe list vms

# VBoxManage.exe startvm "centos 7.6.1810 minimal" --type headless

 

2. 배치 파일 작성

: 1번을 이용하여 배치파일로 만든다.

: 메모장에서 ~~.bat 파일로 저장

3. 윈도우 시작 프로그램에 추가

 

'Develop' 카테고리의 다른 글

Docker Rabbitmq mqtt 플러그인 사용  (0) 2019.05.24
4. docker로 golang 빌드하기  (0) 2019.05.22
2. centos7 도커 설치,실행  (0) 2019.05.17
1. VirtualBox centos7 설치  (0) 2019.05.16
Node.js 설치  (0) 2016.03.07

1. docker ce 설치

# yum -y update

 

# yum install -y yum-utils device-mapper-persistent-data lvm2

# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 

# yum install docker-ce

 

2. docker 실행

: 데몬 실행

# systemctl start docker

 

: 부팅시 자동 실행

# systemctl enable docker.service

 

: 자동 시작 확인

# systemctl is-enabled docker.service

 

3. centos 설치

# docker search centos

: 가장 위에 official인 공식 이미지를 받는다.(latest를 설정하면 최신 버전)

# docker pull centos:latest

 

4. centos 이미지 실행

# docker run -i -t --name centos_1 centos /bin/bash

: centos 이미지를 컨테이너로 생성한 뒤, /bin/bash를 실행.

: -i(interactive), -t(pseudo-tty), --name centos_1(컨테이너 이름), centos(이미지)

: 종료후, 컨테이너 확인

: 종료된, 컨테이너 시작

: 실행된 컨테이너 접속

 

'Develop' 카테고리의 다른 글

4. docker로 golang 빌드하기  (0) 2019.05.22
3. 윈도우 부팅시, 백그라운드 vm 자동실행  (0) 2019.05.17
1. VirtualBox centos7 설치  (0) 2019.05.16
Node.js 설치  (0) 2016.03.07
Node.js 배경  (0) 2016.03.07

1. centos 다운로드

https://www.centos.org/download/

 

Download CentOS

Download CentOS As you download and use CentOS Linux, the CentOS Project invites you to be a part of the community as a contributor. There are many ways to contribute to the project, from documentation, QA, and testing to coding changes for SIGs, providing

www.centos.org

minimal로 download (7.6.1810)

 

2. vm으로 centos 설치.

이미지 마운트 하여 실행.

 

설치완료.

 

3. 네트워크 설정

포트포워딩 설정

 

# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 실행 후,

ONBOOT=yes 수정, 저장한뒤 

# systemctl restart network 실행

 

4. 푸티 접속확인되면 완료.

'Develop' 카테고리의 다른 글

3. 윈도우 부팅시, 백그라운드 vm 자동실행  (0) 2019.05.17
2. centos7 도커 설치,실행  (0) 2019.05.17
Node.js 설치  (0) 2016.03.07
Node.js 배경  (0) 2016.03.07
NGINX 설정  (0) 2016.03.07

다운로드: https://nodejs.org/en/download/

이곳에서 자신의 OS에 맞는 것을 다운로드.


CentOS 7 64bit 에서 설치.

다운로드

> wget https://nodejs.org/dist/v4.3.2/node-v4.3.2.tar.gz

* OS가 다를 경우, https://nodejs.org/en/download/ 이곳에서 자신에게 맞는 것을 다운 받는다.


압축 풀기

tar -xvf node-v4.3.2.tar.gz


해당 폴더로 이동하여, configure 파일 실행

(cxx compiler/openssl이 없을 경우, 설치)

> cd node-v4.3.2

> yum install gcc gcc-c++

> ./configure


make 명령어로 설치

> make

> make install


Node.js 실행

> node


> console.log("hello world!") 라고 쳤을때,

hello world!

undefined

라 출력되면 정상적으로 설치된 것이다.

'Develop' 카테고리의 다른 글

2. centos7 도커 설치,실행  (0) 2019.05.17
1. VirtualBox centos7 설치  (0) 2019.05.16
Node.js 배경  (0) 2016.03.07
NGINX 설정  (0) 2016.03.07
NGINX 설치  (0) 2016.03.07

[개요]

Node.js는 2009년 라이언 달(Ryan Dahl)이 개발한 서버 개발 환경. 

구글 크롬 브라우저에서 사용하는 V8 자바스크립트 엔진 기반.


[특징]

- 이벤트 기반 비동기 방식.

: 기존 웹 서버는 대부분 스레드 기반 동기 방식으로 네트워크 입출력을 처리한다. 이는 서버로 요청이 올때마다 동기적으로 처리하는 대신 요청마다 스레드를 생성하여 처리하여야 한다. 요청이 많아질수록 스레드는 많이 생성되고, 이것은 메모리 사용량을 폭발적으로 증가시키는 단점이 될 수 있다. 

하지만 Node.js의 경우 이벤트 기반 비동기 방식을 사용하며, 이는 한 개의 스레드를 사용하여 입출력을 처리한다는 것을 의미한다. 요청을 비동기적으로 처리하기 위해 이벤트가 발생하며 메시지 형태로 내부에 던져지게 된다. 내부적인 처리가 완료되면 다시 이벤트가 발생하여 클라이언트로 응답을 한다. 요청이 많아져도 입출력 스레드는 한개만 존재하므로 메모리 사용량과 같은 시스템 리소스 사용량은 크게 증가하지 않는다. 하지만 이 한 개의 스레드에 문제가 생긴다면 전체 프로그램에 문제가 발생할 가능성도 있다.


- 자바스크립트 사용.

- 구글이 만드는 자바스크립트 엔진을 사용(V8).

- C++를 사용하여 기능 확장 가능.

: V8 자바스크립트 엔진이 C++로 개발.

'Develop' 카테고리의 다른 글

1. VirtualBox centos7 설치  (0) 2019.05.16
Node.js 설치  (0) 2016.03.07
NGINX 설정  (0) 2016.03.07
NGINX 설치  (0) 2016.03.07
phpstorm에서 php unit 사용  (0) 2014.12.31

* nginx 설정

/etc/nginx/nginx.conf 가 nginx의 메인 설정 파일이다.

내용을 보면, 

- include /etc/nginx/conf.d/*.conf

이런 내용이 있다. 이것은 /etc/nginx/conf.d/ 의 모든 설정파일(.conf)을 불러온다는 것이다.

/etc/nginx/conf.d/ 밑에 새로운 설정파일을 생성하면 이것마저도 불러온다는 뜻이다.


/etc/nginx/conf.d 이동하면, 기본적으로 default.conf, example_ssl.conf 두개의 파일이 있다.

default.conf: 가장 메인이 되는 설정파일. 서버ip로 들어갔을때 나오는 페이지의 설정파일이다.

example_ssl.conf: ssl 적용시 어떻게 설정하는지 보여주는 단순한 예제파일. 하지만 모두 주석처리가 되어있다.


default.conf를 보며 새로운 /etc/nginx/conf.d 디렉토리 밑에 .conf파일을 생성하고,

/etc/nginx/nginx.conf 의 include /etc/nginx/conf.d/*.conf 이부분 주석처리 후, 새로 생성한 파일을 include하였다.


* /etc/nginx/conf.d/default.conf

- 이 파일은 가장 기본이 되는 설정파일이다. include /etc/nginx/conf.d/*.conf를 수정하기 싫다면, 새로 생성하는 파일이 default.conf보다 우선순위가 높도록 하면된다. 다행히 알파벳 순으로 설정파일들이 불려지기때문에, d보다 앞의 알파벳으로 설정파일을 생성하면 새로 생성한 설정파일이 가장 기본이 될 것이다.


* 서비스 재시작

nginx 설정을 마쳤으면, 서비스를 새로 시작하여 설정을 반영하여야 한다.

service nginx restart

systemctl restart nginx    (centos 7 이상일 경우.)


* 서비스 재로드

추후 nginx 설정을 바꾸게 될 경우에도 서비스 재시작을 하여야 한다.

하지만 이 경우, 서비스가 끊겨야 되므로 재로드를 권장한다.

systemctl reload nginx


출처) https://www.conory.com/note_linux/42847

'Develop' 카테고리의 다른 글

Node.js 설치  (0) 2016.03.07
Node.js 배경  (0) 2016.03.07
NGINX 설치  (0) 2016.03.07
phpstorm에서 php unit 사용  (0) 2014.12.31
헝가리안 표기법(Hungarian Notation)  (0) 2014.06.27

+ Recent posts