Ubuntu20.04にFriendicaソーシャルネットワークプラットフォームをインストールする方法

Ubuntu/Debian

目次

Friendicaは、無料のオープンソースの分散型ソーシャルネットワーキングプラットフォームであり、独自のソーシャルネットワーキングプロジェクトを構築および維持するのに役立ちます。 Mastodon、Hubzilla、OStatus、Pleromaなどを含むActivityPubのサポートが組み込まれています。 RSS / Atomフィードを介してWebサイトやブログをソーシャルストリームにインポートできます。 強力なユーザーおよび管理ダッシュボードを提供し、任意のデバイスからソーシャルネットワークを管理するのに役立ちます。

このチュートリアルでは、Friendica withApacheとLet’sEncryptSSLをUbuntu20.04にインストールする方法を紹介します。

前提条件

  • Ubuntu20.04を実行しているサーバー。
  • サーバーIPを指す有効なドメイン名。
  • ルートパスワードがサーバーに設定されます。

入門

開始する前に、システムパッケージを最新バージョンに更新する必要があります。 次のコマンドを使用して、それらを更新できます。

apt-get update -y

サーバーが更新されたら、次のステップに進むことができます。

LAMPサーバーをインストールする

Friendicaは、PHPで記述されたWebサーバー上で実行され、MySQLをデータベースバックエンドとして使用します。 したがって、LAMPスタックをシステムにインストールする必要があります。 インストールされていない場合は、次のコマンドでインストールできます。

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-imagick php-xml php-cli php-zip php-sqlite3 curl git -y

すべてのパッケージがインストールされたら、php.iniファイルを編集し、いくつかの変更を加えます。

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

次の行を変更します。

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 300
max_input_vars = 1500
date.timezone = Asia/Kolkata

終了したら、ファイルを保存して閉じます。

Friendicaデータベースを作成する

次に、Friendicaのデータベースとユーザーを作成する必要があります。 まず、次のコマンドを使用してMySQLに接続します。

mysql

接続したら、次のコマンドを使用してデータベースとユーザーを作成します。

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

次に、次のコマンドを使用して、Friendicaデータベースにすべての権限を付与します。

MariaDB [(none)]> GRANT ALL ON friendicadb.* TO 'friendica'@'localhost' WITH GRANT OPTION;

次に、特権をフラッシュし、次のコマンドを使用してMySQLを終了します。

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

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

Friendicaをダウンロード

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

apt-get install composer -y

インストールしたら、ディレクトリをApache Webルートに変更し、Gitリポジトリから最新バージョンのFriendicaをダウンロードします。

cd /var/www/html
git clone https://github.com/friendica/friendica.git

ダウンロードが完了したら、ディレクトリをfriendicaに変更し、次のコマンドを使用して必要なPHP依存関係をインストールします。

cd friendica
composer install --no-dev

次に、次のコマンドを使用してFriendicaアドオンをダウンロードします。

git clone https://github.com/friendica/friendica-addons.git

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

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

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

Friendica用にApacheを構成する

次に、FriendicaをホストするためのApache仮想ホスト構成ファイルを作成する必要があります。 次のコマンドで作成できます。

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

次の行を追加します。

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/friendica
     ServerName friendica.example.com


     <Directory /var/www/html/friendica/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

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

</VirtualHost>

ファイルを保存して閉じてから、次のコマンドを使用してApache仮想ホストを有効にし、モジュールを書き換えます。

a2ensite friendica.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 2021-02-07 09:20:58 UTC; 6s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 33243 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 33259 (apache2)
      Tasks: 6 (limit: 2353)
     Memory: 15.1M
     CGroup: /system.slice/apache2.service
             ??33259 /usr/sbin/apache2 -k start
             ??33260 /usr/sbin/apache2 -k start
             ??33261 /usr/sbin/apache2 -k start
             ??33262 /usr/sbin/apache2 -k start
             ??33263 /usr/sbin/apache2 -k start
             ??33264 /usr/sbin/apache2 -k start

Feb 07 09:20:58 ubuntu2004 systemd[1]: Starting The Apache HTTP Server...

Friendicaダッシュボードにアクセスする

次に、Webブラウザーを開き、URLを使用してFriendicaWebインターフェースにアクセスします。 http://friendica.example.com。 システムチェックページにリダイレクトされます。

Friendicaシステムチェック

すべてのPHP依存関係がインストールされていることを確認してから、 ボタン。 次のページが表示されます。

サーバーのセットアップ

ドメイン名、インストールパスを入力し、をクリックします 参加する ボタン。 次のページが表示されます。

データベース接続

データベース名、データベースユーザー名、パスワードを入力し、をクリックします 参加する。 サイト設定ページが表示されます。

サイト設定

管理者の電子メール、言語、タイムゾーンを提供し、をクリックします 参加する ボタン。 インストールが完了すると、次のページが表示されます。

インストールが完了しました

次に、をクリックします 登録 ページボタンをクリックし、登録プロセスを完了してFriendicaにアクセスします。

Let’s EncryptSSLでFriendicaを保護する

Let’s EncryptSSLを使用してWebサイトを保護することをお勧めします。 SSLをインストールして管理するには、Certbotクライアントをインストールする必要があります。 次のコマンドでインストールできます。

apt-get install python3-certbot-apache -y

Certbotをインストールしたら、次のコマンドを実行して、Let’s EncryptSSLでWebサイトを保護します。

certbot --apache -d friendica.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 protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 friendica.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/friendica-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/friendica-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/friendica-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キーを押して、WebサイトにLet’s EncryptSSLをインストールします。

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

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/friendica.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/friendica.example.com/privkey.pem
   Your cert will expire on 2020-10-23. 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

これで、URLhttps://friendica.example.comを使用してWebサイトに安全にアクセスできます。

結論

おめでとう! これで、FriendicaソーシャルネットワークプラットフォームがUbuntu20.04サーバーに正常にインストールおよび構成されました。 これで、中央の場所からソーシャルネットワークコミュニティを管理できます。

Hope this helps!

Source link

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です