LoginSignup
0
0

debian12 環境設定 再度新しいPCにインストールする

Last updated at Posted at 2023-12-13

APIのまとめに戻る

バージョンが古すぎてURLが変わっているか削除されているために文字化けが解消できませんでした。
この際新しいバージョンをインストールしました。問題なくインストールできました。
debian 9だとネットワークチップの問題もありましたが、12は同じPCなのに何にも問題なくインストールが完了です。メモリーも4GB✕2にしたので使ってみたところ快適ですね。

過去の設定など

まずは、自分のPCから作業できるようにtelnetサービスを起動させます。

  • telnet サーバー
apt-get install telnetd -y

以下を確かめたら、エラーだな。

systemctl status inetd

Unit inetd.service could not be found.

apt-get update
apt install xinetd telnetd telnet -y

telnetを接続しようとすると接続拒否になるなぁ。

これを見ると/etc/inetd.conf に設定がいるみたい。
今機能しているサーバーをみるとありますね。

では、同じ設定を追加します。

telnet      stream  tcp nowait  telnetd /usr/sbin/tcpd  /usr/sbin/in.telnetd

しかし起動しませんね。/usr/sbin/in.telnetdを探すけどない?
何故か 代わりに/usr/sbin/telnetd がある。ということで書き換えます。

telnet      stream  tcp nowait  telnetd /usr/sbin/tcpd  /usr/sbin/telnetd

PCを再起動して、再度接続すると... おおお繋がりますね。

syslogを見るとちゃんと接続されています。

Dec 12 11:02:52 debian xinetd[711]: added service telnet [file=/etc/inetd.conf] [line=40]
Dec 12 11:06:18 debian telnetd[2553]: connect from 192.168.0.68 (192.168.0.68)

勝手にサスペンドします。

画面から設定を変えたのですが、サスペンドしますね。別のpCから接続していると落ちます。

root@debian:~# systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
Created symlink /etc/systemd/system/sleep.target -> /dev/null.
Created symlink /etc/systemd/system/suspend.target -> /dev/null.
Created symlink /etc/systemd/system/hibernate.target -> /dev/null.
Created symlink /etc/systemd/system/hybrid-sleep.target -> /dev/null.

止めたはずなのに...

The system will suspend now!

I found the solution. This method works better and doesn't have the spurious message on connected SSH clients.

Create /etc/systemd/sleep.conf.d/nosuspend.conf as

[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no

They should probably edit the documentation and swap both solution so this one is the first one and not marked as an "alternative"

必要なコマンドをインストールしていきます。

  • curl
apt -y install curl 
  • ftpサーバー
apt install -y vsftpd

vi /etc/vsftpd.conf

上の階層へ移動を許可するユーザーを行毎に列挙
vi /etc/vsftpd.chroot_list

vsftpdを有効にして再起動します。

systemctl enable vsftpd
systemctl restart vsftpd

今回は社内なのでsshは不要かな?<-- scpを使ってコピーしたいので必要です 2023/12/13

  • ssh
apt -y install ssh
  • sshの設定変更
vi /etc/ssh/sshd_config
  • ssh再起動
systemctl restart ssh
  • VIMでなくて、VIになっていた
apt -y install vim

邪魔くさいなぁ、この機能は要らん。コピーできんだろうが...

image.png

.vimrcに以下を追加 - 忘れてちょっと悩みました。

set mouse-=a

viの文字の色が思った色でないんですよね。

.vimのフォルダーを丸ごとコピーたら解決です

  • ユーザの追加
adduser --shell /bin/bash --home /home/admin admin

必要なスプリクト類をコピー

まずは、1件だけ実験

scp 192.168.xx.xx:/home/admin/sfdc_common.txt /home/admin/sfdc_common.txt

ディレクトリーがある場合は -r オプションが必要

scp: download /home/admin/.vim/: not a regular file

scp -r  192.168.xx.xx:/home/admin/.vim /home/admin/

さらに追加のアプリを入れます。

そういえばphpのコマンド版を使ってjsonの解析してました...

  • apache2 をインストール
apt-get install apache2 

設定は
https://www.server-world.info/query?os=Debian_9&p=httpd&f=1

  • PHP関係
apt-get install php php-cgi libapache2-mod-php php-common php-pear php-mbstring php-cli

自作のコマンドがないので、テストができません。

/usr/local/bin/ に保存します

vsftpd

アップロードできません

vsftpd.confの修正が必要だった。

listen=YES
listen_ipv6=NO
local_enable=YES
write_enable=YES
ascii_upload_enable=YES
ascii_download_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list

再起動

systemctl restart vsftpd

python3

apt -y install python3
ln ./python3.11 ./python

Version 3だとエラーになる

count:
  File "/usr/local/bin/gyo", line 106
    if mode == "normal":        print n
                         ^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
column:

そういえば、debian9の時は2.7を使っていたな。

2.7をコンパイルしようとしたら...

gcc --version
-bash: gcc: command not found
apt install build-essential
apt-get install manpages-dev
gcc --version
gcc (Debian 12.2.0-14) 12.2.0
/configure
make
make install
/usr/local/bin# ls -la python
lrwxrwxrwx 1 root root 7 Jan 29 11:32 python -> python2*
/usr/local/bin# ls -la python2
lrwxrwxrwx 1 root root 9 Jan 29 11:32 python2 -> python2.7*

Pythonをソースからビルドした場合,ビルド時の環境によってはzlibモジュールが組み込まれないことがあるようです。 その場合には,以下のようなエラーメッセージが出力されます。

File "/usr/local/lib/python2.7/zipfile.py", line 549, in init
self._decompressor = zlib.decompressobj(-15)
AttributeError: 'NoneType' object has no attribute 'decompressobj'

apt-get install zlib1g-dev

awkで文字を切り出すと文字化けする

gawkを使えばいいらしいので、インストールしてシェルを変更すると機能しました。

apt -y install gawk 
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