使用 putty-tools 工具中的 pscp 來管理電腦教室

pscp 可以將檔案複製到 Windows 的主機,功能類似 Linux  的 scp。
pscp 使用參數
# /usr/bin/pscp
PuTTY Secure Copy client
Unidentified build, Mar 14 2015 13:36:11
Usage: pscp [options] [user@]host:source target
       pscp [options] source [source…] [user@]host:target
       pscp [options] -ls [user@]host:filespec
Options:
  -V        print version information and exit
  -pgpfp    print PGP key fingerprints and exit
  -p        preserve file attributes
  -q        quiet, don’t show statistics
  -r        copy directories recursively
  -v        show verbose messages
  -load sessname  Load settings from saved session
  -P port   connect to specified port
  -l user   connect with specified username
  -pw passw login with specified password
  -1 -2     force use of particular SSH protocol version
  -4 -6     force use of IPv4 or IPv6
  -C        enable compression
  -i key    private key file for authentication
  -noagent  disable use of Pageant
  -agent    enable use of Pageant
  -batch    disable all interactive prompts
  -unsafe   allow server-side wildcards (DANGEROUS)
  -sftp     force use of SFTP protocol
  -scp      force use of SCP protocol[@more@]常用的參數
  -q        quiet, don’t show statistics  安靜模式
  -r        copy directories recursively  遞迴模式,複製時包含子目錄
  -l user   connect with specified username  登入的使用者
  -pw passw login with specified password   使用者的密碼

底下列出幾個實例
將 PotPlayerSetup64.exe 檔案複製到 Administrator 使用者的桌面
# echo -y | pscp -pw 123456  PotPlayerSetup64.exe Administrator@192.168.1.112:/cygdrive/c/Users/Administrator/Desktop

不顯示檔案傳輸時的訊息
# echo -y | pscp -pw 123456  -q CentOS-Server-6.5-x86_64_20140917.iso Administrator@192.168.1.112:/cygdrive/c/Users/Administrator/Desktop

複製時包含子目錄
# echo -y | pscp -pw 123456 -r noip-2.1.9-1 Administrator@192.168.1.112:/cygdrive/c/Users/Administrator/Desktop
noip2                     | 70 kB |  71.0 kB/s | ETA: 00:00:00 | 100%
._redhat.noip.sh          | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
redhat.noip.sh            | 1 kB |   1.2 kB/s | ETA: 00:00:00 | 100%
noip2.c                   | 75 kB |  75.1 kB/s | ETA: 00:00:00 | 100%
Makefile                  | 0 kB |   1.0 kB/s | ETA: 00:00:00 | 100%
mac.osx.startup           | 1 kB |   1.2 kB/s | ETA: 00:00:00 | 100%
README.FIRST_PT           | 14 kB |  14.3 kB/s | ETA: 00:00:00 | 100%
debian.noip2.sh           | 0 kB |   0.9 kB/s | ETA: 00:00:00 | 100%
README.FIRST.pt_BR        | 12 kB |  12.2 kB/s | ETA: 00:00:00 | 100%
._mac.osx.startup         | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
LIESMICH.ERST.deutsch     | 14 kB |  14.1 kB/s | ETA: 00:00:00 | 100%
._debian.noip2.sh         | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._README.FIRST.FRANCAIS   | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._COPYING                 | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._README.FIRST.ITALIANO   | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._Makefile                | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._noip2.c                 | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
LISEZMOI.ENPREMIER        | 13 kB |  13.3 kB/s | ETA: 00:00:00 | 100%
README.FIRST.JAPANESE     | 15 kB |  15.3 kB/s | ETA: 00:00:00 | 100%
README.FIRST.FRANCAIS     | 13 kB |  13.1 kB/s | ETA: 00:00:00 | 100%
COPYING                   | 17 kB |  17.7 kB/s | ETA: 00:00:00 | 100%
gentoo.noip2.sh           | 0 kB |   0.5 kB/s | ETA: 00:00:00 | 100%
README.FIRST-SWE          | 12 kB |  12.9 kB/s | ETA: 00:00:00 | 100%
._README.FIRST            | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._noip2-i686              | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._noip2-x86_64            | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._gentoo.noip2.sh         | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._binaries                | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
README.FIRST.ITALIANO     | 14 kB |  14.1 kB/s | ETA: 00:00:00 | 100%
._README.FIRST.JAPANESE   | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._README.FIRST.pt_BR      | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._README.FIRST_PT         | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._README.FIRST-SWE        | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
README.FIRST              | 12 kB |  12.5 kB/s | ETA: 00:00:00 | 100%
._LISEZMOI.ENPREMIER      | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._LIESMICH.ERST.deutsch   | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
._LEEME.PRIMERO           | 0 kB |   0.2 kB/s | ETA: 00:00:00 | 100%
LEEME.PRIMERO             | 13 kB |  13.5 kB/s | ETA: 00:00:00 | 100%

同樣的,搭配 Script 也可以複製給電腦教室全部的電腦。

Banana Pi – Bananian Linux 更新到 1504

Bananian Linux 已於 2015-04-08 更新到 1504
Bananian Linux 1504 更新說明:http://forum.lemaker.org/thread-11797-1-1-bananian_15_04_released.html
[@more@]可以直接下載新版本來安裝
Bananian Linux 15.04 下載網址:http://www.lemaker.org/resources/9-116/bananian_for_bananapi.html

1. 執行 bananian-update 來進行更新

2. 輸入 yes 進行更新

3. 更新中

4. 更新完成,執行 shutdown -r now 重新啟動
# shutdown -r now

使用 putty-tools 工具中的 plink 來管理電腦教室

plink 是一個可以用來遠端連線管理主機的程式。
plink 使用參數
# /usr/bin/plink
PuTTY Link: command-line connection utility
Unidentified build, Mar 14 2015 13:36:11
Usage: plink [options] [user@]host [command]
       (“host” can also be a PuTTY saved session name)
Options:
  -V        print version information and exit
  -pgpfp    print PGP key fingerprints and exit
  -v        show verbose messages
  -load sessname  Load settings from saved session
  -ssh -telnet -rlogin -raw -serial
            force use of a particular protocol
  -P port   connect to specified port
  -l user   connect with specified username
  -batch    disable all interactive prompts
The following options only apply to SSH connections:
  -pw passw login with specified password
  -D [listen-IP:]listen-port
            Dynamic SOCKS-based port forwarding
  -L [listen-IP:]listen-port:host:port
            Forward local port to remote address
  -R [listen-IP:]listen-port:host:port
            Forward remote port to local address
  -X -x     enable / disable X11 forwarding
  -A -a     enable / disable agent forwarding
  -t -T     enable / disable pty allocation
  -1 -2     force use of particular protocol version
  -4 -6     force use of IPv4 or IPv6
  -C        enable compression
  -i key    private key file for authentication
  -noagent  disable use of Pageant
  -agent    enable use of Pageant
  -m file   read remote command(s) from file
  -s        remote command is an SSH subsystem (SSH-2 only)
  -N        don’t start a shell/command (SSH-2 only)
  -nc host:port
            open tunnel in place of session (SSH-2 only)
  -sercfg configuration-string (e.g. 19200,8,n,1,X)
            Specify the serial configuration (serial only)

[@more@]比較常用的參數
-l 要登入的使用者
-pw 登入的密碼

底下列出幾個實例

1. 關閉遠端 Windows 主機
# echo y | /usr/bin/plink -l Administrator -pw 123456 192.168.1.112 “shutdown -s -t 0”

2. 遠端 Windows 主機重新啟動
# echo y | /usr/bin/plink -l Administrator -pw 123456 192.168.1.112 “shutdown -r -t 0”

3. 自動安裝桌面上的 PotPlayer
    /S 是 PotPlayer 的自動安裝參數
# echo y | /usr/bin/plink -pw 123456 Administrator@192.168.1.112 “/cygdrive/c/Users/Administrator/Desktop/PotPlayerSetup64.exe /S”

以上是針對一台電腦,如果是整個電腦教室,則可以利用 Script 檔的方式來達成!

安裝 putty-tools 工具來管理 Windows

在電腦教室的電腦安裝了 drbl-winroll 後,除了可以利用 drbl-winroll 來自動更改還原之後的電腦名稱之外,也因為它附帶安裝了 cygwin,有啟動 ssh 服務,所以可以在在遠端的 Linux 上管理電腦教室的 Windows 電腦。

在 Ubuntu 14.04 LTS Server 上安裝 putty-tools 工具
$ sudo apt-cache search putty-tools
putty-tools – command-line tools for SSH, SCP, and SFTP

putty-tools 它提供了命令列的 pscp / plink..等工具,雖然這些工具沒有 GUI 介面,但是在處理系統自動化時,非常方便,可以快速達到目的,只是要比較麻煩,要記憶一些參數。

安裝 putty-tools
$ sudo apt-get install putty-tools

在 CentOS 6.x 上安裝
#
yum install putty –enablerepo=epel
[@more@]列出 putty-tools 可用的程式
$ sudo dpkg -L putty-tools | grep bin
/usr/bin
/usr/bin/plink
/usr/bin/puttygen
/usr/bin/pscp
/usr/bin/psftp

CentOS 6.x
# rpm -ql putty | grep bin
/usr/bin/plink
/usr/bin/pscp
/usr/bin/psftp
/usr/bin/pterm
/usr/bin/putty
/usr/bin/puttygen
/usr/bin/puttytel

目前比較常用的有 plink / pscp 二個指令

設定 Ubuntu 14.04 LTS Server 上的 PXE Server

1. 安裝設定 PXE Server 所需套件
$ sudo apt-get install libcrypt-passwdmd5-perl mtools syslinux syslinux-common

2. 複製所需檔案到 /var/lib/tftpboot 目錄
$ sudo cp /usr/lib/syslinux/menu.c32 /var/lib/tftpboot
$ sudo cp /usr/lib/syslinux/vesamenu.c32 /var/lib/tftpboot
$ sudo cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot
$ sudo cp /usr/lib/syslinux/gpxelinux.0 /var/lib/tftpboot
$ sudo cp /usr/lib/syslinux/gpxelinuxk.0 /var/lib/tftpboot
$ sudo cp /usr/lib/syslinux/memdisk /var/lib/tftpboot
$ sudo cp /usr/lib/syslinux/mboot.c32 /var/lib/tftpboot
$ sudo cp /usr/lib/syslinux/chain.c32 /var/lib/tftpboot[@more@]3. 建立目錄 /var/lib/tftpboot/pxelinux.cfg
$ sudo  mkdir /var/lib/tftpboot/pxelinux.cfg

4. 建立 PXE 功能表
$ sudo vim /var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 300
ONTIMEOUT local

MENU TITLE Welcom to Tou-Cheng Elementary School PXE Server System

LABEL local
MENU LABEL Boot from local hard drive
LOCALBOOT 0
wq
LABEL Memory Test
   MENU LABEL Memory Test – memtest86+
   kernel memtest/memtest86+-5.01
LABEL SPFDisk
   MENU LABEL SPFDisk
   MENU PASSWD SPFDisk
   kernel memdisk
   append initrd=dos/spfdisk.img

LABEL FreeDOS 1.0
   MENU LABEL FreeDOS 1.0
   MENU PASSWD FreeDOS
   kernel memdisk
   append initrd=dos/fdboot.img

LABEL Clonezilla Live 2.3.2-22-i686-pae
   MENU LABEL Clonezilla Live 2.3.2-22-i686-pae
   MENU PASSWD Clonezilla
   kernel Linux/clonezilla-live-2.3.2-22-i686-pae/live/vmlinuz
   append initrd=Linux/clonezilla-live-2.3.2-22-i686-pae/live/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run=”ocs-live-general” ocs_live_extra_param=”” ocs_live_keymap=”NONE” ocs_live_batch=”no” ocs_lang=”zh_TW.UTF-8″ vga=788 nosplash fetch=tftp://192.168.5.254/Linux/clonezilla-live-2.3.2-22-i686-pae/live/filesystem.squashfs

Adobe Flash Player 17.0.0.169

Adobe Flash Player 17.0.0.169
檢查安裝版本:https://www.adobe.com/tw/software/flash/about/
[@more@]

Windows 平台
Internet Explorer:
http://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_17_active_x.exe

Windows 8/8.1 版則要從 Windows Update 中更新
Windows 8.1 x86
http://download.microsoft.com/download/C/8/9/C89CA8E1-9591-489E-9187-7BC39D930643/Windows8.1-KB3049508-x86.msu
Windows 8.1 x64
http://download.microsoft.com/download/E/0/9/E09762E9-13EE-4779-B658-91EF2B30B6A8/Windows8.1-KB3049508-x64.msu

All Other Browsers(Firefox,Safari & Opera):
http://fpdownload.macromedia.com/get/flashplayer/current/licensing/win/install_flash_player_17_plugin.exe

Mac 平台
http://fpdownload.adobe.com/get/flashplayer/pdc/17.0.0.169/install_flash_player_osx.dmg

客製化 CentOS 7.1.1503 Server 安裝光碟

主要是為了安裝 Server 時可以更加方便,預設只要三個步驟:分割硬碟、設定網路、設定 root 密碼。

光碟開機畫面,以 Install CentOS 7 為預設選項,取消時間倒數
[@more@]分割硬碟

設定網路

開始安裝

設定 root 密碼

完成安裝

客製化內容:
1. 預設啟動 Apache Web Server / PHP / MariaDB SQL Server
2. 新增一些 Apache Web Server 的安全性設定
3. MariaDB MySQL Server 修改成 UTF-8 的使用環境
4. 修改 php 設定,包含:上傳的檔案大小到 200M,時區改成 Asis/Taipei……等等。
5. 套件更新到 2015_04_03
6. 套件更新伺服器改成臺灣
7. 每天早上 6 點對時
8. 加入第三方套件庫 rpmforge / epel /remi,但預設不啟動