ウェブサイト検索

Ubuntu 22.04にTYPO3 CMSをインストールする方法


Ubuntu 22.04にTYPO3 CMSをインストールする方法

このチュートリアルはこれらのOSバージョンのために存在します

  • Ubuntu 24.04 (ノーブル・ナンバット)
  • Ubuntu 22.04 (ジャミー・ジェリーフィッシュ)
  • Ubuntu 20.04 (フォーカルフォッサ)
  • Ubuntu 14.04 LTS (トラスティ・ター)

このページで

  1. 前提条件
  2. 始めに
  3. Apache、PHP、およびMariaDBサーバーをインストールする
  4. TYPO3のデータベースを作成する
  5. TYPO3 CMSをインストールする
  6. TYPO3のためのApacheバーチャルホストを作成する
  7. TYPO3 CMSにアクセスする
  8. Let's EncryptでTYPO3を安全にする
  9. 結論

TYPO3は、無料のオープンソースであり、エンタープライズクラスのコンテンツ管理システムです。PHPで書かれており、オープンソースのコードと信頼性、スケーラビリティを組み合わせています。クロスプラットフォーム対応で、Windows、Linux、macOSなどの主要なオペレーティングシステムにインストールできます。初心者向けに設計されているため、コードを書かずに簡単にカスタマイズや拡張ができます。シンプルでレスポンシブ、モバイル対応で、ウェブサイトを迅速に立ち上げるための素晴らしい選択肢です。

このチュートリアルでは、Ubuntu 22.04にLet's Encrypt SSLを使用してTYPO3 CMSをインストールする方法を示します。

前提条件

  • Ubuntu 22.04を実行しているサーバー。
  • 有効なドメイン名はあなたのサーバーIPにリンクされています。
  • サーバーにはルートパスワードが設定されています。

始めに

まず、システムパッケージを最新バージョンに更新することをお勧めします。次のコマンドを実行することで、すべてのパッケージを更新できます:

apt update -y
apt upgrade -y

すべてのパッケージが最新の状態になったら、次のステップに進むことができます。

Apache、PHP、およびMariaDBサーバーをインストールする

次に、Apacheウェブサーバー、MariaDB、PHP、およびその他のPHP拡張機能をサーバーにインストールする必要があります。以下のコマンドを使用してすべてをインストールできます:

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

すべてのパッケージをインストールした後、php.iniファイルを編集していくつかの推奨設定を変更します:

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

次の行を変更してください:

memory_limit = 256M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 360
max_input_vars = 1500
date.timezone = UTC

ファイルを保存して閉じたら、変更を適用するためにApacheサービスを再起動します。

systemctl restart apache2

TYPO3のデータベースを作成する

次に、TYPO3用のデータベースとユーザーを作成する必要があります。まず、以下のコマンドを使用してMariaDBシェルにログインしてください:

mysql

ログインしたら、次のコマンドでデータベースとユーザーを作成します:

MariaDB [(none)]> CREATE DATABASE typo3db;

次に、次のコマンドを使用して typo3db にすべての権限を付与します:

MariaDB [(none)]> GRANT ALL ON typo3db.* TO 'typo3user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

次に、以下のコマンドで特権をフラッシュし、MariaDBから退出します:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

この時点で、あなたのMariaDBデータベースは設定されています。次のステップに進むことができます。

TYPO3 CMSをインストールする

まず、TYPO3の公式ウェブサイトを訪れて、curlコマンドを使ってTYPO3の最新バージョンをダウンロードしてください:

curl -L -o typo3_src.tgz https://get.typo3.org/11

ダウンロードが完了したら、以下のコマンドでダウンロードしたファイルを展開します:

tar -xvzf typo3_src.tgz

次に、抽出したディレクトリをApacheのWebルートディレクトリに移動します。

mv typo3_src-11.5.15 /var/www/html/typo3

次に、以下のコマンドで適切な権限と許可を与えてください:

chown -R www-data:www-data /var/www/html/typo3
chmod -R 775 /var/www/html/typo3

完了したら、次のステップに進むことができます。

TYPO3のためのApacheバーチャルホストを作成する

次に、TYPO3 CMSをホストするためのApache仮想ホスト設定ファイルを作成します。以下のコマンドを使用して作成できます:

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

次の行を追加してください:

<VirtualHost *:80>
     ServerAdmin [email 
     DocumentRoot /var/www/html/typo3
     ServerName typo3.example.com
     <Directory /var/www/html/typo3>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

ファイルを保存して閉じ、その後、次のコマンドで仮想ホスト設定ファイルとリライトモジュールを有効にします:

a2ensite typo3.conf
a2enmod rewrite

次に、変更を適用するためにApacheサービスを再起動します:

systemctl restart apache2

この時点で、ApacheウェブサーバーはTYPO3を提供するために設定されています。次のステップに進むことができます。

TYPO3 CMSにアクセスする

新しいサーバーにTYPO3をインストールする場合は、TYPO3のウェブルートディレクトリ内にFIRST_INSTALLファイルを作成する必要があります。次のコマンドで作成できます:

touch /var/www/html/typo3/FIRST_INSTALL
chown -R www-data:www-data /var/www/html/typo3/FIRST_INSTALL

今、ウェブブラウザを開いて、URL http://typo3.example.com を使用してTYPO3にアクセスしてください。次のページが表示されるはずです:

データベースのユーザー名、パスワード、ホストを提供し、続けるボタンをクリックしてください。次のページが表示されるはずです:

続けるボタンをクリックし、TYPO3データベース名を選択してください。次のページが表示されるはずです:

次に、管理者ユーザー名、パスワード、サイト名を入力し、続行ボタンをクリックしてください。TYPO3のログインページにリダイレクトされます:

管理者のユーザー名とパスワードを入力し、ログインボタンをクリックしてください。次のページでTYPO3ダッシュボードが表示されるはずです:

Let's EncryptでTYPO3を安全にする

Let's Encryptの無料SSLでウェブサイトを保護することは良いアイデアです。まず、CertbotクライアントをインストールしてSSLを管理します。以下のコマンドでインストールできます:

apt-get install python3-certbot-apache -y

インストールが完了したら、次のコマンドを実行して、Let's Encrypt SSLでウェブサイトを保護してください。

certbot --apache -d typo3.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): [email 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 typo3.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/typo3-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/typo3-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/typo3-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キーを押すと、あなたのウェブサイト用にLet's Encrypt SSLがインストールされます:

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

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/typo3.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/typo3.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

これで、URL https://typo3.example.com を使用して、安全にTYPO3 CMSにアクセスできるようになりました。

結論

おめでとうございます!あなたはTYPO3 CMSを正常にインストールし、Ubuntu 22.04でLet's Encrypt SSLを使用してセキュリティを確保しました。これで、ウェブブラウザを介して簡単にウェブサイトやブログを作成できます。質問があればお気軽にお尋ねください。

関連記事: