Category Archives: 개발참고자료

에버노트 Evernote 한번에 모든 노트 Enex 추출하기

최근에 애증의 에버노트로부터 메일이 왔다. 구독 서비스의 요금을 올린다고 한다. 매 업데이트때마다 문제가 늘어나는것을 참아가며 쓰고 있었는데 계기를 제공하는것인가. 에버노트의 대안을 찾기로 하였다.

어떤 노트 어플리케이션으로 이동하냐를 떠나서 보니깐 대부분의 마이그레이션 툴들이 막혀있고 노션의 경우에는 마이그레이션 기능을 제공하지만 매우 오래걸린다. 결국 에버노트에서 제공하는 Enex라는 형태의 내보내기된 파일이 필요한데 윈도우에서는 50개, 맥에서는 100개 제한이 걸려있다.

이미 몇천개의 글이 에버노트에 있는 나로써는 난감한 상황. 그런데 찾아보니 엄청 편리한 툴을 발견하였다.

https://github.com/vzhd1701/evernote-backup

이곳에서 자신의 OS에 맞는 버전을 다운로드 하자. 물론 맥에서는 brew로 설치해도 된다. 다음의 과정을 통해서 모든 노트를 Enex로 추출할 수 있다.

$ evernote-backup init-db
Username or Email: user@example.com
Password:
Logging in to Evernote...
Enter one-time code: 120917
Authorizing auth token, evernote backend...
Successfully authenticated as user!
Current login will expire at 2022-03-10 10:22:00.
Initializing database en_backup.db...
Reading database en_backup.db...
Successfully initialized database for user!

$ evernote-backup sync
Reading database en_backup.db...
Authorizing auth token, evernote backend...
Successfully authenticated as user!
Current login will expire at 2022-03-10 10:22:00.
Syncing latest changes...
  [####################################]  6763/6763
566 notes to download...
  [####################################]  566/566
Updated or added notebooks: 23
Updated or added notes: 566
Expunged notebooks: 0
Expunged notes: 0
Synchronization completed!

$ evernote-backup export output_dir/
Reading database en_backup.db...
Exporting notes...
  [####################################]  23/23
All notes have been exported!

export 명령을 실행할 때 지정한 디렉토리에 가보면 내가 설정해둔 노트북(카테고리) 그대로 파일이 이쁘게 추출되어있는것을 확인할 수 있다. 이렇게 나이스 할수가!

macOS Mojave 에서 SSL 지원하는 Apache 웹서버 설치하기

이번에 새롭게 출시된 macOS 모하비에서 Apache를 설치하는 방법을 정리 해 보겠습니다. 또한 추가로 HTTPS 프로토콜을 지원하는 설정도 함께 적어보도록 하겠습니다. 이글은 macOS에서 Homebrew를 사용중인것을 가정하고 작성되었습니다.

과거 시에라등의 버전에서는 Apache 웹서버가 기본적으로 설치가 되어있습니다. 계속해서 업데이트를 해왔다면 해당 아파치 웹서버가 그대로 살아있을수 있으니 다음과 같은 방법으로 제거를 해줍시다.

$ ps aux | grep httpd
_www               232   0.0  0.0  4329504    936   ??  S    12:12AM   0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
_www               231   0.0  0.0  4321312    908   ??  S    12:12AM   0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
_www               230   0.0  0.0  4329504    888   ??  S    12:12AM   0:00.03 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
_www               229   0.0  0.0  4321312    932   ??  S    12:12AM   0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND
_www               228   0.0  0.0  4329504    924   ??  S    12:12AM   0:00.00 /usr/local/opt/httpd/bin/httpd -D FOREGROUND

위와 같이 돌아가고 있는 httpd 프로세스가 있는것을 확인하였다면 다음의 명령을 사용하여 종료하고 기본 구동 서비스에서도 삭제 해 줍니다.

$ sudo apachectl stop
$ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

위와 같은 명령을 사용하고 기본적으로 설치되어있는 아파치 웹서버를 더이상 실행되지 않도록 변경할 수 있습니다. 이번에는 새로운 아파치 2.4 버전을 Homebrew를 사용하여 설치한 뒤 서비스로 구동하는 방법을 알아보겠습니다.

$ brew install httpd24 --with-privileged-ports --with-http2

위와 같은 명령을 사용하여 매우 간단하게 아파치 웹서버 2.4 버전을 설치할 수 있었습니다. –with-privileged-ports 옵션을 1024 이하의 낮은 숫자의 시스템 포트를 사용하기 위해서 사용하는 옵션입니다. 이 옵션을 사용하여 80 포트를 사용할 수 있게 되며 8080과 같은 포트를 사용하려면 굳이 이 옵션을 사용하실 필요가 없습니다.

이제 아파치의 설정 파일을 수정하여 80 포트로 구동되도록 수정하겠습니다.

$ vi /usr/local/etc/httpd/httpd.conf

다음의 내용을 찾아서

Listen 8080

다음과 같이 수정합니다.

Listen 80

이제 다음의 명령을 사용하여 웹서버를 구동할 수 있습니다.

$ sudo brew services start httpd24

위에서 설명했던것과 같이 1024 이하의 시스템 포트를 사용하려면 sudo를 사용하여 root 권한으로 구동해야 합니다. 이후의 포트를 사용하려면 굳이 sudo를 사용하지 않아도 사용이 가능합니다.

정상적으로 설치가 되었고 구동이 되었다면 웹브라우저를 통해서 localhost에 접속해 보면 “It works!”라는 문자열 출력을 확인하실 수 있습니다.

이번에는 SSL 설정을 해보도록 하겠습니다. 다시한번 아파치 웹서버 설정 파일을 수정 해 보겠습니다.

$ vi /usr/local/etc/httpd/httpd.conf

다음의 4가지 항목을 찾아서 모두 주석을 해제 해 줍니다.

#LoadModule socache_shmcb_module lib/httpd/modules/mod_socache_shmcb.so
#LoadModule ssl_module lib/httpd/modules/mod_ssl.so
#Include /usr/local/etc/httpd/extra/httpd-vhosts.conf
#Include /usr/local/etc/httpd/extra/httpd-ssl.conf

또한 ServerName 항목을 찾아서 주석을 해제하고 다음과 같이 내용을 수정 해 줍니다.

ServerName localhost:80

httpd.conf 파일의 수정은 완료되었고 이번에는 httpd-ssl.conf 파일을 수정 해 보겠습니다.

$ vi /usr/local/etc/httpd/extra/httpd-ssl.conf

다음의 내용을 찾아서

Listen 8443

다음과 같이 수정 해 줍니다.

Listen 443

추가로 좀 더 밑으로 가서 다음의 내용을 찾아서

<VirtualHost _default_:8443>

# General setup for the virtual host
DocumentRoot "/usr/local/var/www"
ServerName www.example.com:8443
ServerAdmin you@example.com

다음과 같이 수정 해 줍니다.

<VirtualHost _default_:443>

# General setup for the virtual host
#DocumentRoot "/usr/local/var/www"
#ServerName www.example.com:443
#ServerAdmin you@example.com

이번에는 httpd-vhosts.conf 파일을 수정하여 가상호스트 설정을 해 보겠습니다.

$ vi /usr/local/etc/httpd/extra/httpd-vhosts.conf

이미 몇개의 가상호스트 설정이 있습니다만, 모두 주석 처리 해 주고 다음의 두가지 설정을 추가 해 줍니다.

<VirtualHost *:80>
    DocumentRoot /usr/local/var/www
    ServerName localhost
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /usr/local/var/www
    ServerName localhost
    SSLEngine on
    SSLCertificateFile "/usr/local/etc/httpd/server.crt"
    SSLCertificateKeyFile "/usr/local/etc/httpd/server.key"
</VirtualHost>

여기서 눈여겨 봐야 하는 부분은 DocumentRoot 설정을 통해서 /usr/local/var/www를 웹서버의 기본 리소스 디렉토리로 설정했다는것과 443포트 연결에 대해서 SSLEngine이 on되었고 추가로 SSLCertificateFile와 SSLCertificateKeyFile 세팅이 되었다는 점 입니다.

DocumentRoot의 설정은 본인의 개발 환경에 맞게 설정 해 주시면 됩니다.

이번에는 로컬에서만 사용될 Self-Signed 인증서를 만들어보도록 하겠습니다. 여기서 만들 인증서 파일을 사용하겠다는 설정은 이미 위에서 해두었습니다. 다음의 명령어를 사용하여 인증서를 만드시면 됩니다.

$ cd /usr/local/etc/httpd
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt
Generating a 2048 bit RSA private key
.............+++
.......................................................................................+++
writing new private key to 'server.key'
-----
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) []:KR
State or Province Name (full name) []:Gyeonggi-do
Locality Name (eg, city) []:Seongnam-si
Organization Name (eg, company) []:MyCompany
Organizational Unit Name (eg, section) []:
Common Name (eg, fully qualified host name) []:
Email Address []:

이제 다 된것 같습니다. 다음의 명령을 사용하여 설정이 정상적으로 되었는지 확인이 가능합니다.

$ sudo apachectl configtest
Syntax OK

이제 웹브라우저를 재시행하여 http://localhost https://localhost 둘 모두 접속이 잘 되는것을 확인 해 봅시다.

$ sudo brew services restart httpd24