Debian

Debian Linux
Intall 全般について

Debian 5 (lenny) からDebian 6 (squeeze) へのアップグレード 

ファイル /etc/apt/sources.list の中で lenny をsqueezeへ変更して、apt-get update -> apt-get upgrade を実行します

その後システム全体のアップグレード  # apt-get dist-upgrade

 

Debian 6 (squeeze) から7 (wheezy)へアップグレード

Debian 6 を最新にアップデイトと現状のバックアップ  

さらにパッケージの状態を確認   # dpkg --audit  # dpkg -l | more  などで

APTの取得先を変更 /etc/apt/sources.list ファイルを編集し squeeze を wheezy へ変更 以下の行を追加します。

 deb http://mirrors.kernel.org/debian wheezy main contrib

システムの最小アップグレード  # apt-get update  # apt-get upgrade

その後、システム全体のアップグレード  # apt-get dist-upgrade

もし 「パッケージパッケージ」の即時設定は動作しません。詳細については man 5 apt.conf の APT::Immediate-Configure の項を参照してください  というエラーが起きたら以下のコマンドを入力します。

 # apt-get dist-upgrade -o APT::Immediate-Configure=0

その他アップグレードで障害が起きた場合はDebianサイトで詳細確認 ここから

 

※2014年1月、Debian 6 (squeeze) から7 (wheezy)へアップグレードした際に、以下の現象が起こりました。

apache2 の hppd.conf という空ファイルができていない事でapache2が起動しなかった

PHPで以下の警告が出たので、 suhosin モジュールを削除 apt-get purge php5-suhosin

Postfix起動時に警告 unused parameter: mynetwork_style=subnet が表示されたので、/etc/postfix/main.cf  で mynetwork_style の行をコメントに設定してPostfix 再起動

 

Debian 7 (wheezy) から 8 (jessie)へアップグレード

Debian 7 を最新にアップデイトと現状のバックアップ  

さらにパッケージの状態を確認   # dpkg --audit  # dpkg -l | more  などで

APTの取得先を変更 /etc/apt/sources.list ファイルを編集し wheezy を jessie へ変更 以下の行を追加します。

 deb http://mirrors.kernel.org/debian jessie main contrib

システムの最小アップグレード  # apt-get update  # apt-get upgrade

その後、システム全体のアップグレード  # apt-get dist-upgrade

その他アップグレードで障害が起きた場合はDebianサイトで詳細確認 ここから

 

Debian 8 (jessie) から 9 (stretch)へアップグレード

Debian 8を最新にアップデイトと現状のバックアップ  

 アップデイトは # apt-get update   # apt-get upgrade   # apt-get dist-upgrade

さらにパッケージの状態を確認   # dpkg --audit  # dpkg -l | more  などで

APTの取得先を変更 /etc/apt/sources.list ファイルを編集し jessie を stretch へ変更 以下の行を追加します。

 deb http://mirrors.kernel.org/debian stretch main contrib

システムの最小アップグレード  # apt-get update  # apt-get upgrade   

その後、システム全体のアップグレード  # apt-get dist-upgrade

reboot してアップグレードしたことを確認  $ uname -mrs   $ lsb_release -a

注意事項: 

Apache MySQL PHPがjessieの環境を以降できない現象が起きた場合は、モジュールの設定ファイルをバックアップし、モジュールごとに削除、インストールを行ないます。

その他アップグレードで障害が起きた場合はDebianサイトで詳細確認 ここから

 

Debian 9 (stretch)新規インストール

aptのsources.listファイルの設定(2019年6月17日現在)

/etc/apt/sources.list

deb http://ftp.jp.debian.org/debian stretch main contrib non-free
deb-src http://ftp.jp.debian.org/debian stretch main contrib non-free
deb http://security.debian.org/ stretch/updates main contrib non-free
deb-src http://security.debian.org/ stretch/updates main contrib non-free

 

Debian 10 buster 新規インストール

/etc/apt/sources.listファイルの設定(Debian 10.1.0 2019年10月5日現在)

deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main
deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main
# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main
deb-src http://deb.debian.org/debian/ buster-updates main 

 

さくらのクラウドでDebian 9からDeian10へアップグレードする場合、必須ではないけどJPサイトを指定しました。contrib non-free も追加した場合。

既存のパッケージの状態を確認します。 sudo dpkg --audit   何も結果がなければ問題がないのでOKです。

現状の /etc/apt/sources.list で特別なレポジトリがあるか確認します。

stretch -> buster へ書き換え

sed -i -e 's/stretch/buster/' /etc/apt/sources.list

deb http://ftp.riken.jp/Linux/debian/debian/ buster main contrib non-free
deb-src http://ftp.riken.jp/Linux/debian/debian/ buster main contrib non-free
deb http://security.debian.org/debian-security buster/updates main contrib non-free
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
deb http://ftp.riken.jp/Linux/debian/debian/ buster-updates main contrib non-free
deb-src http://ftp.riken.jp/Linux/debian/debian/ buster-updates main contrib non-free

以下のコマンド実行、apt update 実行でレポジトリの取得エラーなどがないか確認します。エラーの場合は別のレポジトリに変更します。

apt update
apt autoremove
apt clean
apt-get upgrade
apt full-upgrade

apt-get upgradeを実行後、minissdpdパッケージを使うかどうか聞いてきました。使わない設定が良いと思います。途中でminissdpdパッケージをapt purgeしました。その後upgradeを実行し、full-upgrade を実行

※参考にしたサイト:https://sysrigar.com/2020/02/22/debian%E3%82%929stretch%E3%81%8B%E3%82%8...

 

◆ さくらのクラウドでDebian10からDeian11へアップグレードする場合

既存のパッケージの状態を確認します。 sudo dpkg --audit   何も結果がなければ問題がないのでOKです。

現状の /etc/apt/sources.list で特別なレポジトリがあるか確認します。

buster -> bullseye へ書き換え

sed -i -e 's/buster/bullseye/' /etc/apt/sources.list

sedコマンド実行後に deb http://security.debian.org/debian-security buiiseye/updates mainなどになっている場合は、  bullseye-security main に修正します。

deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main
deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main
deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main

アップグレードコマンド

apt update
apt upgrade --without-new-pkgs
apt full-upgrade

※参考にしたサイト:https://sysrigar.com/2021/08/21/debian-10-buster%E3%81%8B%E3%82%8911-bul...

 

Debian 11 bullseye 新規インストール

/etc/apt/sources.listファイルの設定(Debian 11.1.0 2022年4月1日現在)

deb http://ftp.jp.debian.org/debian/ bullseye main
deb-src http://ftp.jp.debian.org/debian/ bullseye main
deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main
deb http://ftp.jp.debian.org/debian/ bullseye-updates main
deb-src http://ftp.jp.debian.org/debian/ bullseye-updates main

 

Debian 11 での non-free contribute pacakges は

deb http://ftp.jp.debian.org/debian/ bullseye main contrib non-free
deb-src http://ftp.jp.debian.org/debian/ bullseye main contrib non-free
deb http://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free
deb http://ftp.jp.debian.org/debian/ bullseye-updates main contrib non-free
deb-src http://ftp.jp.debian.org/debian/ bullseye-updates main contrib non-free

 

◆ さくらのクラウドでDebian11からDeian12へアップグレードする場合

bullseye --> bookworm  へ書き換え

sed -i -e 's/bullseye/bookworm/' /etc/apt/sources.list

さくらのクラウドで運用する場合の /etc/apt/sources.list 

deb http://ftp.jp.debian.org/debian/ bookworm main
deb-src http://ftp.jp.debian.org/debian/ bookworm main
deb http://security.debian.org/debian-security bookworm-security main
deb-src http://security.debian.org/debian-security bookworm-security main
deb http://ftp.jp.debian.org/debian/ bookworm-updates main
deb-src http://ftp.jp.debian.org/debian/ bookworm-updates main

contrib non-free-firmwareのレポジトリを追加した場合の /etc/apt/sources.list 

deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware

アップグレードコマンド

apt update
apt upgrade --without-new-pkgs
apt full-upgrade

 

 

Debian 10 Buster

サスペンド設定

再起動後20分程度でシステムが止まって(サスペンド)しまう現象。この現象は、デスクトップ環境をインストールした場合に影響すると思われます。インストールするデスクトップ環境によっては、設定内容がことなると思います。

参考にしたページ: https://qiita.com/ikesama200/items/f595293de82ddc9fa3f1

GUIからはサスペンド設定が変更できないので、以下のファイルを修正します。

/usr/share/gdm/dconf/90-debian-settings -> /etc/gdm3/greeter.dconf-defaults

リンク元の /etc/gdm3/greeter.dconf-defaults を編集して、最終行に追加

sleep-inactive-ac-timeout = 0
sleep-inactive-battery-timeout = 0

システムを再起動して20分でサスペンドしないか確認します。

 

サスペンド、スリープ、ハイバネ―トコマンド

  • ハイブリッドスリープ sudo systemctl hybrid-sleep
  • ハイバネ―ト sudo systemctl hibernate
  • サスペンド sudo systemctl suspend

 

 

Debian 8(Jessie) 以降のサスペンド設定

概要: https://wiki.debian.org/Suspend

サスペンドおよびハイバネーションを無効にする場合

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

実行例(debian9):$ sudo 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.

上記を有効化する場合

sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

設定した内容でシステムを有効化

systemctl restart systemd-logind.service  または リブート

 

Debian 11 bullseye でサスペンドを無効

参考にしたサイト https://takuya-1st.hatenablog.jp/entry/2021/11/26/172528

スリープを無効にする場合

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

 

Apacheについて

Debian 7 (wheezy) から 8 (jessie)へアップグレード

Debian 8 からApacheのバージョンが2.4になりました。Debian 7の2.2から大幅に違います。

Apacheの設定ファイルの変更

Order allow,denyは使えないので、下記のように修正する

# Order allow,deny
Require all granted

 

/etc/apache2/sites-availableにある設定ファイル全ての最に「.conf」を付ける

既存の設定をバックアップし、a2dissite * で活性化されているサイト全てを非活性にする

サイトを活性化する a2ensite *

Apacheを再起動

 

 

Debianコマンド

addgroup  参照サイト ここから

・Groupの追加
   #addgroup hogehoge
・グループIDを指定する場合は、
   #addgroup --gid 1200 hogehoge

・Groupの削除
   #delgroup hogehoge

adduser  参照サイト ここから

・ユーザーの追加
   #adduser hoge
   ホームディレクトリなども作成してくれます。
   またデフォルトで必要なファイルは、/etc/skel/内のファイルがホームディレクトリへコピーされます。
・UIDを指定する
   #adduser --uid 1200 hoge
・グループを指定する場合。
   #adduser --ingroup hogehoge hoge
・ホームディレクトリを指定する
   #adduser --ingroup hogehoge --home /home/hogehoge

・システムユーザー(ログインできないユーザー)を作成する。
   #adduser --system hoge
・グループを指定する場合
   #adduser --system --ingroup hogehoge hoge
・ホームディレクトリを指定する
   #adduser --system --ingroup hogehoge --home /var/hoge hoge
・ホームディレクトリを作らない
   #adduser --system --ingroup hogehoge --no-create-home hoge

・ユーザーの削除
   #deluser hoge
   *ホームディレクトリは残ります。
・ホームディレクトリも同時に削除する。
   #deluser --remove-home hoge
・ホームディレクトリも含む、関係する全てのファイルも同時に削除する。
   #deluser --remove-all-files hoge

GroupとUserの設定  参照サイト ここから

ユーザー"hoge"で、サウンドデバイスを利用したい場合は、"hoge"を"audio"グループに含める必要があります。

/etc/groupを直接編集する場合は、以下のようになります。
audio:x:29:hoge,hoge2
*複数のユーザーを記述する場合は、カンマで区切ります。

コマンドを利用する場合は、
#adduser hoge audio

 

・ データベース

・ PHP言語

DNSサーバー

その他(運用について)

 

FAQ
  • tightvncserver でキーボード設定がおかしいので入力できない

このサイトで以下のコマンドを使って、GNONEのキーボードマッピングを新規(aa)に設定します。 ただし、日本語変換などは別途設定しないと動かないようです。 取り合えず英語モードでは使えました。

gconftool --set /desktop/gnome/peripherals/keyboard/kbd/layouts --type List --list-type String [aa]

 

  • sudoコマンドを実行すると、sudo: unable to resolve host ホスト名 というワーニングが表示

ホスト名の名前解決で問題がある場合が多いので、 /etc/hosts ファイルを編集します。

127.0.1.1 ホスト名.localdomain ホスト名.localdomain  を

127.0.1.1 ホスト名.localdomain ホスト名   に修正します。

 

  • アップデイトでソースリストの取得に失敗する場合

/etc/apt/sources.List ファイルに以下のサイトから取得したサンプルを書き込み、アップデート

http://debgen.simplylinux.ch/

 

  • SECURITY information for xxx,  unable to resolve host xxx   などの警告が出る場合

/etc/hosts   および /etc/resolv.conf    でホスト名やドメイン名の設定が間違っている場合がありますので、修正します。

 

  • ユーザ追加するとコマンドヒストリーなどが使えない場合

Debian 6 の頃からのようですが、useraddコマンドで作成したユーザはコマンドヒストリが使えない、adduserコマンドで作成するとOKです。

 

  • aptコマンドで「壊れた変更禁止パッケージがあります」エラーにaptitudeで対処する

参考にしたサイト: http://minus9d.hatenablog.com/entry/2017/07/19/213801

aptitudeコマンドで、改善案を探しながら、一つ前のバージョンに戻ったり、その時の状況にあわせて、数回、繰り返すと、解決する場合があります。

 

  • aptコマンドで「以下のパッケージは保留されます」に対処する

参考にしたサイト: http://itengine.seesaa.net/article/454359986.html

 sudo apt-get update
 sudo apt-get upgrade
 sudo apt-get -s dist-upgrade
 sudo apt-get dist-upgrade

 

 

タグ: 

オープンソースソフトウェア: