LoginSignup
2
2

More than 3 years have passed since last update.

Ubuntu16.04 インストール後の初期設定メモ

Last updated at Posted at 2017-10-31

はじめに

このドキュメントは Ubuntu16.04 をインストールしたあとに、まずはじめに実施する初期設定をまとめたものです。

おことわり

  • 作業は root で実行してます。
  • 個人的な好みであることをご承知おきください。

パッケージ関連

アップデート

~#
~# apt update
~# apt upgrade -y 
~# apt full-update -y 
~# apt autoremove -y
~# apt autoclean
~# apt clean
~#
~#
~# apt update && apt upgrade -y && apt full-upgrade -y  && apt autoremove -y && apt autoclean && apt clean
~#

不要なカーネルファイルを削除

~#
~# dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
~#

こちらのQiita記事を参考にさせていただきました。

追加パッケージ

~#
~# apt-get install -y aptitude
~# apt-get install -y curl dnsutils tree lsof
~# apt-get install -y zip unzip
~# apt-get install -y mailutils
~# apt-get install -y tree
~# apt-get install -y lsb-release
~# apt-get install -y man manpages-ja manpages-ja-dev
~#
~#
~# apt-get install -y aptitude curl dnsutils tree lsof zip unzip mailutils tree lsb-release man manpages-ja manpages-ja-dev
~#

設定変更

ipv6無効化

~#
~# cat <<EOF >> /etc/sysctl.conf

# Disable IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

EOF
~# 
~# sysctl -p
~#

SSHサーバー

~#
~# apt-get install -y openssh-server
~#
~# systemctl restart ssh
~# systemctl enable ssh
~#

NTPサーバー

~#
~# vi /etc/systemd/timesyncd.conf
 :
[Time]
NTP=ntp.nict.jp ntp.jst.mfeed.ad.jp
 :
~#
~# systemctl start systemd-timesyncd
~#
~# systemctl enable systemd-timesyncd
~#

timezone変更

~#
~# rm -rf /etc/localtime
~# ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
~# date
2017年 10月 13日 金曜日 00:29:30 JST
~#

locale変更

~#
~# dpkg-reconfigure locales
~#

デフォルトエディタを変更

~# update-alternatives --config editor
There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    10        manual mode

Press <enter> to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode
~#

その他

IPアドレス固定

~# 
~# vi /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.X.X
    network 192.168.X.0
    netmask 255.255.255.0
    broadcast 192.168.X.255
    gateway 192.168.X.254
    dns-nameservers 192.168.X.254
~# 

apt関連

add-apt-repository を使えるようにする

~# 
~# apt-get install apt-file
~# apt-get install software-properties-common
~#
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2