Proxmoxでサーバ構築

イメージ
これまでテスト用にi5第8世代の廃棄PCを使用してきた。 とはいえ今の所何も問題は起きていないが、入れ替えも視野に入れ予備サーバを用意することに。 - メモリ:16GB - SSD:500GB - DDNS+Let's Encrypt - Ubuntu24.04 この環境なので、すぐに構築し直すことは可能だが、とりあえずこのまま置いておいて別のサーバを立てることにする。 最初はRaspberryPiで構築しようと思ったけれど、本体電源+外付けHDD電源+ディスプレイ電源と考えると、邪魔なので廃案。 そこで廃棄しようと思っていた「Lavie NS300/N」が手元にあったので、これを利用することに。 一応バッテリーは正常に動作するので、UPS代わりにそのまま。 - Core™ i3-8145U(やや非力) - メモリ:8GB(少ないが…) - HDD:1TB なので、これまで使用しているものより、若干スペックダウン。 ただ用途は、非常勤で教えに行っている専門学校生用の練習マシンとする予定なので、まぁ問題なさそう。 Proxmox導入 直接、Linuxを導入してもよいのだけれど、今回は Proxmox を導入し、その上でUbuntu Serverを動作させる計画。 USBにProxmoxのイメージを焼いて、インストールすれば問題なく完了。 ただ、現在のバージョンはdebian - trixieがベースになっているので、若干参考になるサイトが少なめ。とはいえ旧版のは参考になるので調べつつ… HDDなだけあって、最初の起動は少し遅いものの、立ち上がってしまえば問題ない。 さぁ、VMにするかCTにするか…。 GUI使うのであれば、VMかなぁ。サーバだしCTでいいかぁ。 という程度の選定で、CT(コンテナ)で進めることに。 - メモリ:4GB - CPU:2 - HDD:20GB(root disk) - HDD:400GB(home用) - Ubuntu24.04 という構成で進めることにした。 テンプレートを用意して、初期設定を行い起動。 まぁすんなりと入った。 液晶を閉じたら、Suspendになってしまったので、若干設定変更。 $ sudo nano /etc/systemd/logind.conf HandleLidSwitch=ignore $ sudo sy...

久しぶりで、使い方を忘れてた…(Perl)

Perlでプログラムをガシガシと

昨年納品したプログラムの、追加機能の要求が上がったので、見直しを行っていた。

今回は、DBを使うほど件数が増えそうにもない。
履歴を見て登録されているユーザか、そうでないかを判別するだけなので、ハッシュをファイルに紐付けて、簡易のDBとして使うことにする。

 昔なら、メモリがパンクするんじゃ?とかディスク遅いっすとか思ったりして躊躇するんだろうけど、今どきはドンドンメモリ使っちゃおう!ファイル使っちゃおう!なんて思ったりもする。

さて、前回利用したモジュールは
Jcode;
MIME::Parser;
MIME::WordDecoder;
File::Basename;
File::Path;
Fcntl;
File::Temp;
書き出してみるとこんなにもあった。

でもって、今回新たに Storable;

当然、稼働しているプログラムなので、直接いじるわけにはいかない。
とりあえず、ローカルでテストをする。

ソースを取り出して、修正内容を細かく分割。
それぞれテストして、組み立て…。

と、最初のテストで躓いた。

ローカルの環境が、この春に14.04で準備したNewマシンなので、モジュールが入っていない!

モジュールのインストール

そもそも、最初のuse Jcode;でエラー吐いているし…

ということで、インストールしようとしたが、コマンドを全く思い出せない。
あれれ? どうやら老化と共にやってくるアレか?
# perl -MCPAN -e shell
これが思い出せずに、仕方なくググりました。
いやぁ、外部記憶に入れておいて良かったゎ(泣) というか、内部記憶から消去されている模様。

忘れないように、自分を戒めるために記録しておく。

作業自体は、コマンド入力して完了するのに1分もかからないというのに、思い出そうとした時間の方が長いとは…。

root@X200:~# perl -MCPAN -e shell

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] 

Autoconfigured everything but 'urllist'.

Now you need to choose your CPAN mirror sites.  You can let me
pick mirrors for you, you can select them from a list or you
can enter them by hand.

Would you like me to autoroot@X200:~# perl -MCPAN -e shell

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] 

Autoconfigured everything but 'urllist'.

Now you need to choose your CPAN mirror sites.  You can let me
pick mirrors for you, you can select them from a list or you
can enter them by hand.

Would you like me to automatically choose some CPAN mirror
sites for you? (This means connecting to the Internet) [yes] 
Trying to fetch a mirror list from the Internet
Fetching with LWP:
http://www.perl.org/CPAN/MIRRORED.BY

Looking for CPAN mirrors near you (please be patient)
.......................... done!

New urllist
  http://cpan.develooper.com/
  http://mirrors.gossamer-threads.com/CPAN/
  http://mirror.team-cymru.org/CPAN/

Autoconfiguration complete.

commit: wrote '/home/satoshi/.cpan/CPAN/MyConfig.pm'

You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.

cpan[1]> install Jcode
Fetching with LWP:
http://cpan.develooper.com/authors/01mailrc.txt.gz
Reading '/home/satoshi/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
http://cpan.develooper.com/modules/02packages.details.txt.gz
Reading '/home/satoshi/.cpan/sources/modules/02packages.details.txt.gz'
  Database was generated on Tue, 09 Sep 2014 13:53:17 GMT
..............
  New CPAN.pm version (v2.05) available.
  [Currently running version is v2.00]
  You might want to try
    install CPAN
    reload cpan
  to both upgrade CPAN.pm and run the new version without leaving
  the current session.


..............................................................DONE
Fetching with LWP:
http://cpan.develooper.com/modules/03modlist.data.gz
Reading '/home/satoshi/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /home/satoshi/.cpan/Metadata
Running install for module 'Jcode'
Running make for D/DA/DANKOGAI/Jcode-2.07.tar.gz
Fetching with LWP:
http://cpan.develooper.com/authors/id/D/DA/DANKOGAI/Jcode-2.07.tar.gz
Fetching with LWP:
http://cpan.develooper.com/authors/id/D/DA/DANKOGAI/CHECKSUMS
Checksum for /home/satoshi/.cpan/sources/authors/id/D/DA/DANKOGAI/Jcode-2.07.tar.gz ok
Scanning cache /home/satoshi/.cpan/build for sizes
DONE

  CPAN.pm: Building D/DA/DANKOGAI/Jcode-2.07.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Jcode
Writing MYMETA.yml and MYMETA.json
cp Jcode/Nihongo.pod blib/lib/Jcode/Nihongo.pod
cp Jcode.pm blib/lib/Jcode.pm
Manifying blib/man3/Jcode::Nihongo.3pm
Manifying blib/man3/Jcode.3pm
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/append.t ... ok     
t/convert.t .. ok     
t/getcode.t .. ok   
t/h2z.t ...... ok   
t/jfold.t .... ok   
t/length.t ... ok   
t/mime.t ..... ok     
t/new.t ...... ok     
t/perl581.t .. ok   
t/regex.t .... ok   
t/tr.t ....... ok     
All tests successful.
Files=11, Tests=244,  1 wallclock secs ( 0.08 usr  0.01 sys +  1.20 cusr  0.02 csys =  1.31 CPU)
Result: PASS
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make test -- OK
Running make install
Manifying blib/man3/Jcode::Nihongo.3pm
Installing /usr/local/share/perl/5.18.2/Jcode.pm
Installing /usr/local/share/perl/5.18.2/Jcode/Nihongo.pod
Installing /usr/local/man/man3/Jcode::Nihongo.3pm
Installing /usr/local/man/man3/Jcode.3pm
Appending installation info to /usr/local/lib/perl/5.18.2/perllocal.pod
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make install  -- OK

cpan[2]> Terminal does not support GetHistory.
Lockfile removed.
matically choose some CPAN mirror
sites for you? (This means connecting to the Internet) [yes] 
Trying to fetch a mirror list from the Internet
Fetching with LWP:
http://www.perl.org/CPAN/MIRRORED.BY

Looking for CPAN mirrors near you (please be patient)
.......................... done!

New urllist
  http://cpan.develooper.com/
  http://mirrors.gossamer-threads.com/CPAN/
  http://mirror.team-cymru.org/CPAN/

Autoconfiguration complete.

commit: wrote '/home/satoshi/.cpan/CPAN/MyConfig.pm'

You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.

cpan[1]> install Jcode
Fetching with LWP:
http://cpan.develooper.com/authors/01mailrc.txt.gz
Reading '/home/satoshi/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
http://cpan.develooper.com/modules/02packages.details.txt.gz
Reading '/home/satoshi/.cpan/sources/modules/02packages.details.txt.gz'
  Database was generated on Tue, 09 Sep 2014 13:53:17 GMT
..............
  New CPAN.pm version (v2.05) available.
  [Currently running version is v2.00]
  You might want to try
    install CPAN
    reload cpan
  to both upgrade CPAN.pm and run the new version without leaving
  the current session.


..............................................................DONE
Fetching with LWP:
http://cpan.develooper.com/modules/03modlist.data.gz
Reading '/home/satoshi/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /home/satoshi/.cpan/Metadata
Running install for module 'Jcode'
Running make for D/DA/DANKOGAI/Jcode-2.07.tar.gz
Fetching with LWP:
http://cpan.develooper.com/authors/id/D/DA/DANKOGAI/Jcode-2.07.tar.gz
Fetching with LWP:
http://cpan.develooper.com/authors/id/D/DA/DANKOGAI/CHECKSUMS
Checksum for /home/satoshi/.cpan/sources/authors/id/D/DA/DANKOGAI/Jcode-2.07.tar.gz ok
Scanning cache /home/satoshi/.cpan/build for sizes
DONE

  CPAN.pm: Building D/DA/DANKOGAI/Jcode-2.07.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Jcode
Writing MYMETA.yml and MYMETA.json
cp Jcode/Nihongo.pod blib/lib/Jcode/Nihongo.pod
cp Jcode.pm blib/lib/Jcode.pm
Manifying blib/man3/Jcode::Nihongo.3pm
Manifying blib/man3/Jcode.3pm
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/append.t ... ok     
t/convert.t .. ok     
t/getcode.t .. ok   
t/h2z.t ...... ok   
t/jfold.t .... ok   
t/length.t ... ok   
t/mime.t ..... ok     
t/new.t ...... ok     
t/perl581.t .. ok   
t/regex.t .... ok   
t/tr.t ....... ok     
All tests successful.
Files=11, Tests=244,  1 wallclock secs ( 0.08 usr  0.01 sys +  1.20 cusr  0.02 csys =  1.31 CPU)
Result: PASS
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make test -- OK
Running make install
Manifying blib/man3/Jcode::Nihongo.3pm
Installing /usr/local/share/perl/5.18.2/Jcode.pm
Installing /usr/local/share/perl/5.18.2/Jcode/Nihongo.pod
Installing /usr/local/man/man3/Jcode::Nihongo.3pm
Installing /usr/local/man/man3/Jcode.3pm
Appending installation info to /usr/local/lib/perl/5.18.2/perllocal.pod
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make install  -- OK

cpan[2]> Terminal does not support GetHistory.
Lockfile removed.

はい! 無事作業が終わって、コードは動きましたとさ。

しかし、ちょっと前まで、使っていたはずなのになぁ。
ボケてきたんだろうか?

コメント

このブログの人気の投稿

Ubuntu24.04 でGUIが死んだ

VirtualBoxが異常

MEGAにも弱点があった?