インストールガイド · 4 min read · Dec 19, 2025

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

Forkは初心者とプロフェッショナルのためのオープンソースのコンテンツ管理システムです。ウェブサイトを構築、監視、更新するためのユーザーフレンドリーな環境を作ることを目的としています。主にブログ、ページ、ユーザーなどの追加モジュールを提供するCMSとして立ち上げられました。その強力なアプリとテーマは、必要に応じてウェブサイトをカスタマイズするのに役立ちます。ユーザーフレンドリーなユーザーインターフェースは、ユーザーが迅速かつ簡単にウェブサイトを作成できるようにします。

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

前提条件

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

Apache、MariaDB、およびPHPのインストール

まず、次のコマンドを使用してApacheウェブサーバーとMariaDBサーバーをインストールします:

apt-get install apache2 mariadb-server -y

次に、サーバーにPHPバージョン7.4と他の拡張機能をインストールする必要があります。ただし、PHP 7.4バージョンはUbuntuのデフォルトリポジトリには含まれていません。したがって、Ondrej PHPリポジトリをサーバーに追加する必要があります。次のコマンドで追加できます:

apt install software-properties-common  
add-apt-repository ppa:ondrej/php -y

PHPリポジトリが追加されたら、次のコマンドを使用してPHPと他の必要な拡張機能をインストールできます:

apt-get install php7.4 libapache2-mod-php7.4 php7.4-xml php7.4-cli php7.4-zip php7.4-common php7.4-sqlite3 php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-mysql php7.4-gd wget unzip -y

すべてのパッケージをインストールした後、PHP設定ファイルを編集してデフォルト設定を変更します:

nano /etc/php/7.4/apache2/php.ini

必要に応じて次の設定を変更します:

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
file_uploads = On
date.timezone = UTC

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

systemctl restart apache2

Fork CMSデータベースの作成

まず、MariaDBを保護し、MariaDBのルートパスワードを設定する必要があります。次のスクリプトを実行してMariaDBインストールを保護できます:

mysql_secure_installation

このスクリプトは、ルートパスワードを設定し、匿名ユーザーを削除し、リモートからのルートログインを禁止し、テストデータベースを削除します。以下のように表示されます:

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が保護されたら、MariaDBシェルにログインします:

次に、次のコマンドでMariaDBシェルにログインします:

mysql -u root -p

ルートパスワードを入力し、Fork CMS用のデータベースとユーザーを作成します:

MariaDB [(none)]> CREATE DATABASE forkdb;  
MariaDB [(none)]> CREATE USER 'forkuser'@'localhost' IDENTIFIED BY 'password';

次に、次のコマンドでFork CMSデータベースに権限を付与します:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON forkdb.* TO 'forkuser'@'localhost';

次に、FLUSH PRIVILEGESコマンドを実行して、権限テーブルがMariaDBによって再読み込みされるようにします:

MariaDB [(none)]> FLUSH PRIVILEGES;

最後に、次のコマンドを使用してMariaDBシェルから退出します:

MariaDB [(none)]> EXIT;

Fork CMSのインストール

まず、システムにComposerをインストールする必要があります。次のコマンドでインストールできます:

curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

次の出力が得られます:

All settings correct for using Composer
Downloading...

Composer (version 2.4.4) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

次に、Apacheのウェブルートディレクトリに移動し、Composerを使用してFork CMSをダウンロードします:

cd /var/www/html/  
composer create-project forkcms/forkcms

次に、Fork CMSディレクトリに適切な権限と所有権を設定します:

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

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

Fork CMS用のApache仮想ホストの作成

次に、Fork CMSをインターネット上で提供するためのApache仮想ホスト設定ファイルを作成する必要があります。次のコマンドで作成できます:

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

次の行を追加します:


     ServerAdmin [email protected]
     DocumentRoot /var/www/html/forkcms
     ServerName forkcms.example.com

     
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     

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

ファイルを保存して閉じたら、次のコマンドでFork CMSを有効にし、Apacheのリライトモジュールを有効にします:

a2ensite forkcms.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 Tue 2022-12-13 05:35:24 UTC; 1s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 94668 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 94672 (apache2)
      Tasks: 6 (limit: 2238)
     Memory: 13.4M
        CPU: 45ms
     CGroup: /system.slice/apache2.service
             ??94672 /usr/sbin/apache2 -k start
             ??94673 /usr/sbin/apache2 -k start
             ??94674 /usr/sbin/apache2 -k start
             ??94675 /usr/sbin/apache2 -k start
             ??94676 /usr/sbin/apache2 -k start
             ??94677 /usr/sbin/apache2 -k start

Dec 13 05:35:24 ubuntu2204 systemd[1]: apache2.service: Deactivated successfully.
Dec 13 05:35:24 ubuntu2204 systemd[1]: Stopped The Apache HTTP Server.
Dec 13 05:35:24 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

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

Fork CMSウェブインターフェースにアクセス

今、ウェブブラウザを開き、URL http://forkcms.example.com/install/2. を入力します。次のページにリダイレクトされます:

ここで、希望する言語を選択し、次へボタンをクリックします。次のページが表示されるはずです:

ここで、インストールしたいモジュールを選択し、次へボタンをクリックします。次のページが表示されるはずです:

ここで、データベースの詳細を提供し、次へボタンをクリックします。次のページが表示されるはずです:

ここで、管理者のメールアドレス、ユーザー名、パスワードを提供し、インストールを完了ボタンをクリックします。次のページが表示されるはずです:

今、Fork CMSにログインボタンをクリックします。次のページにFork CMSのログイン画面が表示されるはずです:

今、管理者のユーザー名とパスワードを提供し、ログインボタンをクリックします。次の画像のようにFork CMSダッシュボードにリダイレクトされます:

Let’s Encrypt SSLでForkCMSを保護

ForkCMSウェブサイトにLet’s Encrypt SSLをインストールするには、サーバーにcertbotパッケージをインストールする必要があります。

まず、次のコマンドでSnapパッケージマネージャーをインストールします:

apt install snapd

次に、Snapパッケージを最新バージョンに更新します:

snap install core  
snap refresh core

次に、次のコマンドを使用してcertbotパッケージをインストールします:

snap install --classic certbot

次に、Certbotバイナリのシンボリックリンクをシステムの場所に作成します:

ln -s /snap/bin/certbot /usr/bin/certbot

次に、次のコマンドを実行してLet’s Encrypt SSL証明書をダウンロードしてインストールします:

certbot --apache -d forkcms.example.com

メールアドレスを提供し、利用規約に同意するように求められます:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, 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

Yを入力してEnterキーを押すと、ドメインのSSL証明書がダウンロードされ、インストールされます:

Account registered.
Requesting a certificate for forkcms.example.com

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/forkcms.example.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/forkcms.example.com/privkey.pem
This certificate expires on 2023-02-28.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for forkcms.example.com to /etc/nginx/conf.d/mastodon.conf
Congratulations! You have successfully enabled HTTPS on https://forkcms.example.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

結論

この記事では、Ubuntu 22.04サーバーでApacheとLet’s Encrypt SSLを使用してFork CMSをインストールする方法を説明しました。これで、Fork CMSの直感的なウェブインターフェースからウェブサイトを構築、監視、更新できます。質問があればお気軽にお尋ねください。

Share: X/Twitter LinkedIn

新しい投稿を受信箱で受け取る

スパムはありません。いつでも購読を解除できます。