金子邦彦研究室インストールLinux のインストールRaspberry Pi Desktop (for PC and Mac)のおすすめ初期設定

Raspberry Pi Desktop (for PC and Mac)のおすすめ初期設定

Raspberry Pi Desktop (for PC and Mac) は,Debian ベース.軽量である. このページでは,おすすめ初期設定について説明する.

目次

  1. システムの更新
  2. NTPによる時刻合わせの有効化
  3. タイムゾーンとロケール
  4. システムの自動更新
  5. SSH キーの再生成
  6. 日本語設定
  7. ソフトウェアの削除例
  8. /etc/rsyslog.conf でログの抑止
  9. 運用保守用ツール net-tools, pciutils のインストール

サイト内の関連 Web ページ:

システムの更新

  1. /etc/apt/sources.list の書き換え
  2. システムを更新したいので,次のコマンドを実行.
    sudo apt -y update
    sudo apt -yV upgrade
    sudo apt -yV dist-upgrade
    sudo rpi-update
    sudo apt -yV autoremove
    sudo apt autoclean
    

    実行結果例

    [image]
  3. 1分ほど待つ
  4. システムの再起動
    sudo shutdown -r now
    

NTPによる時刻合わせの有効化

sudo apt install ntp
sudo apt install tzdata ntpdate
sudo service ntp stop
sudo /usr/sbin/ntpdate ntp.jst.mfeed.ad.jp
sudo /usr/sbin/service ntp start
sleep 5 
sudo timedatectl set-ntp true

[image]

タイムゾーンとロケール

sudo timedatectl set-timezone Asia/Tokyo
export LANG=ja_JP.UTF-8 
export LC_ALL=ja_JP.UTF-8 
export LANGUAGE=ja_JP.UTF-8 
sudo sed -i 's/# ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/g' /etc/locale.gen
sudo locale-gen
sudo update-locale LANG=ja_JP.UTF-8
sudo dpkg-reconfigure -f noninteractive locales 
sudo /usr/sbin/update-locale LANG=$LANG LC_ALL=$LANG

実行結果例

[image]

システムの自動更新

次のコマンドを実行.

sudo apt -y update
sudo apt -y install unattended-upgrades

実行結果例

[image]

SSH キーの再生成

次のコマンドを実行.

sudo rm /etc/ssh/ssh_host*
sudo dpkg-reconfigure openssh-server

実行結果例

[image]

日本語設定

sudo apt -y update
sudo apt -y install fcitx-config-common fcitx-mozc
sudo apt -y install zenity
im-config -n fcitx
sudo apt -y install fcitx-config-gtk
sed -i "/EnabledIMList/s/mozc:False/mozc:True/g" ~/.config/fcitx/profile
fcitx-configtool mozc

実行結果例

[image]

ソフトウェアの削除例

sudo apt purge wolfram-engine
sudo apt purge libreoffice
sudo apt purge mozc-server
sudo apt purge mozc-data mozc-utils-gui
sudo apt purge fcitx
sudo apt purge fcitx-data fcitx-bin fcitx-modules
sudo apt -yV autoremove
sudo apt autoclean

/etc/rsyslog.conf でログの抑止

sudo cp /etc/rsyslog.conf /etc/rsyslog.conf.DIST
sudo rm -f /tmp/1
cat /etc/rsyslog.conf | sed 's/^auth/#auth/g' | sed 's/^daemon/#daemon/g' | sed 's/^kern/#kern/g' | sed 's/^lpr/#lpr/g' | sed 's/^user/#user/g' | sed 's/^mail/#mail/g' > /tmp/1
sudo cp /tmp/1 /etc/rsyslog.conf 

運用保守用ツール net-tools, pciutils のインストール

# ifconfig などが欲しい
sudo apt -y install net-tools pciutils

[image]