Ubuntu18:初期設定

ネットワーク設定.

ネットワークを設定します。

root@www:~# vi /etc/netplan/01-netcfg.yaml

6行目以降を削除して下記を追加します。

# This file describes the network interfaces available on your 
# For more information, see netplan(5).
system
network:
  ethernets:
    enp2s0:
      dhcp4: no
      addresses: [192.168.1.3/24]
      gateway4: 192.168.1.1
      nameservers:
        addresses: [192.168.1.3,192.168.1.1]
      dhcp6: no
  version: 2

設定を有効にします。

root@www:~# netplan apply

ルーター設定

ルーターでDHCP固定IPアドレス設定ができる場合は「MACアドレス」、「サーバーIPアドレス」を設定します。

DHCP固定IPアドレス設定

MACアドレス(例:0c:2e:48:2b:dg:f4)

サーバーIPアドレス:192.168.1.3

一般ユーザーの作成

一般ユーザーを作成します。(初期設定では一般ユーザーは必要ありません。)

root@www:~# adduser 新しいユーザー名
...
新しい UNIX パスワードを入力してください: 新しいユーザーのパスワードを設定
新しい UNIX パスワードを再入力してください: 新しいユーザーのパスワードを確認入力
passwd: password updated successfully
Changing the user information for ubuntu
Enter the new value, or press ENTER for the default
Full Name []: #Enterキーを押下します。
Room Number []: #Enterキーを押下します。
Work Phone []: #Enterキーを押下します。
Home Phone []: #Enterキーを押下します。
Other []: #Enterキーを押下します。
以上で正しいですか? [Y/n] y

一般ユーザーの削除

ユーザーのみ削除する場合

root@www:~# sudo userdel ユーザー名

ホームディレクトリも削除する場合

root@www:~# sudo userdel -r ユーザー名

サービスの管理

サービスの一覧を表示します。

root@www:~# systemctl -t service

UNIT                         LOAD   ACTIVE SUB     DESCRIPTION
accounts-daemon.service      loaded active running Accounts Service
acpid.service                loaded active running ACPI event daemon
alsa-restore.service         loaded active exited  Save/Restore Sound Card State
apparmor.service             loaded active exited  LSB: AppArmor initialization
apport.service               loaded active exited  LSB: automatic crash report g
atd.service                  loaded active running Deferred execution scheduler
avahi-daemon.service         loaded active running Avahi mDNS/DNS-SD Stack
colord.service               loaded active running Manage, Install and Generate
console-setup.service        loaded active exited  Set console font and keymap
cron.service                 loaded active running Regular background program pr
cups.service                 loaded active running CUPS Scheduler
dbus.service                 loaded active running D-Bus System Message Bus
getty@tty1.service           loaded active running Getty on tty1
grub-common.service          loaded active exited  LSB: Record successful boot f
ifup@enp5s2.service          loaded active exited  ifup for enp5s2
irqbalance.service           loaded active running LSB: daemon to balance interr
iscsid.service               loaded active running iSCSI initiator daemon (iscsi
irqbalance.service           loaded active running LSB: daemon to balance interr
iscsid.service               loaded active running iSCSI initiator daemon (iscsi
keyboard-setup.service       loaded active exited  Set console keymap
kmod-static-nodes.service    loaded active exited  Create list of required stati
lightdm.service              loaded active running Light Display Manager
lvm2-lvmetad.service         loaded active running LVM2 metadata daemon
lvm2-monitor.service         loaded active exited  Monitoring of LVM2 mirrors, s
lxcfs.service                loaded active running FUSE filesystem for LXC
lxd-containers.service       loaded active exited  LXD - container startup/shutd
mdadm.service                loaded active running LSB: MD monitoring daemon
networking.service           loaded active exited  Raise network interfaces
NetworkManager-wait-online.service loaded active exited  Network Manager Wait On
NetworkManager.service       loaded active running Network Manager
ondemand.service             loaded active exited  LSB: Set the CPU Frequency Sc
open-iscsi.service           loaded active exited  Login to default iSCSI target
polkitd.service              loaded active running Authenticate and Authorize Us
rc-local.service             loaded active exited  /etc/rc.local Compatibility
resolvconf.service           loaded active exited  Nameserver information manage
rsyslog.service              loaded active running System Logging Service
rtkit-daemon.service         loaded active running RealtimeKit Scheduling Policy
setvtrgb.service             loaded active exited  Set console scheme
snapd.seeded.service         loaded active exited  Wait until snapd is fully see
speech-dispatcher.service    loaded active exited  LSB: Speech Dispatcher
ssh.service                  loaded active running OpenBSD Secure Shell server
systemd-fsck@dev-disk-by\x2duuid-cc5f2637\x2d7b84\x2d4b87\x2d9ab3\x2dc79ec67d568
systemd-journal-flush.service loaded active exited  Flush Journal to Persistent
systemd-journald.service     loaded active running Journal Service
systemd-logind.service       loaded active running Login Service
systemd-modules-load.service loaded active exited  Load Kernel Modules
systemd-random-seed.service  loaded active exited  Load/Save Random Seed
systemd-remount-fs.service   loaded active exited  Remount Root and Kernel File
systemd-sysctl.service       loaded active exited  Apply Kernel Variables
systemd-timesyncd.service    loaded active running Network Time Synchronization
systemd-tmpfiles-setup-dev.service loaded active exited  Create Static Device No
systemd-tmpfiles-setup.service loaded active exited  Create Volatile Files and D
systemd-udev-trigger.service loaded active exited  udev Coldplug all Devices
systemd-udevd.service        loaded active running udev Kernel Device Manager
systemd-update-utmp.service  loaded active exited  Update UTMP about System Boot
systemd-user-sessions.service loaded active exited  Permit User Sessions
ufw.service                  loaded active exited  Uncomplicated firewall
unattended-upgrades.service  loaded active running Unattended Upgrades Shutdown
upower.service               loaded active running Daemon for power management
user@1000.service            loaded active running User Manager for UID 1000
user@111.service             loaded active running User Manager for UID 111
whoopsie.service             loaded active running crash report submission daemo

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

60 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

表示を解除します。

q

サービスの起動設定の一覧を表示します。

root@www:~# systemctl list-unit-files -t service
UNIT FILE                                  STATE
accounts-daemon.service                    enabled
acpid.service                              disabled
alsa-restore.service                       static
alsa-state.service                         static
alsa-utils.service                         masked
anacron-resume.service                     enabled
anacron.service                            enabled
apport-forward@.service                    static
apt-daily-upgrade.service                  static
apt-daily.service                          static
atd.service                                enabled
autovt@.service                            enabled
avahi-daemon.service                       enabled
bluetooth.service                          enabled
bootlogd.service                           masked
bootlogs.service                           masked
bootmisc.service                           masked
brltty-udev.service                        static
brltty.service                             enabled
checkfs.service                            masked
checkroot-bootclean.service                masked
checkroot.service                          masked

表示を解除します。

q

システムを最新化

システムを最新化します。

root@www:~# apt -y update
root@www:~# apt -y upgrade

Vim(テキストエディタ)の設定

Vim(テキストエディタ)をインストールします。

root@www:~# apt -y install vim

vim の設定します。

root@www:~# vi ~/.vimrc

行番号を表示する(サーバー設定を行番号で説明いたします。)

set number

Sudo(root権限)のを設定

Sudo をインストールします。

root@www:~# apt -y install sudo

root権限を特定のユーザーに設定します。

root@www:~# visudo

最終行に追記します。

webmaster    ALL=(ALL)       ALL

コメント

タイトルとURLをコピーしました