Web管理 · 5 min read · Nov 02, 2025

Rocky Linux 8に無料のLet's Encrypt SSLを使用してWebminをインストールする方法

Webminは、Linuxシステムをウェブブラウザを介して構成することを可能にする無料のオープンソースのウェブベースのLinux管理ツールです。Perlで書かれており、CPUとRAMのリアルタイム監視を備えたユーザーフレンドリーなウェブインターフェースを提供します。Webminを使用すると、ユーザーアカウント管理、パッケージ管理、ファイアウォール管理、cronジョブの作成など、いくつかの管理タスクを実行できます。

このチュートリアルでは、Rocky Linux 8にNginxとLet’s Encrypt SSLを使用してWebminをインストールする方法を示します。

前提条件

  • Rocky Linux 8を実行しているサーバー。
  • サーバーIPにポイントされた有効なドメイン名。
  • サーバーに設定されたrootパスワード。

Webminのインストール

WebminはPerl言語で書かれているため、システムにPerlをインストールする必要があります。次のコマンドを実行してPerlをインストールします:

dnf install perl -y

次に、次のコマンドを使用してWebminの最新バージョンのtarballをダウンロードします:

wget https://www.webmin.com/download/webmin-current.tar.gz

Webminがダウンロードされたら、次のコマンドを使用してダウンロードしたファイルを抽出します:

tar xvf webmin-current.tar.gz

次に、Webminのインストールディレクトリを作成し、次のスクリプトを実行してWebminをインストールします:

mkdir -p /usr/local/webmin  
./webmin-1.984/setup.sh /usr/local/webmin/

以下のように、設定ディレクトリのパス、管理者のユーザー名とパスワードを提供するように求められます:

*********************************************************************

        Webminセットアップスクリプトへようこそ、バージョン1.984
*******************************************************************
Webminは、Unix系オペレーティングシステムと一般的なUnixサービスを簡単に管理できるウェブベースのインターフェースです。

/root/webmin-1.984から/usr/local/webmin/にWebminをインストールしています...

*******************************************************************
Webminは、設定ファイルとログファイルのために別々のディレクトリを使用します。
同時に複数のバージョンのWebminを実行したくない場合は、デフォルトを受け入れることができます。

設定ファイルディレクトリ [/etc/webmin]: 
ログファイルディレクトリ [/var/webmin]: 

*******************************************************************
Webminは完全にPerlで書かれています。システム上のPerl 5インタープリターへのフルパスを入力してください。

Perlへのフルパス(デフォルト /usr/bin/perl): 

Perlをテスト中...
Perlは正常にインストールされているようです

*******************************************************************
オペレーティングシステム名:    Rocky Linux
オペレーティングシステムバージョン: 8.5

*******************************************************************
Webminは、管理プログラムへのアクセスを提供するために独自のパスワード保護されたウェブサーバーを使用します。セットアップスクリプトは次のことを知る必要があります:
 - ウェブサーバーを実行するポート。すでにこのポートを使用している別のウェブサーバーがあってはいけません。
 - ウェブサーバーにアクセスするために必要なログイン名。
 - ウェブサーバーにアクセスするために必要なパスワード。
 - ウェブサーバーがSSLを使用するかどうか(システムがサポートしている場合)。
 - ブート時にwebminを起動するかどうか。

ウェブサーバーポート(デフォルト 10000): 
ログイン名(デフォルト admin): admin
ログインパスワード: 
パスワードを再入力: 
SSLを使用しますか(y/n): n
ブート時にWebminを起動しますか(y/n): y
*******************************************************************
*********************************************************************
Webminは正常にインストールされ、起動しました。ウェブブラウザを使用して次のURLにアクセスしてください

  http://rockylinux:10000/

そして、以前に入力した名前とパスワードでログインします。

デフォルトでは、Webminはポート10000でリッスンしています。次のコマンドを使用して確認できます:

ss -antpl | grep 10000

次の出力が得られます:

LISTEN 0      128          0.0.0.0:10000      0.0.0.0:*    users:(("miniserv.pl",pid=6601,fd=7))

NginxをWebminのリバースプロキシとして構成する

NginxをWebminのリバースプロキシとして使用するのは良いアイデアです。まず、次のコマンドを使用してNginxパッケージをインストールします:

dnf install nginx -y

次に、次のコマンドを使用してNginxの仮想ホスト構成ファイルを作成します:

nano /etc/nginx/conf.d/webmin.conf

次の行を追加します:

server {
       listen 80;
       server_name webmin.linuxbuz.com;

       access_log /var/log/nginx/webmin.access;
       error_log /var/log/nginx/webmin.error;

       location / {
              proxy_pass http://127.0.0.1:10000;
              #proxy_set_header Host $http_host;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Forwarded-Proto $scheme;
        }
}

ファイルを保存して閉じたら、Nginxの構文エラーを確認します:

ginx -t

次の出力が得られます:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

次に、Nginxサービスを起動し、システム再起動時に自動的に起動するように設定します:

systemctl start nginx  
systemctl enable nginx

次のコマンドを使用してWebminのステータスを確認できます:

systemctl status nginx

次の出力が得られます:

? nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-12 08:20:04 UTC; 17s ago
  Process: 7051 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 7050 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 7048 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
 Main PID: 7053 (nginx)
    Tasks: 2 (limit: 11412)
   Memory: 3.7M
   CGroup: /system.slice/nginx.service
           ??7053 nginx: master process /usr/sbin/nginx
           ??7054 nginx: worker process

Feb 12 08:20:03 rockylinux systemd[1]: Starting The nginx HTTP and reverse proxy server...
Feb 12 08:20:04 rockylinux nginx[7050]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Feb 12 08:20:04 rockylinux nginx[7050]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Feb 12 08:20:04 rockylinux systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Feb 12 08:20:04 rockylinux systemd[1]: Started The nginx HTTP and reverse proxy server.

WebminでSSLを有効にする

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

dnf install epel-release -y  
dnf install python3-certbot-nginx -y

次に、certbotコマンドを実行して、WebminドメインにLet’s Encrypt SSLをダウンロードしてインストールします。

certbot --nginx -d webmin.linuxbuz.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.2-November-15-2017.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
Account registered.
Requesting a certificate for webmin.linuxbuz.com

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/webmin.linuxbuz.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/webmin.linuxbuz.com/privkey.pem
This certificate expires on 2022-05-13.
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 webmin.linuxbuz.com to /etc/nginx/conf.d/webmin.conf
Congratulations! You have successfully enabled HTTPS on https://webmin.linuxbuz.com
We were unable to subscribe you the EFF mailing list because your e-mail address appears to be invalid. You can try again later by visiting https://act.eff.org.

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

Webminの構成

次に、Webminの構成ファイルを編集し、信頼できるリファラーを定義する必要があります。

nano /etc/webmin/config

次の行を追加します:

referers=webmin.linuxbuz.com

ファイルを保存して閉じたら、miniserv.confファイルを編集し、WebminでHTTPSモードを無効にします:

nano /etc/webmin/miniserv.conf

次の行を追加します:

ssl=0
allow=127.0.0.1

作業が完了したらファイルを保存して閉じます。

次に、次のコマンドを使用してWebminプロセスIDを取得します:

ps -ef | grep webmin

次の出力が得られます:

root        6601       1  0 08:12 ?        00:00:00 /usr/bin/perl /usr/local/webmin//miniserv.pl /etc/webmin/miniserv.conf
root        7553    1117  0 08:24 pts/0    00:00:00 grep --color=auto webmin

次に、killコマンドを使用してWebminプロセスを終了します。

kill -9 6601

次に、systemdを使用してWebminサービスを起動し、システム再起動時に自動的に起動するように設定します:

systemctl start webmin  
systemctl enable webmin

次に、次のコマンドを使用してWebminのステータスを確認します:

systemctl status webmin

次の出力が得られます:

? webmin.service - Webmin
   Loaded: loaded (/usr/lib/systemd/system/webmin.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-02-12 08:25:05 UTC; 54s ago
  Process: 7560 ExecStart=/etc/webmin/start (code=exited, status=0/SUCCESS)
 Main PID: 7561 (miniserv.pl)
    Tasks: 1 (limit: 11412)
   Memory: 23.9M
   CGroup: /system.slice/webmin.service
           ??7561 /usr/bin/perl /usr/local/webmin//miniserv.pl /etc/webmin/miniserv.conf

Feb 12 08:25:05 rockylinux systemd[1]: Starting Webmin...
Feb 12 08:25:05 rockylinux start[7560]: Starting Webmin server in /usr/local/webmin/
Feb 12 08:25:05 rockylinux webmin[7560]: Webmin starting
Feb 12 08:25:05 rockylinux systemd[1]: webmin.service: Can't open PID file /var/webmin/miniserv.pid (yet?) after start: No such file or direc>
Feb 12 08:25:05 rockylinux systemd[1]: Started Webmin.

ファイアウォールの構成

サーバーにfirewalldファイアウォールがインストールされている場合は、ポート80と443をファイアウォールを通過させる必要があります。次のコマンドを使用して許可できます:

firewall-cmd --add-port=80/tcp --permanent  
firewall-cmd --add-port=443/tcp --permanent

最後に、変更を適用するためにファイアウォールサービスを再読み込みします:

firewall-cmd --reload

Webminインターフェースにアクセスする

今、ウェブブラウザを開いて、URL https://webmin.linuxbuz.comを使用してWebminインターフェースにアクセスします。Webminのログインページにリダイレクトされます:

Webmin login

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

Webmin Dashboard

結論

おめでとうございます!NginxとLet’s Encrypt SSLを使用してRocky Linux 8にWebminを正常にインストールしました。これで、ウェブブラウザを介してLinuxシステムを簡単に管理できます。質問があればお気軽にお尋ねください。

Share: X/Twitter LinkedIn

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

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