Rocky Linux 8에서 무료 Lets Encrypt SSL로 Webmin을 설치하는 방법
이 페이지에서
- 전제 조건
- Webmin 설치
- Webmin용 리버스 프록시로 Nginx 구성\n
- Webmin에서 SSL 활성화\n
- Webmin 구성
- 방화벽 구성\n
- Webmin 인터페이스 액세스
- 결론
Webmin은 웹 브라우저를 통해 Linux 시스템을 구성할 수 있는 무료 오픈 소스 웹 기반 Linux 관리 도구입니다. Perl로 작성되었으며 CPU 및 RAM을 실시간으로 모니터링하는 사용자 친화적인 웹 인터페이스를 제공합니다. Webmin을 사용하면 사용자 계정 관리, 패키지 관리, 방화벽 관리, cron 작업 생성 등을 포함한 여러 가지 관리 작업을 수행할 수 있습니다.
이 튜토리얼에서는 Rocky Linux 8에서 Nginx와 Lets Encrypt SSL을 사용하여 Webmin을 설치하는 방법을 보여줍니다.
전제 조건
- Rocky Linux 8을 실행하는 서버.\n
- 서버 IP로 가리키는 유효한 도메인 이름입니다.\n
- 루트 암호는 서버에서 구성됩니다.\n
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/
아래와 같이 구성 디렉토리의 경로, 관리자 사용자 이름 및 비밀번호를 제공하라는 메시지가 표시됩니다.
*********************************************************************** Welcome to the Webmin setup script, version 1.984 *********************************************************************** Webmin is a web-based interface that allows Unix-like operating systems and common Unix services to be easily administered. Installing Webmin from /root/webmin-1.984 to /usr/local/webmin/ ... *********************************************************************** Webmin uses separate directories for configuration files and log files. Unless you want to run multiple versions of Webmin at the same time you can just accept the defaults. Config file directory [/etc/webmin]: Log file directory [/var/webmin]: *********************************************************************** Webmin is written entirely in Perl. Please enter the full path to the Perl 5 interpreter on your system. Full path to perl (default /usr/bin/perl): Testing Perl ... Perl seems to be installed ok *********************************************************************** Operating system name: Rocky Linux Operating system version: 8.5 *********************************************************************** Webmin uses its own password protected web server to provide access to the administration programs. The setup script needs to know : - What port to run the web server on. There must not be another web server already using this port. - The login name required to access the web server. - The password required to access the web server. - If the webserver should use SSL (if your system supports it). - Whether to start webmin at boot time. Web server port (default 10000): Login name (default admin): admin Login password: Password again: Use SSL (y/n): n Start Webmin at boot time (y/n): y *********************************************************************** *********************************************************************** Webmin has been installed and started successfully. Use your web browser to go to http://rockylinux:10000/ and login with the name and password you entered previously.
기본적으로 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에서 구문 오류가 있는지 확인합니다.
nginx -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 활성화
Lets Encrypt SSL로 Webmin을 보호하는 것이 좋습니다. 먼저 Lets Encrypt SSL을 관리하려면 Certbot 클라이언트를 설치해야 합니다. 다음 명령으로 설치할 수 있습니다.
dnf install epel-release -y
dnf install python3-certbot-nginx -y
그런 다음 certbot 명령을 실행하여 Webmin 도메인에서 Lets 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): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 대시보드가 표시되어야 합니다.
결론
축하합니다! Rocky Linux 8에 Nginx 및 Lets Encrypt SSL과 함께 Webmin을 성공적으로 설치했습니다. 이제 웹 브라우저를 통해 Linux 시스템을 쉽게 관리할 수 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.