기계적 인조 인간

우분투 18.04에 유령을 설치하는 방법

차례:

Anonim

Ghost는 Node.js 플랫폼 위에 구축 된 최신 소스 출판 플랫폼입니다. 완전히 커스터마이징이 가능하고 사용하기 쉬우므로 거의 제로 학습 곡선으로 콘텐츠를 게시 할 수 있습니다.

이 튜토리얼에서는 Nginx를 프록시로 사용하고 무료 Let 's Encrypt SSL 인증서, 최신 LTS 버전의 Node.js 및 MySQL / MariaDB를 데이터베이스 백엔드로 사용하여 Ubuntu 18.04 서버에 보안 Ghost 블로그를 배포하는 방법을 보여줍니다..

전제 조건

이 학습서를 따르는 전제 조건으로 다음이 필요합니다.

  • 공식 Ghost 시스템 요구 사항에 따라 최소 1G의 RAM이 필요합니다. RAM이 1GB 미만인 서버가있는 경우 스왑 파일을 만들 수 있습니다. 공용 서버 IP를 가리키는 도메인 이름입니다. 이 튜토리얼에서는 Ubuntu 18.04에 Nginx를 설치하는 방법에 따라 example.com .Nginx를 설치하고 Ubuntu 18.04에 UFW를 사용하여 방화벽을 설정하는 방법에 따라 방화벽을 구성합니다. 포트 80 443 이 열려 있는지 확인하십시오.

이 학습서를 계속하기 전에 sudo 권한이있는 사용자로 로그인했는지 확인하십시오.

Node.js 및 Yarn 설치

이 기사를 작성할 당시 Ghost에 권장되는 Node.js 버전은 v8 carbon LTS입니다. NodeSource 저장소에서 Node.js를 설치합니다.

다음 curl 명령을 사용하여 Node.js v8에 대한 NodeSource 저장소를 사용하십시오.

curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -

다음을 입력하여 Node.js를 설치하십시오.

sudo apt install nodejs 다른 설치 방법은 Ubuntu 18.04에서 Node.js를 설치하는 방법 안내서를 확인하십시오.

얀을 설치하려면 먼저 다음 명령을 사용하여 시스템에서 Yarn 저장소를 활성화하십시오.

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

저장소가 활성화되면 다음을 사용하여 원사를 설치하십시오.

sudo apt update sudo apt-get -o Dpkg::Options::="--force-overwrite" install yarn

MySQL 설치

Ghost는 MySQL, MariaDB 및 SQLite 데이터베이스를 지원합니다. 이 자습서에서는 프로덕션 모드에서 Ghost를 실행할 때 권장되는 데이터베이스 인 MySQL을 사용합니다.

다음 명령으로 MySQL 패키지를 설치하십시오.

sudo apt install mysql-server

mysql_secure_installation 명령을 실행하여 MySQL 설치의 보안을 향상 시키십시오.

sudo mysql_secure_installation

MySQL 사용자 비밀번호의 강도를 테스트하는 데 사용되는 VALIDATE PASSWORD PLUGIN 을 구성하라는 메시지가 표시됩니다. 암호 유효성 검사 정책에는 낮음, 중간 및 강력의 세 가지 수준이 있습니다. 비밀번호 확인 플러그인을 설정하지 않으려면 ENTER 누르 ENTER .

다음 프롬프트에서 MySQL 루트 사용자의 비밀번호를 설정하라는 메시지가 표시됩니다.

루트 암호를 설정하면 스크립트에서 익명 사용자를 제거하고 로컬 컴퓨터에 대한 루트 사용자 액세스를 제한하고 테스트 데이터베이스를 제거하라는 메시지도 표시됩니다. 모든 질문에 Y (예)로 대답해야합니다.

다음으로 인증 방법을 auth_socket 에서 auth_socket 로 변경하여 Ghost 설치 프로그램이 MySQL 서버에 액세스 할 수 있도록합니다. 그렇게하려면 루트 사용자로 MySQL 서버에 로그인하십시오:

sudo mysql

mysql_native_password 메소드를 사용할 때 MySQL 루트 사용자의 비밀번호를 설정하는 다음 쿼리를 실행하십시오.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'very_strong_pasword'; FLUSH PRIVILEGES;

강력한 비밀번호로 very_strong_pasword 를 변경하십시오.

Ghost-CLI 설치

공식 Ghost CLI 유틸리티를 사용하여 Ghost를 설치합니다. 이 유틸리티를 사용하면 단일 명령으로 Ghost를 설치하거나 업데이트 할 수 있습니다.

Ghost CLI는 npm 패키지로 제공됩니다. 다음 명령은 Ubuntu 시스템에 전역으로 Ghost CLI를 설치합니다.

sudo yarn global add ghost-cli

Ghost 설치 위치 작성

권장 설치 위치 인 /var/www/ghost 디렉토리에 Ghost를 다운로드하여 설치합니다.

디렉토리 유형을 작성하려면 다음을 수행하십시오.

sudo mkdir -p /var/www/ghost

디렉토리의 소유권을 사용자에게 변경하십시오.

sudo chown $USER:$USER /var/www/ghost

$USER 는 사용자 이름을 보유한 환경 변수입니다.

올바른 디렉토리 권한을 설정하십시오.

sudo chmod 775 /var/www/ghost

Ghost 설치

Ghost CLI가 설치되었고 모든 필수 구성 요소가 완료되었으므로 설치를 시작할 수 있습니다.

/var/www/ghost 디렉토리로 변경하십시오.

cd /var/www/ghost

설치를 시작하려면 Ghost를 설치 및 구성하고 Nginx를 리버스 프록시로 구성한 후 SSL 인증서를 무료로 암호화하여 사이트를 보호하는 ghost install 실행하십시오.

ghost install

✔ Checking system Node.js version ✔ Checking logged in user ✔ Checking current folder permissions System checks failed with message: 'Linux version is not Ubuntu 16' Some features of Ghost-CLI may not work without additional configuration. For local installs we recommend using `ghost install local` instead. ? Continue anyway? (y/N) y

설치 관리자가 시스템을 확인하고 위와 같이 경고를 인쇄합니다. 계속하려면 y 를 입력하면 설치 프로그램이 Ghost를 다운로드하여 설치합니다.

ℹ Checking operating system compatibility ✔ Checking for a MySQL installation ✔ Checking memory availability ✔ Checking for latest Ghost version ✔ Setting up install directory ✔ Downloading and installing Ghost v1.24.9 ✔ Finishing install process

다음으로 블로그 URL과 MySQL 정보를 설정하라는 메시지가 표시됩니다. Installing MySQL 섹션에서 설정 한 루트 사용자 이름과 비밀번호를 제공하고 기본 데이터베이스 이름 ghost_prod 사용하십시오.

? Enter your blog URL: https://example.com ? Enter your MySQL hostname: localhost ? Enter your MySQL username: root ? Enter your MySQL password: ? Enter your Ghost database name: ghost_prod

설치 프로그램은 ghost 라는 시스템 사용자를 작성하고 ghost MySQL 사용자를 작성할 것인지 묻습니다. Yes 입력하십시오.

✔ Configuring Ghost ✔ Setting up instance Running sudo command: chown -R ghost:ghost /var/www/ghost/content ✔ Setting up "ghost" system user ? Do you wish to set up "ghost" mysql user? Yes ✔ Setting up "ghost" mysql user

다음으로 설치 프로그램에서 Nginx를 설정할 것인지 묻습니다. Yes 를 입력하여 확인하십시오.

? Do you wish to set up Nginx? Yes ✔ Creating nginx config file at /var/www/ghost/system/files/example.com.conf Running sudo command: ln -sf /var/www/ghost/system/files/example.com.conf /etc/nginx/sites-available/example.com.conf Running sudo command: ln -sf /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/example.com.conf Running sudo command: nginx -s reload ✔ Setting up Nginx

Nginx가 설정되면 설치 프로그램이 SSL 설정 여부를 묻습니다. Yes 를 입력하여 확인하면 구성 마법사가 이메일 주소를 입력하라는 메시지를 표시 한 다음 도메인에 대한 무료 SSL 암호화 인증서를 생성하고 Nginx를 구성합니다.

? Do you wish to set up SSL? Yes ? Enter your email (used for Let's Encrypt notifications) [email protected] Running sudo command: mkdir -p /etc/letsencrypt Running sudo command:./acme.sh --install --home /etc/letsencrypt Running sudo command: /etc/letsencrypt/acme.sh --issue --home /etc/letsencrypt --domain example.com --webroot /var/www/ghost/system/nginx-root --reloadcmd "nginx -s reload" --accountemail [email protected] Running sudo command: openssl dhparam -out /etc/nginx/snippets/dhparam.pem 2048 Running sudo command: mv /tmp/ssl-params.conf /etc/nginx/snippets/ssl-params.conf ✔ Creating ssl config file at /var/www/ghost/system/files/example.com-ssl.conf Running sudo command: ln -sf /var/www/ghost/system/files/example.com-ssl.conf /etc/nginx/sites-available/example.com-ssl.conf Running sudo command: ln -sf /etc/nginx/sites-available/example.com-ssl.conf /etc/nginx/sites-enabled/example.com-ssl.conf Running sudo command: nginx -s reload ✔ Setting up SSL

다음으로 설치 관리자가 시스템 서비스를 설정할 것인지 묻습니다. 승인하려면 Y 를 입력하면 설치 프로그램이 ghost_example-com이라는 새로운 시스템 서비스를 작성하고 부팅시 시작할 수있게합니다.

? Do you wish to set up Systemd? Yes ✔ Creating systemd service file at /var/www/ghost/system/files/ghost_example-com.service Running sudo command: ln -sf /var/www/ghost/system/files/ghost_example-com.service /lib/systemd/system/ghost_example-com.service Running sudo command: systemctl daemon-reload ✔ Setting up Systemd

마지막으로 설치 프로그램이 데이터베이스를 설정하고 Ghost를 시작할 것인지 묻고 Yes 입력하십시오.

Running sudo command: /var/www/ghost/current/node_modules/.bin/knex-migrator-migrate --init --mgpath /var/www/ghost/current ✔ Running database migrations ? Do you want to start Ghost? Yes Running sudo command: systemctl is-active ghost_example-com ✔ Ensuring user is not logged in as ghost user ✔ Checking if logged in user is directory owner ✔ Checking current folder permissions Running sudo command: systemctl is-active ghost_example-com ✔ Validating config ✔ Checking folder permissions ✔ Checking file permissions ✔ Checking content folder ownership ✔ Checking memory availability Running sudo command: systemctl start ghost_example-com ✔ Starting Ghost Running sudo command: systemctl is-enabled ghost_example-com Running sudo command: systemctl enable ghost_example-com --quiet ✔ Starting Ghost You can access your publication at https://example.com Next, go to your admin interface at https://example.com/ghost/ to complete the setup of your publication Ghost uses direct mail by default To set up an alternative email method read our docs at

고스트 설정 완료

브라우저를 열고 https://example.com/ghost/ 의 Ghost 관리 인터페이스로 https://example.com/ghost/ 하면 다음 화면이 표시됩니다.

여기에서 새 게시물을 작성하고 사용자를 추가하며 Ghosts 구성을 변경할 수 있습니다.

결론

이 자습서에서는 프로덕션 준비된 Ghost 인스턴스를 설치하는 방법을 배웠습니다.

이제 Ghost 도움말 페이지를 방문하여 Ghost 설치를 관리하는 방법에 대해 자세히 알아보십시오. Ghost Marketplace를 방문하여 Ghost 테마를 발견 할 수도 있습니다.

유령 nodejs npm 우분투 블로그