Ubuntu 22.04でChevereto-Freeを使用して画像ホスティングウェブサイトを作成する
Ubuntu 22.04でChevereto-Freeを使用して画像ホスティングウェブサイトを作成する
このチュートリアルはこれらのOSバージョンのために存在します
- Ubuntu 22.04 (ジャミー・ジェリーフィッシュ)
- Ubuntu 16.04 (ゼニアル・ゼクサス)
このページで
- 前提条件
- 始めに
- Apache、PHP、およびMariaDBサーバーをインストールします。
- MariaDBデータベースを作成する
- Cheveretoをダウンロードする
- CheveretoのためにApacheを設定する
- Cheveretoウェブインターフェースにアクセス
- Let's Encrypt SSLを使用してCheveretoを安全にする
- 結論
Cheveretoは、ウェブ上で自分自身の画像ホスティングサーバーをホストすることを可能にする、無料でオープンソースの画像ホスティングおよび共有ソフトウェアです。それは、自己ホスト型の多目的でマルチユーザーのフル機能を備えた画像ホスティングソリューションであり、レスポンシブな画像ホスティングウェブサイトを作成することができます。多言語対応、大量画像インポート、ソーシャルメディア統合、複数のサーバーなど、さまざまな機能を提供しています。
この投稿では、Ubuntu 22.04 に Chevereto 画像ホスティングソリューションをインストールする方法をお見せします。
前提条件
- Ubuntu 22.04を実行しているサーバー。
- サーバーにはルートパスワードが設定されています。
始めに
まず、すべてのシステムパッケージを最新バージョンに更新し、アップグレードすることをお勧めします。次のコマンドを実行することで、更新できます:
apt update -y
apt upgrade -yすべてのパッケージがアップグレードされたら、次のコマンドを実行して追加の依存関係をインストールします:
apt install apt-transport-https ca-certificates curl software-properties-common -yすべての依存関係がインストールされると、次のステップに進むことができます。
Apache、PHP、およびMariaDBサーバーをインストールします。
始める前に、サーバーにLAMPサーバーをインストールする必要があります。
まず、次のコマンドを使用してApacheとMariaDBサーバーをインストールします。
apt install apache2 mariadb-server次に、以下のコマンドでPHPリポジトリをAPTに追加します:
add-apt-repository ppa:ondrej/php -y次に、以下のコマンドを使用して他の必要な拡張機能と共にPHPバージョン7.4をインストールします:
apt install php7.4 libapache2-mod-php7.4 php7.4-cli php7.4-fpm php7.4-json php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath -yすべてのパッケージがインストールされると、次のステップに進むことができます。
MariaDBデータベースを作成する
まず、MariaDBのインストールを保護し、次のスクリプトを実行してルートパスワードを設定します:
mysql_secure_installation以下のようにすべての質問に答えてください:
Enter current password for root (enter for none): Press ENTER
Set root password? [Y/n]: Y
New password: Set-your-new-password
Re-enter new password: Set-your-new-password
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ログインしたら、次のコマンドを使用してデータベースとユーザーを作成します:
MariaDB [(none)]> CREATE DATABASE chevereto;
MariaDB [(none)]> CREATE USER 'chevereto'@'localhost' IDENTIFIED BY 'password';次に、次のコマンドを使用してCheveretoデータベースにすべての権限を付与します:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON chevereto.* TO 'chevereto'@'localhost';
次に、変更を適用するために特権をフラッシュします:
MariaDB [(none)]> FLUSH PRIVILEGES;最後に、次のコマンドでMariaDBシェルを終了します:
MariaDB [(none)]> EXIT;Cheveretoをダウンロードする
まず、次のコマンドを使用してApacheのウェブルートディレクトリ内にChevereto用のディレクトリを作成します:
mkdir -p /var/www/html/chevereto/次に、Cheveretoディレクトリに移動し、次のコマンドでCheveretoの最新バージョンをダウンロードします:
cd /var/www/html/chevereto
wget https://github.com/rodber/chevereto-free/releases/download/1.6.0/1.6.0.zipダウンロードが完了したら、以下のコマンドでダウンロードしたファイルの圧縮を解除します:
unzip 1.6.0.zip次に、Cheveretoディレクトリに適切な権限と所有権を設定します。
chown -R www-data:www-data /var/www/html/chevereto/
chmod -R 775 /var/www/html/chevereto/CheveretoのためにApacheを設定する
次に、以下のコマンドを使用してCheveretoのためのApacheバーチャルホスト設定ファイルを作成します。
nano /etc/apache2/sites-available/chevereto.conf次の設定を追加してください:
<VirtualHost *:80>
ServerAdmin [email
ServerName chevereto.example.com
DocumentRoot /var/www/html/chevereto
ErrorLog ${APACHE_LOG_DIR}/chevereto.example.com_error.log
CustomLog ${APACHE_LOG_DIR}/chevereto.example.com_access.log combined
<Directory /var/www/html/chevereto/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
作業が完了したら、ファイルを保存して閉じてください。次に、以下のコマンドでCheveretoの仮想ホストを有効にします。
a2ensite chevereto.conf次に、次のコマンドを使用してApacheのリライトおよびSSLモジュールを有効にします:
a2enmod rewrite ssl
最後に、変更を適用するために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-08-28 07:22:12 UTC; 9s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 87027 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 87032 (apache2)
Tasks: 6 (limit: 2242)
Memory: 14.1M
CPU: 111ms
CGroup: /system.slice/apache2.service
??87032 /usr/sbin/apache2 -k start
??87033 /usr/sbin/apache2 -k start
??87034 /usr/sbin/apache2 -k start
??87035 /usr/sbin/apache2 -k start
??87036 /usr/sbin/apache2 -k start
??87037 /usr/sbin/apache2 -k start
Aug 28 07:22:12 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...
Cheveretoウェブインターフェースにアクセス
さて、ウェブブラウザを開いて、URL http://chevereto.example.com. を使用してCheveretoのウェブインターフェースにアクセスしてください。データベース設定ページにリダイレクトされます:
データベース情報を提供し、続けるボタンをクリックしてください。次のページが表示されるはずです:
今、管理者のユーザー名、パスワード、およびウェブサイトモードを提供し、次にCheveretoをインストールボタンをクリックしてください。インストールが完了すると、次のページが表示されるはずです:
管理ダッシュボード ボタンをクリックしてください。Cheveretoのログインページが表示されるはずです:
管理者のユーザー名とパスワードを入力し、=>ボタンをクリックしてください。次のページにCheveretoダッシュボードが表示されるはずです:
Let's Encrypt SSLを使用してCheveretoを安全にする
ウェブサイトをLet's Encrypt SSLで保護することも推奨されています。まず、サーバーにCertbotクライアントをインストールする必要があります。次のコマンドでインストールできます:
apt-get install python3-certbot-apache -yCertbotがインストールされたら、次のコマンドを実行して、Let's Encrypt SSLでウェブサイトを保護します:
certbot --apache -d chevereto.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 chevereto.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/chevereto-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/chevereto-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/chevereto-le-ssl.conf
Next, select whether or not to redirect HTTP traffic to HTTPS as shown below:
HTTPトラフィックをHTTPSにリダイレクトするかどうかを選択し、HTTPアクセスを削除してください。
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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/chevereto.conf to ssl vhost in /etc/apache2/sites-available/chevereto-le-ssl.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://chevereto.example.com
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=chevereto.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/chevereto.example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/chevereto.example.com/privkey.pem
Your cert will expire on 2022-11-29. 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
結論
おめでとうございます!あなたはUbuntu 22.04にChevereto画像ホスティングサーバーを成功裏にインストールしました。これでサーバーに画像をアップロードし、インターネットのどこからでもアクセスできるようになりました。質問があれば遠慮なくお聞きください。





