Debian11.2にPerl をインストールする方法
環境
OSバージョンを確認します
# cat /etc/debian_version
11.2
# cat /etc/debian_version
11.2
# cat /etc/debian_version 11.2
apache2バージョンを確認します
# apache2 -v
Server version: Apache/2.4.53 (Debian)
Server built: 2022-03-14T16:28:35
# apache2 -v
Server version: Apache/2.4.53 (Debian)
Server built: 2022-03-14T16:28:35
# apache2 -v Server version: Apache/2.4.53 (Debian) Server built: 2022-03-14T16:28:35
Perlのインストール手順
1.Perl をインストールします
# apt -y install perl libcgi-pm-perl
# apt -y install perl libcgi-pm-perl
# apt -y install perl libcgi-pm-perl
2.CGI モジュールを有効にします
# a2enmod cgid
Enabling module cgid.
To activate the new configuration, you need to run:
systemctl restart apache2
# a2enmod cgid
Enabling module cgid.
To activate the new configuration, you need to run:
systemctl restart apache2
# a2enmod cgid Enabling module cgid. To activate the new configuration, you need to run: systemctl restart apache2
3.apache2を再起動します
# systemctl restart apache2
4.テストスクリプトを作成します
# cat > /usr/lib/cgi-bin/test_script <<'EOF'
> #!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello CGI\n";
EOF
# cat > /usr/lib/cgi-bin/test_script <<'EOF'
> #!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello CGI\n";
EOF
# cat > /usr/lib/cgi-bin/test_script <<'EOF' > #!/usr/bin/perl print "Content-type: text/html\n\n"; print "Hello CGI\n"; EOF
5.スクリプトの権限を付与します
# chmod 705 /usr/lib/cgi-bin/test_script
# chmod 705 /usr/lib/cgi-bin/test_script
# chmod 705 /usr/lib/cgi-bin/test_script
動作確認
# curl http://localhost/cgi-bin/test_script
Hello CGI
# curl http://localhost/cgi-bin/test_script
Hello CGI
# curl http://localhost/cgi-bin/test_script Hello CGI