0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

cpan で HTML::Template をインストール

Posted at

cgiを利用したサーバのRedHat9.1への移行プロジェクトで、
移行先のサーバで利用できるレポジトリが RedHatのレポジトリのみ環境。
その際、モジュール「HTML::Template」が存在しないエラーが発生したが、dnf でインストールできなかった。

対応策として、インターネットに接続できるサーバで 「install HTML::Template」したものをそのまま持っていけるかの検証
作成サーバのOSは almalinux 9.2,perl 5.32。

almalinux 9.2

[root@almalinux-9 ~]# perl -v
This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux-thread-multi
[root@almalinux-9 ~]# perl -e "print @INC"
/usr/local/lib64/perl5/5.32
# No such file or directory ただし、CPANをインストールしたら作成されるディレクトリ
/usr/local/share/perl5/5.32
# No such file or directory ただし、CPANをインストールしたら作成されるディレクトリ
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5
[root@almalinux-9 ~]#

事前確認

ll /usr/lib64/perl5/vendor_perl | sort
ll /usr/share/perl5/vendor_perl | sort

現状と同じものをdnf install

dnf install perl-CGI
dnf install perl-XML-Simple
  • cpanがそもそもなかった。。。
dnf install cpan
Perl site library directory "/usr/local/share/perl5/5.32" does not exist.
Perl site library directory "/usr/local/share/perl5/5.32" created.
Perl site library directory "/usr/local/lib64/perl5/5.32" does not exist.
Perl site library directory "/usr/local/lib64/perl5/5.32" created.
We initialized your 'urllist' to https://cpan.org/. Type 'o conf init urllist' to change it.

結構すぐインストール終わった

cpan
> install HTML::Template

Result: PASS
  SAMTREGAR/HTML-Template-2.97.tar.gz
  /usr/bin/make test -- OK
Running make install for SAMTREGAR/HTML-Template-2.97.tar.gz
Manifying 2 pod documents
Installing /usr/local/share/perl5/5.32/HTML/Template.pm
Installing /usr/local/share/perl5/5.32/HTML/Template/FAQ.pm

恐らく、以下のフォルダを固めて持っていけばOKなはず。

[root@almalinux-9 ~]# ll /usr/local/share/perl5/5.32/HTML/
total 132
drwxr-xr-x. 2 root root     20 Dec 23 02:31 Template
-r--r--r--. 1 root root 134236 May 18  2017 Template.pm

動作確認

dnf install httpd
systemctl start httpd

参考

cd /var/www/cgi-bin
vim test.tmpl
vim text.cgi
chmod 755 test.cgi
http://192.168.33.24/cgi-bin/test.cgi
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?