はじめに
「ECS LIVA ZにDebian 9 stretchをインストール - Qiita」の続き
WindowsでDebian USBメモリ作成
- 「Debian を入手する/CD/USB ISO イメージ/HTTP を使って CD/DVD イメージをダウンロードする/公式の安定版 (stable)リリース用 CD/DVD イメージ/CD/amd64」から「debian-10.5.0-amd64-xfce-CD-1.iso」をダウンロード
- RufusでUSBメモリに書き込み
インストール
- USBメモリをLIVA Zに接続
- LANケーブルをACアダプタに近い方のポート「enp1s0」に接続、遠い方は「enp3s0」
- LIVA Zを起動
- 手順通りにインストール
- WebサーバとSSHサーバを追加
- インストール中のスクリーンショットは「/var/log/installer/*.png」に保存される
visudo
-
sudoを使えるように設定
$ su - # visudo # User privilege specification root ALL=(ALL:ALL) ALL igarashi ALL=(ALL:ALL) ALL
FileZilla
- 「アプリケーションメニュー/設定/Synaptic パッケージマネージャ」を起動
- 「filezilla」をインストール
- 「アプリケーションメニュー/インターネット/FileZilla」から起動できる
- 「サイト マネージャー/文字コード/自動検出」→「UTF-8 を強制」にすると日本語が文字化けしなくなった
- 参考
NullMaier
-
hosts設定
$ sudo nano /etc/hosts 127.0.0.1 localhost 127.0.1.1 debian.mkt.home debian 192.168.0.1 debian.mkt.home debian ...
「アプリケーションメニュー/設定/Synaptic パッケージマネージャ」を起動
-
「nullmailer」「mailutils」をインストール
- システムのメール名
- debian.mkt.home
- スマートホスト
- smtp.gmail.com smtp --auth-login --port=587 --starttls --user=your-name@gmail.com --pass=your-password
- システムのメール名
-
追加設定&動作確認
$ sudo sh -c "echo $(hostname --fqdn) > /etc/nullmailer/defaultdomain" $ sudo sh -c "echo 'target-email-address@your-domain.net' > /etc/nullmailer/adminaddr" $ echo "error" | NULLMAILER_NAME="Testsytem check" mail -s "This is just a test with nullmailer" "target-email-address@your-domain.net"
cron-apt
- 「アプリケーションメニュー/設定/Synaptic パッケージマネージャ」を起動
- 「cron-apt」をインストール
-
README
$ gzip -dc /usr/share/doc/cron-apt/README.gz | less
-
config
$ sudo nano /etc/cron-apt/config MAILON="always"(動作確認したら"upgrade"に変更する) SYSLOGON="always"(動作確認したら"upgrade"に変更する) MAILTO="root"
-
3-download
$ sudo nano /etc/cron-apt/action.d/3-download autoclean -y #dist-upgrade -d -y -o APT::Get::Show-Upgraded=true dist-upgrade -y -o APT::Get::Show-Upgraded=true
-
動作確認
$ sudo /usr/sbin/cron-apt
- 参考
cron-aptを設定しない場合に普段やること
- 「アプリケーションメニュー/設定/Synaptic パッケージマネージャ」を起動
- 「状態」ボタンを押す
- 「再読込」ボタンを押す
- 「インストール済み(アップグレード可能)」を選択
- 表示されたパッケージをCtrl + aで全選択
- 右クリックメニューで「アップグレード指定」を選択
- 「依存により要求された変更を追加しますか?」画面が表示されたら「マーク」ボタンを押す
- 「適用」ボタンを押す
- 「Apply」ボタンを押す
- 「インストール済み(自動削除可能)」を選択
- 表示されたパッケージをCtrl + aで全選択
- 右クリックメニューで「完全削除指定」を選択
- 「適用」ボタンを押す
- 「Apply」ボタンを押す
- 参考
SSHで鍵認証
-
WindowsのPowerShellで鍵作成
ssh-keygen Enter file in which to save the key (/Users/igarashi/.ssh/id_rsa): ←[ENTER]を入力 Enter passphrase (empty for no passphrase): ← パスフレーズを入力 Enter same passphrase again: ← パスフレーズを再入力
公開鍵「.ssh/id_rsa.pub」をDebianにFTPなどで転送
-
公開鍵を配置
$ cat id_rsa.pub >> ~/.ssh/authorized_keys $ chmod 0600 ~/.ssh/authorized_keys
-
パスワード認証を無効に
$ sudo nano /etc/ssh/sshd_config # To disable tunneled clear text passwords, change to no here! #PasswordAuthentication yes PasswordAuthentication no
-
サービス再起動
$ sudo systemctl restart sshd.service
-
WindowsのPowerShellでSSH接続
PS C:\Users\igarashi\.ssh> ssh igarashi@debian Enter passphrase for key 'C:\Users\igarashi/.ssh/id_rsa': ← パスフレーズを入力
-
WindowsのPowerShellでSSHトンネル作成
PS C:\Users\igarashi> ssh -L 5901:127.0.0.1:5901 -C -N igarashi@debian Enter passphrase for key 'C:\Users\igarashi/.ssh/id_rsa': ← パスフレーズを入力