試用新北市教育作業系統

偶然之間看到的,所以下載下來試用看看!
新北市自由軟體E學園

下載的是 ntpcU0801.iso[@more@]光碟開機畫面

登入畫面,直接按 Enter 鍵即可

進入桌面環境,可以看的出來是 base on Ubuntu 14.04 LTS 版本

安裝到硬碟的畫面就不擷取的,因為和 elementary OS 和 Linux Mint 一樣
不過它複製檔案到硬碟的畫面比較精簡一些

安裝完成

使用的感覺:
1. Firefox 可以正常瀏覽 Flash 網頁

2. 已安裝 Oracle JDK 8

3. 已預載 Scratch 2 及範例

4. 預設安裝的中文輸入架構是 ibus / fcitx,我已經把它移除,改安裝 hime

5. 已預先安裝 wine
$ sudo dpkg -l | grep wine
ii  wine-gecko2.24:amd64                                  2.24-0ubuntu1~ppa1                                  amd64        Microsoft Windows compatibility layer (embedded web browser)
ii  wine-gecko2.24:i386                                   2.24-0ubuntu1~ppa1                                  i386         Microsoft Windows compatibility layer (embedded web browser)
ii  wine-mono4.5.2                                        4.5.2-0ubuntu1~ppa1                                 all          Microsoft Windows compatibility layer (.NET compatibility)
ii  wine1.7                                               1:1.7.22-0ubuntu1                                   amd64        Microsoft Windows Compatibility Layer (Binary Emulator and Library)
ii  wine1.7-amd64                                         1:1.7.22-0ubuntu1                                   amd64        Microsoft Windows Compatibility Layer (64-bit support)
ii  wine1.7-i386                                          1:1.7.22-0ubuntu1                                   i386         Microsoft Windows Compatibility Layer (32-bit support)
ii  winetricks                                            0.0+20140302-0ubuntu2                               all          Microsoft Windows Compatibility Layer (winetricks)

功能表上有 7-Zip 和 PhotoCap6

但 PhotoCap 無法正執行,可能是我建立的帳號和設定不同,也沒有把程式正確複製到對應目錄

7-Zip 也是無法執行成功

6. 預設有安裝 Chromium 瀏覽器,但無法觀看含有 Flash 的網頁

要加裝 pepperflashplugin-nonfree 套件
$ sudo apt-get install pepperflashplugin-nonfree

7. 預設安裝一些程式開發套件

整體來說,使用感覺還不錯,只是 Ubuntu 預設使用的 Unity 介面一直使用不慣,實在很想把它給換掉。

在 Ubuntu 14.04 x86 Desktop 上安裝 Scratch 2.0 Offline Editor

本來一直都是使用 x86_64 版本的,可是在 64 位元上安裝 Scratch 2.0 離線編輯器一直出現問題,所以只好放棄,改安裝 x86 版本。

1. 下載所須的軟體
Adobe AIR Linux
$ wget http://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRInstaller.bin
Scratch 2.0 Offline Editor
$ wget http://cdn.scratch.mit.edu/scratchr2/static/sa/Scratch.air

2. 建立相關連結
$ sudo updatedb
$ sudo locate libgnome-keyring.so
/usr/lib/i386-linux-gnu/libgnome-keyring.so.0
/usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0
$ sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0
$ sudo ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0[@more@]3. 更改檔案權限
$ sudo chmod +x AdobeAIRInstaller.bin

4. 開始進行安裝
$ sudo ./AdobeAIRInstaller.bin

選擇 我同意

安裝中

選擇 完成

5. 安裝 Scratch 2.0 Offline Editor
$ sudo /etc/alternatives/Adobe_AIR_Application_Installer ~/Scratch.air

選擇 安裝

選擇 繼續

Scratch 2.0 執行畫面

IPv6 Firewall

一般在設定 Server 的防火牆規則時,大部分都集中在 IPv4,不過目前宜蘭縣的 IPv6 環境應該非常完整,所以 IPv6 的部分也不能忽視。
參考網站:ip6tables: IPv6 Firewall For Linux

原本沒有設定的畫面
# ip6tables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
[@more@]以 Ubuntu Server 14.04 為例
IPv6 的防火牆規則寫在 /etc/rc.local 檔案之中

# vim /etc/rc.local
###—————————————————–###
# 設定 ip6tables 的路徑
###—————————————————–###
echo “Set path of ip6tables”

IP6TABLES=”/sbin/ip6tables”

###—————————————————–###
# 設定對外的網路卡編號
###—————————————————–###
FW_IFACE=”eth0″

###—————————————————–###
# 清除先前的設定
###—————————————————–###
echo “Flush fiter table ……”
echo

$IP6TABLES -F
$IP6TABLES -X
$IP6TABLES -Z

$IP6TABLES -t mangle -F
$IP6TABLES -t mangle -X

###—————————————————–###
# 設定 filter table 的預設政策
###—————————————————–###
$IP6TABLES -P INPUT DROP
$IP6TABLES -P OUTPUT DROP
$IP6TABLES -P FORWARD DROP

# 允許已建立連線和回應的封包通過
$IP6TABLES -A INPUT -i $FW_IFACE -m state –state ESTABLISHED,RELATED -j ACCEPT
$IP6TABLES -A OUTPUT -o $FW_IFACE -m state –state NEW,ESTABLISHED,RELATED -j ACCEPT

# 預定開放的服務 22 / 80
$IP6TABLES -A INPUT -i $FW_IFACE -p tcp –dport 80 -j ACCEPT
$IP6TABLES -A INPUT -i $FW_IFACE -p tcp -s 2001:288:a229:1::/64 –dport 22 -j ACCEPT

# 開放 ipv6 icmp
$IP6TABLES -A INPUT -i $FW_IFACE -p ipv6-icmp -j ACCEPT
$IP6TABLES -A OUTPUT -o $FW_IFACE -p ipv6-icmp  -j ACCEPT

讓設定生效
# service rc.local start

IPv6 防火牆規則
# ip6tables -L -n
Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all      ::/0                 ::/0                 state RELATED,ESTABLISHED
ACCEPT     tcp      ::/0                 ::/0                 tcp dpt:80
ACCEPT     tcp      2001:288:a229:1::/64  ::/0                 tcp dpt:22
ACCEPT     icmpv6    ::/0                 ::/0

Chain FORWARD (policy DROP)
target     prot opt source               destination

Chain OUTPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all      ::/0                 ::/0                 state NEW,RELATED,ESTABLISHED
ACCEPT     icmpv6    ::/0                 ::/0

讓 Ubuntu Server 14.04 可以直接以 root 登入

Ubuntu Server 14.04 預設遠端無法以 root 直接登入,必須要先登入成一般使用者,再使用 sudo 或 su – 來取得 root 權限,但本地端則可以直接以 root 登入。
雖然使用 root 直接登入是很不好的習慣,但架設的測試 Server,主要是在內部網路及測試用途,所以不想要那麼麻煩。
預設無法以 root 登入,即使輸入的是正確的密碼

[@more@]1. 修改 /etc/ssh/sshd_config
# vim /etc/ssh/sshd_config
把 PermitRootLogin without-password 前面加上 # 註解
#PermitRootLogin without-password
加入下面這一行
PermitRootLogin yes

2. 重新啟動電腦或重新啟動 ssh Server
# sync;sync;sync;sync;reboot

3. 可以正常登入了!

Ubuntu Server – There are 3 zombie processes.

登入 Ubuntu Server 後,發現有一行 There are 3 zombie processes.的訊息
關於 zombie processes 的說明,可以參考 如何避免 zombie process 的產生? @ 藍色情懷 :: 隨意窩 Xuite日誌
找尋 zombie processes 的方式
# ps aux | grep ‘Z’
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      2589  0.0  0.0      0     0 pts/0    ZN   15:11   0:00 [bandwidthd] <defunct>
root      2590  0.1  0.0      0     0 pts/0    ZN   15:11   0:00 [bandwidthd] <defunct>
root      2591  0.1  0.0      0     0 pts/0    ZN   15:11   0:00 [bandwidthd] <defunct>
root      2593  0.0  0.0  10468   904 pts/0    S+   15:11   0:00 grep –color=auto Z

# ps axo pid=,stat= | awk ‘$2~/^Z/ { print $1 }’
2589
2651
2652

Ubuntu 14.04 Server 上的 NFS Server 設定

使用 NFS Server 感覺比較麻煩的是,NFS Server 除了固定的 tcp/udp 111 和 tcp/udp 2049 外,其它的 Port 都是動態產生,如果要在防火牆上做設定,不太容易,最好能固定使用某些 Port,方便處理。
# rpcinfo -p
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp  56027  status
    100024    1   tcp  32961  status
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    2   tcp   2049
    100227    3   tcp   2049
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    2   udp   2049
    100227    3   udp   2049
    100021    1   udp  44022  nlockmgr
    100021    3   udp  44022  nlockmgr
    100021    4   udp  44022  nlockmgr
    100021    1   tcp  48020  nlockmgr
    100021    3   tcp  48020  nlockmgr
    100021    4   tcp  48020  nlockmgr
    100005    1   udp  33475  mountd
    100005    1   tcp  45010  mountd
    100005    2   udp  60988  mountd
    100005    2   tcp  44341  mountd
    100005    3   udp  51772  mountd
    100005    3   tcp  40966  mountd
[@more@]這方面的資料在 CentOS Linux 有很多的參考資料,如:鳥哥的 Linux 私房菜 — NFS 伺服器,但在 Ubuntu Server 上似乎不多,尤其是中文的部份,後來在英文的網站中,找到了 SecuringNFS – Debian Wiki 這一篇,根據網站上的說明,實際設定一下,可以正常成功。
1. 修改設定檔 /etc/default/nfs-common
# vim /etc/default/nfs-common
STATDOPTS=”–port 32765 –outgoing-port 32766″

2. 修改設定檔 /etc/default/nfs-kernel-server
# vim /etc/default/nfs-kernel-server
RPCMOUNTDOPTS=”-p 32767″

3. 修改設定檔 /etc/default/quota
# vim /etc/default/quota
RPCRQUOTADOPTS=”-p 32769″

4. 修改 /etc/services 加入下面的設定
# vim /etc/services
rpc.nfsd        2049/tcp                        # RPC nfsd
rpc.nfsd        2049/udp                        # RPC nfsd
rpc.nfs-cb      32764/tcp                       # RPC nfs callback
rpc.nfs-cb      32764/udp                       # RPC nfs callback
rpc.statd-bc    32765/tcp                       # RPC statd broadcast
rpc.statd-bc    32765/udp                       # RPC statd broadcast
rpc.statd       32766/tcp                       # RPC statd listen
rpc.statd       32766/udp                       # RPC statd listen
rpc.mountd      32767/tcp                       # RPC mountd
rpc.mountd      32767/udp                       # RPC mountd
rpc.lockd       32768/tcp                       # RPC lockd/nlockmgr
rpc.lockd       32768/udp                       # RPC lockd/nlockmgr
rpc.quotad      32769/tcp                       # RPC quotad
rpc.quotad      32769/udp                       # RPC quotad

5. 修改設定檔 /etc/modprobe.d/local.conf
# vim /etc/modprobe.d/local.conf
options lockd nlm_udpport=32768 nlm_tcpport=32768
options nfs callback_tcpport=32764

6. 重新啟動 Ubuntu Server

7. 檢查成果
# rpcinfo -p
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp  32765  status
    100024    1   tcp  32765  status
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    2   tcp   2049
    100227    3   tcp   2049
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    2   udp   2049
    100227    3   udp   2049
    100021    1   udp  32768  nlockmgr
    100021    3   udp  32768  nlockmgr
    100021    4   udp  32768  nlockmgr
    100021    1   tcp  32768  nlockmgr
    100021    3   tcp  32768  nlockmgr
    100021    4   tcp  32768  nlockmgr
    100005    1   udp  32767  mountd
    100005    1   tcp  32767  mountd
    100005    2   udp  32767  mountd
    100005    2   tcp  32767  mountd
    100005    3   udp  32767  mountd
    100005    3   tcp  32767  mountd

8. 加入防火牆的設定
# NFS Port 111,2049,32764:32769
# eth1 對內網路卡 192.168.66.0/24 內部網路網段
# vim /etc/rc.local
iptables -A INPUT -i eth1 -p tcp -s 192.168.66.0/24 -m state –state NEW -m multiport –dport 111,2049,32764:32769 -j ACCEPT
iptables -A INPUT -i eth1 -p udp -s 192.168.66.0/24 -m state –state NEW -m multiport –dport 111,2049,32764:32769 -j ACCEPT

9. 重新啟動防火牆
# service rc.local start

在 Ubuntu 14.04 上安裝 NFS Server

因為搭配 DRBL Live,所以特別在 Ubuntu Server 上安裝 NFS Server。
安裝所須套件
# apt-get install nfs-common nfs-kernel-server

建立要分享及掛載的目錄
# mkdir /home/partimag

[@more@]修改設定檔 /etc/exports
加入下面一列
# vim /etc/exports
/home/partimag 192.168.66.0/24(rw,sync,no_subtree_check)

啟動 NFS Server
# /etc/init.d/nfs-kernel-server start
 * Exporting directories for NFS kernel daemon…                                                                                                                                             [ OK ]
 * Starting NFS kernel daemon                                                                                                                                                                 [ OK ]
檢查是是有啟動成功
# showmount -e localhost
Export list for localhost:
/home/partimag 192.168.66.0/24

在 Ubuntu Server 14.04 上安裝 PXE Server

之前的安裝方式是採用手動一一安裝所須套件,這裡是直接改用 DRBL 所提供的套件。
[@more@]1. 安裝
安裝 tftp 和 dhcp server 及一些所須的套件
# apt-get -y install tftpd tftp isc-dhcp-server update-inetd xinetd clonezilla drbl
建立 dhcp server 設定檔
# vim /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.201 192.168.1.210;
    option subnet-mask 255.255.255.0;
    option routers 192.168.1.254;
    option broadcast-address 192.168.1.255;
    filename “pxelinux.0”;
    next-server 192.168.1.124;
}

2. 啟動 dhcpd server
# /etc/init.d/isc-dhcp-server restart
 * Stopping ISC DHCP server dhcpd                                        [fail]
 * Starting ISC DHCP server dhcpd                                        [ OK ]

3. 檢查 dhcpd server 是否有正常啟動
# netstat -lu | grep boot
udp        0      0 *:bootps                *:*
udp        0      0 *:bootpc                *:*

4. 修改 tftpd server 設定,設定目錄在 /tftpboot/nbi_img
# vim /etc/xinetd.d/tftp
service tftp
{
    disable = no
    socket_type     = dgram
    protocol        = udp
    wait            = yes
    user            = root
    server          = /usr/sbin/in.tftpd
    server_args     = -s /tftpboot/nbi_img
    per_source      = 11
    cps         = 100 2
    flags           = IPv4
}

4. 重新啟動 xinetd
# service xinetd restart

5. 檢查 tftpd server 是否有正常啟動
# netstat -lu | grep tftp
udp        0      0 *:tftp                  *:*

6. 安裝 syslinux
# apt-get install syslinux

7. 建立 PXE 開機的開機選單
# vim /tftpboot/nbi_img/pxelinux.cfg/default

解決在 Ubuntu Server 14.04 上安裝 ClipBucket 後螢幕出現的錯誤訊息

在 Ubuntu Server 14.04 上安裝 ClipBucket 後螢幕會出現一大堆的錯誤訊息
Strict Standards: Non-static method CBTemplate::assign() should not be called statically in /var/www/html/clipbucket/includes/functions.php on line xxx
[@more@]解決方式:
參考網站:
Issue 426 – clipbucket – Default template are not supported to PHP 5.4.19 – Video and photo sharing website script with social networking – Google Project Hosting

修改 /var/www/html/clipbucket/includes/common.php,註解部份程式碼
# vim /var/www/html/clipbucket/includes/common.php
                case 2:
/*              default:
                {

                        if(phpversion() >= ‘5.3.0’)
                        {
                                error_reporting(E_ALL ^E_NOTICE ^E_DEPRECATED);
                                ini_set(‘display_errors’, ‘1’);
                        }
                        else
                        {
                                error_reporting(E_ALL ^E_NOTICE);
                                ini_set(‘display_errors’, ‘1’);
                        }
                } */
        }

這時畫面上就不會出現錯誤訊息了!

在 Ubuntu Server 14.04 上安裝 ClipBucket

在 Ubuntu Server 14.04 上安裝 ClipBucket
參考網站:
How to install the transcoding tools on Ubuntu 14.04 – ViMP – Video CMS

1. 安裝所須套件
# apt-get install apache2 php5 mysql-server php5-mysql gpac php5-cli php5-gd php5-curl libx264-dev libtheora-dev libfaac-dev libmp3lame-dev libvorbis-dev libxvidcore-dev build-essential yasm checkinstall
[@more@]2.
安裝所須套件
# apt-get install make automake g++ bzip2 unzip patch subversion
3.  下載 win codecs of the MPlayer 及安裝
#
wget http://www2.mplayerhq.hu/MPlayer/releases/codecs/essential-amd64-20071007.tar.bz2

# tar xvjf essential-amd64-20071007.tar.bz2
# mkdir /usr/local/lib/codecs
# cp -Rvp essential-amd64-20071007/* /usr/local/lib/codecs/
4. 修改 /etc/ld.so.conf
#
vim /etc/ld.so.conf
加入下面二行
/usr/lib
/usr/local/lib
讓設定生效
#
ldconfig

5.
安裝所須套件
#
apt-get install libsdl1.2-dev zlib1g-dev libfaad-dev libfaac-dev libgsm1-dev libtheora-dev libvorbis-dev libspeex-dev libopencore-amrwb-dev libopencore-amrnb-dev libxvidcore-dev libxvidcore4 libmp3lame-dev libjpeg62 libjpeg62-dev

6. 安裝 x264
#
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/last_stable_x264.tar.bz2

# tar xvjf last_stable_x264.tar.bz2
# cd x264-snapshot-20140610-2245-stable/
# ./configure –enable-shared –enable-pic
# make && make install
# cd ..
7. 安裝 libvpx
#
wget http://webm.googlecode.com/files/libvpx-v1.2.0.tar.bz2

# tar xvjf libvpx-v1.2.0.tar.bz2
# cd libvpx-v1.2.0
# ./configure –enable-shared –enable-pic
# make
# make install
# cd ..
8. 安裝 MPlayer/mencoder
# wget http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.1.tar.gz
# tar xvzf MPlayer-1.1.tar.gz
# cd MPlayer-1.1/
# ./configure
# make && make install
# ldconfig
# cd ..
9. 安裝 ffmpeg
# wget http://ffmpeg.org/releases/ffmpeg-2.2.1.tar.bz2
# tar xvjf ffmpeg-2.2.1.tar.bz2
# cd ffmpeg-2.2.1/
# ./configure –enable-gpl –enable-version3 –enable-shared –enable-nonfree –enable-postproc –enable-libfaac –enable-libmp3lame –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-libtheora –enable-libvorbis –enable-libvpx –enable-libx264 –enable-libxvid
# make
# make install
# ldconfig
10. 安裝 qt-faststart
# cd tools
# make qt-faststart
# cp qt-faststart /usr/local/bin/
11. 安裝 flvtool2
# cd /usr/src
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.bz2
# tar xvjf ruby-1.8.6.tar.bz2
# cd ruby-1.8.6
# vim math.c
修改 math.c
修改第 37 行
#elif define(ERANGE)
成為
#elif defined(ERANGE)
# ./configure
# make
# make install
# cd ..
# wget https://ffmpeg-install-centos.googlecode.com/files/flvtool2-1.0.6.tgz
# tar xzf flvtool2-1.0.6.tgz
# cd flvtool2-1.0.6
# /usr/local/bin/ruby setup.rb config
# /usr/local/bin/ruby setup.rb setup
# /usr/local/bin/ruby setup.rb install
# cd ..

12. 下載 ClipBucket 及安裝
# cd /var/www/html
# wget http://downloads.sourceforge.net/project/clipbucket/ClipBucket%20v2/clipbucket-2.6-r738-security-fixed.zip
# unzip clipbucket-2.6-r738-security-fixed.zip
# mv clipbucket-2.6-r738-security-fixed/upload clipbucket

13. 更改檔案及目錄權限
# chmod 777 clipbucket/includes
# chmod 777 clipbucket/files
# chmod 777 clipbucket/files/conversion_queue
# chmod 777 clipbucket/files/logs
# chmod 777 clipbucket/files/original
# chmod 777 clipbucket/files/temp
# chmod 777 clipbucket/files/thumbs
# chmod 777 clipbucket/files/photos
# chmod 777 clipbucket/files/videos
# chmod 777 clipbucket/files/mass_uploads
# chmod 777 clipbucket/files/temp/install.me
# chmod 777 clipbucket/images
# chmod 777 clipbucket/images/avatars
# chmod 777 clipbucket/images/backgrounds
# chmod 777 clipbucket/images/collection_thumbs
# chmod 777 clipbucket/images/category_thumbs
# chmod 777 clipbucket/images/groups_thumbs
# chmod 777 clipbucket/includes/langs/en.lang
# chmod 777 clipbucket/cache
# chmod 777 clipbucket/cache/comments
# chmod 777 clipbucket/cache/userfeeds
# chmod 777 clipbucket/cb_install


14. 建立 ClipBucket 資料庫
# /usr/bin/mysqladmin -u root -p create ClipBucket

15. 修改 /etc/php5/apache2php.ini
# vim /etc/php5/apache2/php.ini
max_execution_time = 300
max_input_time = 600
memory_limit = 512M
post_max_size =2048M
upload_max_filesize=2048M
# 開啟這項才能看到 ClipBucket 安裝畫面
short_open_tag = On
date.timezone = “Asia/Taipei”

16. 重新啟動 Apache Web Server
# /etc/init.d/apache2 restart

17. 進行 ClipBucket 安裝
因為和之前的安裝方式相同,就不另外擷取圖片說明!
參考:頭城國小資訊組 | 在 CentOS 6.x 上安裝 ClipBucket