Ubuntuのインストール
ubuntu ver16.04
- Install Ubuntu Server
- Select a language -> English
- Select your location -> Other,Asia,Japan
- Configure locales -> United States
- Configure key board -> Japanese
- Configure Network -> esnp02
- hostname -> ubuntu05
- Set up users and passwords -> enter full name
- Set up users and passwords -> enter username
- Set up users and passwords -> enter password
- Encrypt your home directory? -> No
- Configure clock -> Asia/Tokyo
- Partition disks -> Use entire disks
- Configure the package manager -> pass proxy
- Configuring tasksel -> No automatic updates
- Software selection -> DNS server, standard system utilities, OpenSSH server
ネットワークの設定
sshが入っていることを確認
root@ubuntu:~$ which ssh
/usr/bin/ssh
静的IP設定
IPを確認
root@ubuntu:~$ ifconfig
enp2s0 Link encap:Ethernet HWaddr 70:85:c2:4a:5f:1b
inet addr:192.168.1.6 Bcast:192.168.1.255 Mask:255.255.255.0 #ここをメモ
inet6 addr: fe80::7285:c2ff:fe4a:5f1b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1707 errors:0 dropped:88 overruns:0 frame:0
TX packets:460 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:255363 (255.3 KB) TX bytes:66860 (66.8 KB)
Memory:92d00000-92d1ffff
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:175 errors:0 dropped:0 overruns:0 frame:0
TX packets:175 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:12937 (12.9 KB) TX bytes:12937 (12.9 KB)
gatewayの確認
root@ubuntu:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.21 0.0.0.0 UG 0 0 0 enp2s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp2s0
nameserverの確認
root@ubuntu:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.21
hostsの編集
- hostsを開く
sudo vi /etc/network/interfaces
- 該当箇所を以下のように編集
# The primary network interface
auto enp2s0
iface enp2s0 inet static
address 192.168.1.6
netmask 255.255.255.0
gateway 192.168.1.21
dns-nameservers 192.168.1.21
hostname確認
# 現在のホスト名を表示
root@ubuntu:~$ hostname
ubuntu
-
変更するとき
-
ホスト名 を
gpu04のように指定。root@ubuntu:~$ hostname -b gpu04- /etc/hosts に
127.0.0.1 gpu04のように追加
-
DNSサーバ設定
- /etc/resolve.conf に以下指定
nameserver 192.168.1.21
- /etc/resolve.conf に以下指定
最新化
apt-get dist-upgrade
hostnameで入れるようにする
localで
localhost:~$ sudo vi /etc/hosts
以下を追加
IPaddress hostname
初期ユーザー登録
adduser s-wada
adduser y-koba
sudo権限つける。もともと sudo という(wheelのような)ユーザーがいる。
usermod -aG sudo s-wada
usermod -aG sudo y-koba
参考
https://qiita.com/shishamo_dev/items/3602c41f143c08fadb1a
https://webkaru.net/linux/ubuntu-14-04-lts-install/
https://jyn.jp/ubuntu-localip-static/
https://www.server-world.info/query?os=Ubuntu_16.04&p=hostname