在Hyper-v 環境下架設 UBUNTU 1404 筆記

     
 

  • 測試環境
    實體伺服器 amd 8 7600 + 16M RAM + WINDOWS 2012 R2
    使用Hyper-V 安裝UBUNTU 1404
  • Hyper-V 的還原點設定可以很方便的還原伺服器
  • 以 PIETTY 連線到 UBUNTU (編碼記得改UTF8)
  • 使用SCP指令在兩台伺服器間COPY資料(兩台電腦都要安裝SSH SERVER 同時防火牆需要開放SSH PORT
    usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
    [-l limit] [-o ssh_option] [-P port] [-S program]
    [[user@]host1:]file1 … [[user@]host2:]file2
  • 開啟SAMBA的HOME目錄功能
    vi /etc/samba/smb.conf
    加入以下幾行

    [homes]

    comment = Home Directories

    browseable = no

    read only = no

       
     

    service smbd restart

  • 重裝 xoops

    Ubuntu 14.04 需先安裝php5-curl 套件,否則OPENID快速登入功能會有問題,導至網頁無法顯示(只出現標題選單)

       
     

    先下載 my_xoops_base_20140701.gz 放到 /var 內

    解壓縮
    tar zxvf my_xoops_base_20140701.gz
    mv public_html WWW
    chown www-data.www-data www –R
    chown www-data.www-data xoops_data –R
    chown www-data.www-data xoops_lib –R
    ……..

  • XOOPS 移機

    先修改PHP.INI,讓上傳的檔案可以到12M
    sudo nano /etc/php5/apache2/php.ini
    找到
    upload_max_filesize = 2M 改成12M

    sudo service apache2 restart

    資料庫部份使用 SQL匯出匯入的方法使用phpmyadmin 將資料匯到新的電腦,
    在新電腦以scp指令將
    /var/www/xoops
    /var/xoops/xoops_data
    /var/xoops/xoops_lib
    三個目錄搬過來,並修改擁有者及權限
    sudo scp –r root@120.116.16.1:/var/www/xoops /var/www/xoops
    sudo scp –r root@120.116.16.1:/var/xoops /var/xoops

    修改資料庫連線密碼
    sudo nano /etc/xoops/xoops_data/data/secure.php

       

  • 修改IP

    sudo nano /etc/network/interfaces

    auto eth0
    iface eth0 inet static
    address 120.116.16.1
    netmask 255.255.254.0
    broadcast 120.116.17.255
    gateway 120.116.17.254
    dns-nameservers 163.26.1.1 168.95.1.1
    dns-search dcps.tn.edu.tw

    iface eth0 inet6 static
    address 2001:288:75d8::1
    netmask 64

    重新開機
    ※重要!!若要做為學校的WWW SERVER,IPV6 一定要記得設定,否則在USER那兒開網頁會開很慢(因為連不到IPV6)

 
 

 
 

  • 本校已不再使用SAMBA當網域主機,改使用WINDOWS 2012 R2做為AD,
    故以下講義謹供參考,不再維護
  • 將samba 當成舊版網域主控站(nt4 dc)的設定檔

    [global]

    display charset = UTF8

    name resolve order = lmhosts host wins bcast

    passwd chat = *EntersnewsUNIXspassword:* %nn *RetypesnewsUNIXspassword:* %nn

    admin users = root

    obey pam restrictions = yes

    time server = yes

    passwd program = /usr/bin/passwd %u

    dns proxy = no

    netbios name = www

    printing = bsd

    dos charset = CP950

    local master = yes

    ;workgroup 設定網域名稱

    workgroup = dc2es2

    syslog only = no

    os level = 65

    printcap name = /etc/printcap

    security = domain

    max log size = 1000

    read raw = no

    guest account = nobody

    load printers = yes

    write raw = no

    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_SNDBUF=4096 SO_RCVBUF=4096

    domain master = yes

    winbind trusted domains only = yes

    encrypt passwords = true

    winbind use default domain = yes

    passdb backend = tdbsam

    wins support = true

    netbios aliases = dns

    server string = Linux Samba

    unix password sync = yes

    add user script = /usr/sbin/useradd -d /dev/null -g 100 -s /bin/false -M %u

    syslog = 0

    unix charset = BIG5

    panic action = /usr/share/samba/panic-action %d

    domain logons = yes

         
     

    ;以下與網域設定無關純為HOME目錄之權限設定

    [homes]

    comment = Home Directories

    valid users = %S

    browseable = no

         
     

    ; By default, the home directories are exported read only. Change next

    ; parameter to “no” if you want to be able to write to them.

    read only = no

         
     

    ; File creation mask is set to 0700 for security reasons. If you want to

    ; create files with group=rw permissions, set next parameter to 0775.

    create mask = 0755

         
     

    ; Directory creation mask is set to 0700 for security reasons. If you want to

    ; create dirs. with group=rw permissions, set next parameter to 0775.

    directory mask = 0755

  • 新增一個電腦帳號(用來讓電腦加入網域用
    假設主機名稱為 w2003,其在 Samba 所在 Unix like 上的機器帳號應為 w2003$
    /usr/sbin/useradd -g users -d /dev/null -c w2003 -m -s /bin/false w2003$
    smbpasswd -a -m w2003$

   

   

跳至工具列