Linux

Quote from wikipedia.org

Linux (Listeni/ˈlɪnəks/ lin-əks[5][6] or /ˈlɪnʊks/ lin-uuks)[7][8][9] is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of Linux is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds.[10][11]

Linux was originally developed as a free operating system for Intel x86-based personal computers. It has since been ported to more computer hardware platforms than any other operating system. It is a leading operating system on servers and other big iron systems such asmainframe computers and supercomputers:[12][13][14][15] more than 90% of today’s 500 fastest supercomputers run some variant of Linux,[16]including the 10 fastest.[17] Linux also runs on embedded systems (devices where the operating system is typically built into the firmware and highly tailored to the system) such as mobile phonestablet computers, network routerstelevisions[18][19] and video game consoles; theAndroid system in wide use on mobile devices is built on the Linux kernel.

The development of Linux is one of the most prominent examples of free and open source software collaboration: the underlying source codemay be used, modified, and distributed—commercially or non-commercially—by anyone under licenses such as the GNU General Public License. Typically Linux is packaged in a format known as a Linux distribution for desktop and server use. Some popular mainstream Linux distributions include Debian (and its derivatives such as Ubuntu), Fedora and openSUSE. Linux distributions include the Linux kernel, supporting utilities and libraries and usually a large amount of application software to fulfill the distribution’s intended use.

A distribution oriented toward desktop use will typically include the X Window System and an accompanying desktop environment such asGNOME or KDE Plasma. Some such distributions may include a less resource intensive desktop such as LXDE or Xfce for use on older or less powerful computers. A distribution intended to run as a server may omit all graphical environments from the standard install and instead include other software such as the Apache HTTP Server and an SSH server such as OpenSSH. Because Linux is freely redistributable, anyone may create a distribution for any intended use. Applications commonly used with desktop Linux systems include the Mozilla Firefoxweb browser, the LibreOffice office application suite, and the GIMP image editor.

Since the main supporting user space system tools and libraries originated in the GNU Project, initiated in 1983 by Richard Stallman, the Free Software Foundation prefers the name GNU/Linux.[20][21]

List of Linux distributions

Linux distributions I’ve been using
Ubuntu – Desktop
Ubuntu – Server
Fedora – Desktop

Currently testing
CentOS

Checklist of setting up my CentOS server

  • Network configuration
  • yum update
  • webmin installation
  • firewall configuration
  • DNS Server installation, firewall accept 53 port connections
  • Apache installation
  • Setting Up Apache Virtual Hosts
  • PHP installation
  • MySQL configuration

YUM commands

yum update

更新套件, ex: yum update httpd,如果只有 yum update ,會更新所有已經安裝的套件。
yum search

搜尋套件,ex: yum search httpd*,會搜尋所有跟 httpd 有關的套件。
yum install

安裝套件,這裡的套件安裝,會考慮到相依性的問題。 ex: yum install httpd
yum remove

移除套件,這裡的套件移除,也會考慮到相依性的問題。 ex: yum remove httpd
yum clean

清除安裝時下載的暫存套件原始檔案,位於 /var/cache/yum,因為這裡可以清除的項目很多,我最常用的是 yum clean all ,一次給他清掉 :p
yum list

列出套件名稱,用法常用有分以下幾種:
yum list updates

列出所有可以更新的套件
yum list installed

列出所有已安裝的套件

以下是一些實用的 netstat 語法,可以檢查主機的連線數量:

netstat -na
顯示主機上所有已建立的連線。

netstat -an | grep :80 | sort
顯示所有 port 80 的連線,並把結果排序。

netstat -n -p|grep SYN_REC | wc -l
列出主機上有多少個 SYNC_REC,一般上這個數字應該相當低。

netstat -n -p | grep SYN_REC | sort -u
同樣是列出 SYNC_REC,但不只列出數字,而是將每個 SYNC_REC 的連線列出。

netstat -n -p | grep SYN_REC | awk '{print $5}' | awk -F: '{print $1}'
列出發送 SYNC_REC 的所有 ip 地址。

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
計算每一個 ip 在主機上建立的連線數量。

netstat -anp |grep 'tcp|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
列出從 TCP 或 UDP 連線到主機的 ip 的數量。

netstat -ntu | grep ESTAB | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
列出每個 ip 建立的 ESTABLISHED 連線數量。

netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1
列出每個 ip 建立的 port 80 連線數量。