「Ubuntu Server 安裝步驟」:修訂間差異

出自DILA Wiki
imported>Guo.jieli
無編輯摘要
imported>Guo.jieli
無編輯摘要
行 1: 行 1:
== 安裝server ==
1. 使用的版本 12.04 LTS (下載:http://releases.ubuntu.com/precise/)
1. 使用的版本 12.04 LTS (下載:http://releases.ubuntu.com/precise/)
   LTS版本會在五年內一直會更新,不需要重新安裝整個系統。2012的LTS 在 2017年前都會有更新檔案。更新的考量是安全性。
   LTS版本會在五年內一直會更新,不需要重新安裝整個系統。2012的LTS 在 2017年前都會有更新檔案。更新的考量是安全性。
行 15: 行 19:


4. 另外在系統內 apt 裝 phpadmin、apache2。
4. 另外在系統內 apt 裝 phpadmin、apache2。
== 安全性設定 ==
0. ubuntu mail command:
http://askubuntu.com/questions/12917/how-to-send-mail-from-the-command-line
http://ubuntu.lyhdev.com/2010/09/gmailubuntu-linuxsmtp.html
# 使用gmail當成 ubuntu server的收發信件。信件內容是關於一些server面對的問題
1. 自動安裝安全更新:#在安裝server 的時候直接處理了,要檢查設定。
command:
   sudo dpkg-reconfigure -plow unattended-upgrades
check:
    will create /etc/apt/apt.conf.d/20auto-upgrades
2. crontab 設定時間同步 # 時間不同步的話,容易出現問題。
## system clock update from ntp server (midnight every day)
0 0 * * * /usr/sbin/ntpdate -s time.stdtime.gov.tw
3. 安裝ufw (0. ubuntu mail command:
http://askubuntu.com/questions/12917/how-to-send-mail-from-the-command-line
http://ubuntu.lyhdev.com/2010/09/gmailubuntu-linuxsmtp.html # 使用gmail當成 ubuntu server的收發信件。信件內容是關於一些server面對的問題
ufw 防火牆設定程式(http://wiki.ubuntu-tw.org/index.php?title=Ufw)
4. Harden PHP for security. 
   sudo vi /etc/php5/apache2/php.ini
disable_functions = exec,system,shell_exec,passthru
register_globals = Off
expose_php = Off
display_errors = Off
track_errors = Off
html_errors = Off
magic_quotes_gpc = Off
5. apache config:
- 確定 run apache的user
- 禁止瀏覽目錄:Options Indexes FollowSymLinks MultiViews (刪去Indexes), 重新啟動apache
- Restrict Apache Information Leakage.
sudo vi /etc/apache2/conf.d/security
ServerTokens Prod
ServerSignature Off
TraceEnable Off
Header unset ETag
FileETag None
6. apache mod_security
   sudo apt-get install libapache2-mod-security
7. SELinux - Apparmor.
sudo apt-get install apparmor apparmor-profiles
check: sudo apparmor_status
8. 安裝 Denyhosts #捷立:sudo apt-get install。 這是拿來擋ssh 攻擊的。

於 2013年9月4日 (三) 07:49 的修訂

安裝server

1. 使用的版本 12.04 LTS (下載:http://releases.ubuntu.com/precise/)

  LTS版本會在五年內一直會更新,不需要重新安裝整個系統。2012的LTS 在 2017年前都會有更新檔案。更新的考量是安全性。

2. 安裝系統

   partition disk 
       root : 20G
       EFI : 開機需要
       資料:放成data(剩下的檔案)
       swap : 跟RAM 一樣大
  directory 不需要 encrypt

3. 需要安裝的server :

  OpenSSH server
  LAMP server。(若忘記,就在系統能以 sudo apt-get install apache2 mysql-server php5)

4. 另外在系統內 apt 裝 phpadmin、apache2。


安全性設定

0. ubuntu mail command: http://askubuntu.com/questions/12917/how-to-send-mail-from-the-command-line

http://ubuntu.lyhdev.com/2010/09/gmailubuntu-linuxsmtp.html

  1. 使用gmail當成 ubuntu server的收發信件。信件內容是關於一些server面對的問題

1. 自動安裝安全更新:#在安裝server 的時候直接處理了,要檢查設定。 command:

   sudo dpkg-reconfigure -plow unattended-upgrades

check:

      will create /etc/apt/apt.conf.d/20auto-upgrades

2. crontab 設定時間同步 # 時間不同步的話,容易出現問題。

    1. system clock update from ntp server (midnight every day)

0 0 * * * /usr/sbin/ntpdate -s time.stdtime.gov.tw

3. 安裝ufw (0. ubuntu mail command: http://askubuntu.com/questions/12917/how-to-send-mail-from-the-command-line

http://ubuntu.lyhdev.com/2010/09/gmailubuntu-linuxsmtp.html # 使用gmail當成 ubuntu server的收發信件。信件內容是關於一些server面對的問題

ufw 防火牆設定程式(http://wiki.ubuntu-tw.org/index.php?title=Ufw)

4. Harden PHP for security.

   sudo vi /etc/php5/apache2/php.ini

disable_functions = exec,system,shell_exec,passthru register_globals = Off expose_php = Off display_errors = Off track_errors = Off html_errors = Off magic_quotes_gpc = Off

5. apache config:

- 確定 run apache的user - 禁止瀏覽目錄:Options Indexes FollowSymLinks MultiViews (刪去Indexes), 重新啟動apache - Restrict Apache Information Leakage.

sudo vi /etc/apache2/conf.d/security

ServerTokens Prod ServerSignature Off TraceEnable Off Header unset ETag FileETag None

6. apache mod_security

   sudo apt-get install libapache2-mod-security

7. SELinux - Apparmor.

sudo apt-get install apparmor apparmor-profiles

check: sudo apparmor_status

8. 安裝 Denyhosts #捷立:sudo apt-get install。 這是拿來擋ssh 攻擊的。