當初在選 Linux server distribution 的時候,在 Archlinux, CentOS, Debian, Ubuntu Server 之間猶豫許久也看了很多比較的文章,最終選擇了 Ubuntu Server LTS 作為自己在使用 Linux Server distribution 的主力。
用了三年多的時間,也累積了一些經驗,總結在這裡,方便自己翻閱。
推薦 package 
vim 
git 
unattended-upgrades 
update-notifier-common 
openssh-server 
docker 
ufw 
 
upgrade system 1 2 ~$ apt-get  update && apt-get  upgrade  && apt-get  dist-upgrade ~$ apt-get  autoremove 
upgrade new release -bash: /bin/cp: Argument list too long 1 find ./soruce -name "*"  | xargs -i cp  {} /target 
ssh: packet_write_wait: Connection to IP  port 22: Broken pipe 1 ~$  sudo  vim /etc/ssh/ssh_config
1 2 3 Host  *    ServerAliveInterval  3600       ServerAliveCountMax  168  
1 ~$  sudo  systemctl restart sshd.service
copy ssh public key from local to server(remote machine) 很久以前會手動去跑這個流程,流程大致如下:
1 2 3 ~$  mkdir  -p ~/.ssh~$  touch  ~/.ssh/authorized_keys~$  cat  *pub* >> ~/.ssh/authorized_keys
後來在實驗室筆記看到這個用法:
1 ~$ ssh-copy -id  -i ~/.ssh/id_rsa.pub usename@targetipaddressordomainname  
add user to the “sudo” group 新建立的使用者
1 ~$  sudo  adduser <username> sudo 
已經存在的使用者
1 sudo  usermod -aG sudo  <username>
Reference 
set timezone to Asia/Taipei 1 sudo  timedatectl  set-timezone  Asia /Taipei 
or 手動選擇
Set Up an NTP Server (Network Time Protocol) 1 2 3 sudo apt-get  install ntp  sudo service ntp  restart 
NTP Server 可以使用國家標準實驗室提供的
tock.stdtime.gov.tw
 
或者 Google Public NTP
time1.google.com
 
clear DNS cache 1 ~$  sudo  /etc/init.d/dns-clean restart
change the hostname 清空 memory cache 1 ~$  free -m && sync  && echo  3 > /proc/sys/vm/drop_caches && free -m 
Time Synchronization 1 2 3 ~$  service ntp stop ~$  ntpdate -s  time.google.com ~$  service ntp start