[[OS関連]]
目次~
#contents
*概要 [#k404fb2f]
Ubuntu / Ubuntu server 22の初期設定

*ユーザ監視 [#n23fe83c]
**ユーザ登録 [#m4136288]
一般的なuseraddではなく、adduserコマンドを使用する。~

-書式
 # adduser [USERNAME]

-例
 # adduser osm
 Adding user `osm' ...
 Adding new group `osm' (1001) ...
 Adding new user `osm' (1001) with group `osm' ...
 Creating home directory `/home/osm' ...
 Copying files from `/etc/skel' ...
 New password: 
 Retype new password: 
 passwd: password updated successfully
 Changing the user information for osm
 Enter the new value, or press ENTER for the default
        Full Name []: osm        
        Room Number []: 
        Work Phone []: 
        Home Phone []: 
        Other []: 
 Is the information correct? [Y/n] y


**sudo権限付与 [#o9e62639]
visudoを用いて権限の付与を行う。~
デフォルトのエディタはviではないため、保存や終了は[Ctrl]+[キー]にて制御する。~

-書式
 # visudo
 
 /etc/sudoersが専用のモードで起動する

-追記内容(全権限を付与する例)
 [USERNAME] ALL=(ALL:ALL) ALL

*環境設定 [#hdc50a32]
**タイムゾーン設定 [#r9491dd8]

-JSTに設定
 $ sudo timedatectl set-timezone Asia/Tokyo

-タイムゾーンの表示
 $ sudo timedatectl
                Local time: Sun 2024-04-14 20:18:15 JST
            Universal time: Sun 2024-04-14 11:18:15 UTC
                  RTC time: Sun 2024-04-14 11:18:15
                 Time zone: Asia/Tokyo (JST, +0900)
 System clock synchronized: no
               NTP service: active
           RTC in local TZ: no

-タイムゾーンの一覧
 $ sudo timedatectl list-timezones

*動作設定 [#sffd6c95]
**ネットワーク設定 [#i84b2d86]
Ubuntu 22のネットワーク設定はnetplanを用いて行う。~
設定ファイルは/etc/netplanに格納されている。~
~
インストール直後には
推奨される手順としては、00-installer-config.yamlが生成されているが、これを元に固有設定を作ることが推奨されている。~

-設定ファイルの作成
 cd /etc/netplan
 cp 00-installer-config.yaml 99_config.yaml
 mv 00-installer-config.yaml 00-installer-config.bak


-設定の反映
 netplan apply

-エラー対応
--Error in network definition: expected mapping (check indentation)~
上記のエラーは設定ファイルのインデントが誤っている場合に発生するため、設定ファイルを見直す。~




***IPアドレスの変更 [#x55817c8]
/etc/netplanにある設定ファイルを修正する。

-/etc/netplan/99_config.yaml
 network:
  ethernets:
    ens160:
      addresses:
      - 192.168.103.131/16
      routes:
       - to: default
         via: 10.10.0.1
      nameservers:
        addresses:
        - 192.168.0.139
        search: []
    ens192:
      addresses:
      - 192.168.131.202/24
      nameservers:
        addresses: []
        search: []
  version: 2

以下のコマンドで変更を反映する。

 netplan apply



**時刻設定 [#te5fd029]

-現在の時刻
 # date
 Sat Feb  4 07:48:37 AM UTC 2023

-タイムゾーンの設定確認
 # timedatectl 
     Local time: Sat 2023-02-04 07:49:02 UTC
     Universal time: Sat 2023-02-04 07:49:02 UTC
     RTC time: Sat 2023-02-04 07:49:02
     Time zone: Etc/UTC (UTC, +0000)
     System clock synchronized: no
     NTP service: active
     RTC in local TZ: no

-タイムゾーンの変更
 # timedatectl set-timezone Asia/Tokyo

-変更結果の確認
 # timedatectl 
     Local time: Sat 2023-02-04 16:49:18 JST
     Universal time: Sat 2023-02-04 07:49:18 UTC
     RTC time: Sat 2023-02-04 07:49:18
     Time zone: Asia/Tokyo (JST, +0900)
     System clock synchronized: no
     NTP service: active
     RTC in local TZ: no
~
 # date
 Sat Feb  4 04:49:21 PM JST 2023

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS