웹사이트 검색

Ubuntu 22.04에 Neos CMS를 설치하는 방법


이 튜토리얼은 다음 OS 버전에 대해 존재합니다.

  • Ubuntu 22.04(Jammy Jellyfish)
  • Ubuntu 18.04(Bionic Beaver)

이 페이지에서

  1. 전제 조건
  2. 시작하기\n
  3. Apache, MariaDB 및 PHP 설치
  4. Neos CMS용 데이터베이스 생성
  5. Neos CMS 설치
  6. Neos CMS용 Apache 구성
  7. Neos CMS에 액세스
  8. Lets Encrypt로 Neos CMS 보안
  9. 결론

Neos CMS는 코딩 지식 없이도 웹사이트와 블로그를 관리할 수 있도록 도와주는 혁신적인 무료 오픈 소스 콘텐츠 관리 시스템입니다. 간단하고 안전하며 사용하기 쉽도록 설계되어 비즈니스 소유자가 여러 장치에서 사용자와 협업할 수 있습니다. 완전한 유니코드 지원, 완전한 국제화, SEO, 인라인 편집 등 매우 유용한 기능을 제공합니다. 프로젝트의 핵심 아이디어는 편집자가 콘텐츠의 구조를 유지하면서 가능한 한 원활하게 콘텐츠를 편집할 수 있도록 하는 것입니다.

이 튜토리얼에서는 Apache와 함께 Neos CMS를 설치하고 Ubuntu 22.04 서버에서 SSL을 암호화하는 방법을 보여줍니다.

전제 조건

  • Ubuntu 22.04를 실행하는 서버.\n
  • 유효한 도메인 이름은 서버 IP로 지정됩니다.\n
  • 루트 암호는 서버에서 구성됩니다.\n

시작하기

먼저 다음 명령을 실행하여 모든 시스템 패키지를 업데이트된 버전으로 업데이트합니다.

apt update -y
apt upgrade -y

완료되면 다음 단계로 진행할 수 있습니다.

Apache, MariaDB 및 PHP 설치

다음으로 Apache, MariaDB, PHP 및 기타 필수 패키지를 시스템에 설치해야 합니다. 다음 명령을 실행하여 모두 설치하십시오.

apt-get install apache2 mariadb-server php libapache2-mod-php php-common php-mysql php-gmp php-curl php-intl php-mbstring php-xmlrpc php-gd php-bcmath php-xml php-cli php-gmagick php-zip curl unzip git -y

모든 패키지를 설치한 후 php.ini 파일을 편집하고 몇 가지 사항을 변경합니다.

nano /etc/php/8.1/apache2/php.ini

다음 줄을 변경합니다.

short_open_tag = On
memory_limit = 256M
upload_max_filesize = 150M
max_execution_time = 360
date.timezone = UTC

파일을 저장하고 닫은 다음 Apache 서비스를 다시 시작하여 변경 사항을 적용합니다.

systemctl restart apache2

Neos CMS용 데이터베이스 생성

먼저 MariaDB 루트 암호를 설정하고 설치를 보호해야 합니다. 다음 명령을 사용하여 수행할 수 있습니다.

mysql_secure_installation

아래와 같이 모든 질문에 답하십시오.

Enter current password for root (enter for none):
Set root password? [Y/n]: N
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]:  Y
Reload privilege tables now? [Y/n]:  Y

완료되면 다음 명령을 사용하여 MariaDB에 로그인합니다.

mysql -u root -p

로그인한 후 다음 명령을 사용하여 Neos CMS용 데이터베이스 및 사용자를 생성합니다.

MariaDB [(none)]> CREATE DATABASE neosdb;
MariaDB [(none)]> CREATE USER 'neos'@'localhost' IDENTIFIED BY 'mypassword';

다음으로 다음 명령을 사용하여 Neos 데이터베이스에 대한 모든 권한을 부여합니다.

MariaDB [(none)]> GRANT ALL PRIVILEGES ON neosdb.* TO 'neos'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

다음으로 데이터베이스 문자 집합을 utf8mb4로 변경하고 권한을 플러시하고 다음 명령을 사용하여 MariaDB를 종료합니다.

MariaDB [(none)]> ALTER DATABASE neosdb charset=utf8mb4;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

다음으로 MariaDB 구성 파일을 편집하고 몇 가지 사항을 변경합니다.

nano /etc/mysql/mariadb.conf.d/50-server.cnf

다음 줄을 추가합니다.

innodb_file_format = Barracuda
innodb_large_prefix = 1
innodb_file_per_table = 1
innodb_default_row_format = dynamic

파일을 저장하고 닫은 다음 MariaDB 서비스를 다시 시작하여 변경 사항을 적용합니다.

systemctl restart mariadb

완료되면 다음 단계로 진행할 수 있습니다.

네오스 CMS 설치

시작하기 전에 Composer를 시스템에 설치해야 합니다. Composer는 PHP 종속성을 설치하는 데 사용되는 종속성 관리자입니다.

다음 명령을 실행하여 Composer를 설치합니다.

curl -sS https://getcomposer.org/installer | php

다음과 같은 결과가 표시되어야 합니다.

All settings correct for using Composer
Downloading...

Composer (version 2.4.1) successfully installed to: /root/composer.phar
Use it: php composer.phar

그런 다음 Composer 파일을 시스템 위치로 이동합니다.

mv composer.phar /usr/local/bin/composer

다음으로 디렉터리를 Apache 웹 루트로 변경하고 다음 명령을 사용하여 Neos CMS를 다운로드합니다.

cd /var/www/html/
git clone https://github.com/neos/neos-base-distribution.git

다음으로 다운로드한 디렉토리의 이름을 바꾸고 작곡가 명령을 실행하여 모든 PHP 종속성을 설치합니다.

mv neos-base-distribution neoscms
cd neoscms
composer install

다음으로 Neos 디렉토리에 적절한 권한과 소유권을 설정합니다.

chown -R www-data:www-data /var/www/html/neoscms/
chmod -R 755 /var/www/html/neoscms/

완료되면 다음 단계로 진행할 수 있습니다.

Neos CMS용 Apache 구성

다음으로, Neos CMS를 호스팅하기 위해 Apache 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령으로 만들 수 있습니다.

nano /etc/apache2/sites-available/neoscms.conf

다음 줄을 추가합니다.

<VirtualHost *:80>
     ServerAdmin 
     DocumentRoot /var/www/html/neoscms/Web
     ServerName neos.example.com
     <Directory /var/www/html/neoscms/Web/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/neos_error.log
     CustomLog ${APACHE_LOG_DIR}/neos_access.log combined
    
     <Directory /var/www/html/neoscms/Web/>
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*) index.php [PT,L]
    </Directory>
</VirtualHost>

파일을 저장하고 닫은 다음 가상 호스트를 활성화하고 다음 명령을 사용하여 Apache 재작성 모듈을 활성화합니다.

a2ensite neoscms.conf
a2enmod rewrite

다음으로 Apache 서비스를 다시 시작하여 변경 사항을 적용합니다.

systemctl restart apache2

다음 명령을 사용하여 Apache 서비스의 상태를 확인할 수도 있습니다.

systemctl status apache2

다음과 같은 결과가 표시되어야 합니다.

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-09-04 08:07:38 UTC; 8s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 22571 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 22577 (apache2)
      Tasks: 6 (limit: 4579)
     Memory: 14.7M
        CPU: 128ms
     CGroup: /system.slice/apache2.service
             ??22577 /usr/sbin/apache2 -k start
             ??22578 /usr/sbin/apache2 -k start
             ??22579 /usr/sbin/apache2 -k start
             ??22580 /usr/sbin/apache2 -k start
             ??22581 /usr/sbin/apache2 -k start
             ??22582 /usr/sbin/apache2 -k start

Sep 04 08:07:38 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

이 시점에서 Apache 웹 서버는 Neos CMS를 제공하도록 구성됩니다. 이제 다음 단계를 진행할 수 있습니다.

네오스 CMS에 접속

이제 웹 브라우저를 열고 URL http://neos.example.com을 사용하여 Neos CMS에 액세스하십시오. 다음 페이지로 리디렉션됩니다.

설정으로 이동을 클릭합니다. 다음 페이지가 표시됩니다.

SetupPassword.txt 파일에서 설정 암호를 제공하고 로그인 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

필요한 모든 PHP 확장이 설치되었는지 확인한 후 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

데이터베이스 이름, 데이터베이스 사용자 이름, 데이터베이스 호스트, 암호를 제공하고 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

이름, 관리자 사용자 이름, 비밀번호를 제공하고 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

백엔드로 이동을 클릭합니다. Neos CMS 로그인 페이지가 표시되어야 합니다.

관리자 사용자 이름, 암호를 제공하고 로그인 버튼을 클릭합니다. 다음 페이지에 Neos CMS 대시보드가 표시되어야 합니다.

Lets Encrypt로 Neos CMS 보호

Lets Encrypt Free SSL로 웹사이트를 보호하는 것이 좋습니다. 먼저 Certbot 클라이언트를 설치하여 SSL을 설치하고 관리합니다. 다음 명령으로 설치할 수 있습니다.

apt-get install python3-certbot-apache -y

설치가 완료되면 다음 명령을 실행하여 Lets Encrypt SSL로 웹 사이트를 보호하십시오.

certbot --apache -d neos.example.com

아래와 같이 이메일을 제공하고 서비스 약관에 동의하라는 메시지가 표시됩니다.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for neos.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/neos-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/neos-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/neos-le-ssl.conf

다음으로 아래와 같이 HTTP 트래픽을 HTTPS로 리디렉션할지 여부를 선택합니다.

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

2를 입력하고 Enter 키를 눌러 웹사이트에 Lets Encrypt SSL을 설치합니다.

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/neos.conf to ssl vhost in /etc/apache2/sites-available/neos-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://neos.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=neos.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/neos.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/neos.example.com/privkey.pem
   Your cert will expire on 2022-12-07. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

결론

축하합니다! Apache와 함께 Neos CMS를 성공적으로 설치했으며 Ubuntu 22.04 서버에 Lets Encrypt SSL을 사용했습니다. 이제 웹 브라우저를 통해 웹 사이트를 쉽게 만들고 편집할 수 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.