2017年8月23日 星期三

[ Raspberry ] Pi 硬體資訊 vcgencmd

時脈頻率(Clock Frequency)
sudo /opt/vc/bin/vcgencmd measure_temp measure_clock <clock>
<clock> : arm, core, h264, isp, v3d, uart, pwm, emmc, pixel, vec, hdmi, dpi
$ sudo nano measure_clock.sh
for src in arm core h264 isp v3d uart pwm emmc pixel vec hdmi dpi ; do \
  echo -e "$src:\t$(sudo /opt/vc/bin/vcgencmd measure_clock $src)" ; \
done

arm:    frequency(45)=1000104000
core:   frequency(1)=400000000
h264:   frequency(28)=300000000
isp:    frequency(42)=300000000
v3d:    frequency(43)=300000000
uart:   frequency(22)=48000000
pwm:    frequency(25)=0
emmc:   frequency(47)=249959000
pixel:  frequency(29)=65000000
vec:    frequency(10)=0
hdmi:   frequency(9)=163683000
dpi:    frequency(4)=0

電壓(Voltage)
sudo /opt/vc/bin/vcgencmd measure_volts <id>
<id> : core, sdram_c, sdram_i, sdram_p
sudo nano measure_volts.sh
for src in core sdram_c sdram_i sdram_p ; do \
  echo -e "$src:\t$(sudo /opt/vc/bin/vcgencmd measure_volts $src)" ; \
done

core:   volt=1.3500V
sdram_c:        volt=1.2000V
sdram_i:        volt=1.2000V
sdram_p:        volt=1.2250V

溫度(Temperature)
sudo /opt/vc/bin/vcgencmd measure_temp
temp=55.1'C

解碼器 (Codec)
sudo /opt/vc/bin/vcgencmd codec_enabled <codec>
<codec> : H264, MPG2, WVC1, MPG4, MJPG, WMV9
sudo nano codec_enabled.sh
for src in H264 MPG2 WVC1 MPG4 MJPG WMV9 ; do \
  echo -e "$src:\t$(sudo /opt/vc/bin/vcgencmd codec_enabled $src)" ; \
done

H264:   H264=enabled
MPG2:   MPG2=disabled
WVC1:   WVC1=disabled
MPG4:   MPG4=enabled
MJPG:   MJPG=enabled
WMV9:   WMV9=disabled

韌體版本(Firmware Version)
sudo /opt/vc/bin/vcgencmd version
Apr 27 2017 17:19:34
Copyright (c) 2012 Broadcom
version 17af5814bb19dbb7c70ccd2c845b80a160943811 (clean) (release)

查看 vcgencmd 所有可用的參數
sudo /opt/vc/bin/vcgencmd commands
commands="vcos, ap_output_control, ap_output_post_processing, vchi_test_init, vchi_test_exit, vctest_memmap, vctest_start, vctest_stop, vctest_set, vctest_get, pm_set_policy, pm_get_status, pm_show_stats, pm_start_logging, pm_stop_logging, version, commands, set_vll_dir, set_backlight, set_logging, get_lcd_info, arbiter, cache_flush, otp_dump, test_result, codec_enabled, get_camera, get_mem, measure_clock, measure_volts, scaling_kernel, scaling_sharpness, get_hvs_asserts, get_throttled, measure_temp, get_config, hdmi_ntsc_freqs, hdmi_adjust_clock, hdmi_status_show, hvs_update_fields, pwm_speedup, force_audio, hdmi_stream_channels, hdmi_channel_map, display_power, read_ring_osc, memtest, dispmanx_list, get_rsts, schmoo, render_bar, disk_notify, inuse_notify, sus_suspend, sus_status, sus_is_enabled, sus_stop_test_thread, egl_platform_switch, mem_validate, mem_oom, mem_reloc_stats, hdmi_cvt, hdmi_timings, file"

2017年2月22日 星期三

[ Windows ] Windows 10 手動修復 UEFI 無法開機

將電腦 BIOS 設定開機裝置為光碟機以後,利用 Windows 10 安裝光碟來開機,出現「Press any key to boot from CD or DVD」訊息以後,按一下鍵盤上的任意按鍵來進入安裝光碟內容。


進入 Windows 安裝程式畫面以後,按一下〔下一步〕繼續。接下來點擊左下角的「修復您的電腦」。


在「選擇選項」畫面中點擊「疑難排解」項目。進入「疑難排解」畫面以後,再點擊「進階選項」。 


最後一層我們要點擊「命令提示字元」。


開啟命令提示字元視窗以後,先輸入「diskpart」後按一下[Enter]。 


接下來在啟動 DiskPart 以後,輸入「list disk」來檢視電腦中的所有硬碟。 


電腦中只有一顆硬碟,輸入「select disk 0」,如果你有其他顆硬碟的話,請確定開機磁區所在的硬碟編號後再輸入指令喔。 


接著再輸入「list volume」來列出硬碟上的所有磁區,因為即使在檔案總管上看起來電腦中只有 C 槽而已,其實還是有隱藏的磁區喔! 


我們要選擇的磁區,是 UEFI 版 Windows 要用來開機的分割區,格式為 FAT32,大小約 100 ~ 300 MB 左右,圖中符合這個條件的是「磁碟區 4」,所以我們輸入「select volume 4」來選擇它。 


選擇完畢以後,我們要將這個磁區賦予一個磁碟機代號,方便接下來的操作,因此小編輸入「assign letter Z」,將此分割區設定為 Z 槽。 


接下來我們輸入「exit」來離開 DiskPart,回到命令提示字元的預設路徑中。 


接著我們再輸入「rd /s /q “Z:\EFI\”」來刪除開機磁區(Z槽)中的所有檔案。


清除完成以後,先輸入「bootrec /fixboot」來修復開機功能。 


最後我們要輸入「bcdboot “C:\Windows” /l zh-tw /s Z: /f UEFI」,按下[Enter]後如果出現「開機檔案已順利建立」訊息,即可重新開機試試看能不能正常進入桌面囉!

「bcdboot “C:\Windows”」:設定 Windows 資料夾的路徑;

「/l zh-tw」:將語系設定為正體中文;

「/s Z:」:指定開機磁區為 Z 槽;


「/f UEFI」:指定 BIOS 格式為 UEFI。

2017年2月20日 星期一

[ Linux ] SD Card Format

查看裝置名稱
$ df

插入USB儲存裝置

查看裝置名稱
$ df

卸載儲存裝置
$ sudo umount /dev/sdb1

格式化成FAT32
$ sudo mkdosfs -F 32 -v /dev/sdb1

格式化成FAT32、檢查磁區、設定磁碟標籤
$ sudo mkdosfs -cF 32 -n 64GB -v /dev/sdb1

[ 儲存媒體 ] 送修

PNY 必恩威 http://www.pny.com.tw
客服中心
302 新竹縣竹北市台元一街一號10樓之1 (台元科技園區O棟)
消費者服務專線:0800-012358
客服信箱:TWCSR@pny.com
服務時間:星期一 ~ 星期五 上午09:00 ~ 12:00 下午13:00 ~18:30
維修進度查詢

2017年2月16日 星期四

[ PHP ] phpSysInfo 3.2.7

官方網站:http://phpsysinfo.github.io/phpsysinfo/
檔案來源:https://github.com/phpsysinfo/phpsysinfo/releases/

Installation and Usage

  • Just extract phpSysInfo in your web directory
  • Create your config file: cp phpsysinfo.ini.new phpsysinfo.ini
  • Open a web browser

2017年2月5日 星期日

No-IP 帳號及子網域名稱註冊


No-IP’s Dynamic Update Client
$ mkdir /home/pi/noip
$ cd /home/pi/noip
$ tar vzxf noip-duc-linux.tar.gz
$ cd noip-2.1.9-1
$ sudo make
$ sudo make install >>> /usr/local/bin/noip2 >>> /usr/local/etc/no-ip2.conf
$ sudo /usr/local/bin/noip2 -C >>> config
$ sudo /usr/local/bin/noip2
To confirm that the service is working properly you can run the following command.
$ sudo noip2 ­-S (Capital “S”)

[ Raspberry Pi ] RASPBIAN JESSIE LITE 2017-01-11

OS:Raspbian
Download:RASPBIAN JESSIE LITE
Minimal image based on Debian Jessie
Version: January 2017
Release date: 2017-01-11
Kernel version: 4.4

$ diskutil umountDisk disk2

$ sudo dd bs=1m if=path_of_your_image.img of=/dev/disk2


Raspbian, the username is 'pi' and the password is 'raspberry'.
重新開啟root帳號,可由pi用戶登錄後,在命令行下執行
$ sudo passwd root
執行此命令後系統會提示輸入兩遍的root密碼,輸入你想設的密碼即可,然後再執行
$ sudo passwd –unlock root
修改時區 $ sudo tzselect
鍵盤配置 $ sudo nano /etc/default/keyboard
XKBLAYOUT="us"
To configure the board to use DHCP  settings:
$ sudo nano /etc/network/interfaces
iface eth0 inet dhcp
or static IP
iface eth0 inet static
  address 192.168.1.240
  netmask 255.255.255.0
  gateway 192.168.1.254

sudo raspi-config >>> ssh
停用console螢幕保護
$ sudo nano /etc/kbd/config
BLANK_TIME=0
POWERDOWN_TIME=0
NTP $ sudo nano /etc/ntp.conf
server time.stdtime.gov.tw
$ sudo service ntp restart
安裝更新
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install pppoecon
$ sudo pppoeconf >>> /etc/network/interfaces <<< 啟動時自動連線
連接上網 $ pon dsl-provider
中斷連線 $ poff
可以用管理員身份打「plog」顯示pppd的日誌
$ ip addr show ppp0


# sudo apt-get update && sudo apt-get upgrade
# sudo apt-get install pptpd
# sudo nano /etc/pptpd.conf
localip 192.168.1.240
remoteip 192.168.1.241-244,192.168.1.245
# sudo nano /etc/ppp/pptpd-options
ms-dns 8.8.8.8
noipx
mtu 1490
mru 1490
# sudo nano /etc/sysctl.conf
net.ipv4.ip_forward=1
sudo nano /etc/rc.local
>>> pppoe >>>
      • sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
# sudo nano /etc/ppp/chap-secrets
// Username[TAB]*[TAB]password[TAB]*
vpn     * vpn1234   *
# sudo service pptpd restart



[ HTML ] 轉址方法


  • HTML 的轉址方法
在 HTML 網頁的 </head> 前加入以下 HMTL 碼,網頁就會自動轉址。 
<meta http-equiv="refresh" content="0; url=https://www.blogger.com" />
其中 content=... 中的 0 是指 0 秒後自動重新整理,並轉址到
"https://www.blogger.com" 這個 URL。 

  • Javascript 的轉址方法
<script> document.location.href="https://www.blogger.com"; </script>

  • PHP 的轉址方法
<?php 
header'Location: https://www.blogger.com);
exit;
?>

2017年2月2日 星期四

[ Mac OS X ] Python 3.6.0

官方網站:https://www.python.org
檔案來源:https://www.python.org/downloads

安裝:
python-3.6.0-macosx10.6.pkg
執行:
開啟 終端機
$ python3 --version
Python 3.6.0



2017年1月5日 星期四

[ EZGO 13 ] MariaDB 10.1.21

官方網站:https://mariadb.com/
檔案來源:http://www.linuxfromscratch.org/blfs/view/svn/server/mariadb.html

$ sudo groupadd -g 51 mysql

$ sudo useradd -c "MySQL Server" -d /RAID/local/srv/MySQL -g mysql -s /bin/false -u 51 mysql

$ sed -i "s@data/test@\${INSTALL_MYSQLTESTDIR}@g" sql/CMakeLists.txt

Option
  • 如果沒有 cmake 執行 $ sudo apt install cmake 
  • 如果沒有 /usr/bin/c++ 執行 sudo apt install g++
  • Curses library not found 執行 $ sudo apt install libncurses5-dev
  • Could NOT find LibXml2 執行 sudo apt install libxml2-dev
  • Could NOT find JNI
    修改 /usr/share/
    cmake-3.5/Modules/FindJNI.cmake
    增加:
JAVA_APPEND_LIBRARY_DIRECTORIES(
/usr/lib/jvm/java-8-oracle/jre/lib/{libarch}
)
list(
/usr/lib/jvm/java-8-oracle/include
)
      • Bison executable not found in PATH 執行 $ sudo apt install bison
      $ cmake \
              -DCMAKE_BUILD_TYPE=Release \
              -DCMAKE_CXX_COMPILER=/usr/bin/g++ \
              -DCMAKE_INSTALL_PREFIX=/RAID/local/srv/MySQL \
              -DDEFAULT_CHARSET=utf8 \
              -DDEFAULT_COLLATION=utf8_general_ci \
              -DEXTRA_CHARSETS=all \
              -DENABLED_LOCAL_INFILE=1 \
              -DINSTALL_DOCDIR=share/doc/mysql \
              -DINSTALL_DOCREADMEDIR=share/doc/mysql \
              -DINSTALL_MANDIR=share/man \
              -DINSTALL_MYSQLSHAREDIR=share/mysql \
              -DINSTALL_MYSQLTESTDIR=share/mysql/test \
              -DINSTALL_PLUGINDIR=lib/mysql/plugin \
              -DINSTALL_SBINDIR=sbin \
              -DINSTALL_SCRIPTDIR=bin \
              -DINSTALL_SQLBENCHDIR=share/mysql/bench \
              -DINSTALL_SUPPORTFILESDIR=share/mysql \
              -DMYSQL_DATADIR=/RAID/DB \
              -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock \
              -DWITH_EXTRA_CHARSETS=complex \
              -DWITH_EMBEDDED_SERVER=ON \
              -DTOKUDB_OK=0
      PS:
      • 如果有 /usr/bin/c++ 用 -DCMAKE_CXX_COMPILER=/usr/bin/c++ 
      • 如果有 /usr/bin/g++ 用 -DCMAKE_CXX_COMPILER=/usr/bin/g++
      $ make

      $ sudo make install

      $ install -v -dm 755 /RAID/local/conf

      $ cat > /RAID/local/conf/my.cnf << "EOF"

      # Begin /RAID/local/conf/my.cnf

      # The following options will be passed to all MySQL clients
      [client]
      #password = your_password
      port = 3306
      socket = /run/mysqld/mysqld.sock
      default-character-set=utf8

      # The MySQL server
      [mysqld]
      port = 3306
      socket = /run/mysqld/mysqld.sock
      datadir = /RAID/DB
      character-set-server=utf8
      collation-server=utf8_general_ci
      skip-external-locking
      key_buffer_size = 16M
      max_allowed_packet = 1M
      sort_buffer_size = 512K
      net_buffer_length = 16K
      myisam_sort_buffer_size = 8M

      # Don't listen on a TCP/IP port at all.
      skip-networking

      # required unique id between 1 and 2^32 - 1
      server-id = 1

      # Uncomment the following if you are using BDB tables
      #bdb_cache_size = 4M
      #bdb_max_lock = 10000

      # Uncomment the following if you are using InnoDB tables
      #innodb_data_home_dir = /RAID/local/srv/MySQL
      #innodb_data_file_path = ibdata1:10M:autoextend
      #innodb_log_group_home_dir = /RAID/local/srv/MySQL
      # You can set .._buffer_pool_size up to 50 - 80 %
      # of RAM but beware of setting memory usage too high
      #innodb_buffer_pool_size = 16M
      #innodb_additional_mem_pool_size = 2M
      # Set .._log_file_size to 25 % of buffer pool size
      #innodb_log_file_size = 5M
      #innodb_log_buffer_size = 8M
      #innodb_flush_log_at_trx_commit = 1
      #innodb_lock_wait_timeout = 50

      [mysqldump]
      quick
      max_allowed_packet = 16M

      [mysql]
      no-auto-rehash
      # Remove the next comment character if you are not familiar with SQL
      #safe-updates

      [isamchk]
      key_buffer_size = 20M
      sort_buffer_size = 20M
      read_buffer = 2M
      write_buffer = 2M

      [myisamchk]
      key_buffer_size = 20M
      sort_buffer_size = 20M
      read_buffer = 2M
      write_buffer = 2M

      [mysqlhotcopy]
      interactive-timeout

      # End /RAID/local/conf/my.cnf
      EOF

      安裝資料庫
      $ sudo /RAID/local/srv/MySQL/bin/mysql_install_db --basedir=/RAID/local/srv/MySQL --defaults-file=/RAID/local/conf/my.cnf --datadir=/RAID/DB --user=mysql

      $ sudo chown -R mysql:mysql /RAID/DB

      $ sudo install -v -m755 -o mysql -g mysql -d /run/mysqld

      啟動資料庫服務
      $ sudo /RAID/local/srv/MySQL/bin/mysqld_safe --defaults-file=/RAID/local/conf/my.cnf --datadir=/RAID/DB --user=mysql 2>&1 >/dev/null &

      設定資料庫管理員密碼
      $ sudo /RAID/local/srv/MySQL/bin/mysqladmin -u root password

      停止資料庫服務
      $ sudo /RAID/local/srv/MySQL/bin/mysqladmin -p shutdown

      /RAID/local/srv/MySQL/bin/mysql -u root -pPassword
      mysql > GRANT ALL PRIVILEGES ON Database.* TO user@192.168.1.% IDENTIFIED BY 'password' WITH GRANT OPTION;
      mysql > FLUSH PRIVILEGES;

      [ EZGO13 ] Apache 2.4.25 + PHP 7.1.6

      官方網站:http://httpd.apache.org
      檔案來源:http://httpd.apache.org/download.cgi#apache24
      $ ./config \
      -fPIC \--prefix=/RAID/local/lib/OpenSSL \
      --openssldir=/RAID/local/lib/OpenSSL
      $ make
      $ sudo make install
      /RAID/local/lib/OpenSSL/bin/openssl version

      ODBC:
      ./configure \
      --prefix=/RAID/local/lib/unixODBC \
      --exec-prefix=/RAID/local/lib/unixODBC
      make
      sudo make install
      To check the ODBC version and configuration.
      /RAID/local/lib/unixODBC/bin/odbcinst -j
      unixODBC 2.3.4
      DRIVERS............: /RAID/local/lib/unixODBC/etc/odbcinst.ini
      SYSTEM DATA SOURCES: /RAID/local/lib/unixODBC/etc/odbc.ini
      FILE DATA SOURCES..: /RAID/local/lib/unixODBC/etc/ODBCDataSources
      USER DATA SOURCES..: /home/neo/.odbc.ini
      SQLULEN Size.......: 8
      SQLLEN Size........: 8
      SQLSETPOSIROW Size.: 8
      參數設定: 
      sudo nano /RAID/local/lib/unixODBC/etc/odbcinst.ini
      [FreeTDS]
      Description=v0.91 with protocol v8.0
      Driver=/RAID/local/lib/unixODBC/lib/libtdsodbc.so
      UsageCount=1
      sudo nano /RAID/local/lib/unixODBC/etc/odbc.ini
      [SQLServer]
      Driver=FreeTDS
      Description=SQL
      Trace=No
      Server=
      192.168.1.21
      Port=1433
      TDS_Version=8.0
      Database=DW
      PS
      odbcinst -q -d # View loaded drivers.
      odbcinst -q -s # View DSN entry
      tsql -LH 22.33.55.44 # To list MSSQL server instant name,version etc.,
      osql -S DSN -U Username -P ‘Password’ # list the configuration files loaded to connect ODBC 
      ./configure \
      --prefix=/RAID/local/lib/FreeTDS \
      --exec-prefix=/RAID/local/lib/FreeTDS \
      --with-tdsver=auto \
      --with-unixodbc=/RAID/local/lib/unixODBC \
      --with-gnu-ld \
      --enable-msdblib
      make
      sudo make install
      sudo nano /etc/ld.so.conf
      /RAID/local/lib/FreeTDS/lib
      sudo ldconfig
      sudo nano /RAID/local/lib/FreeTDS/etc/freetds.conf
      [MSsql]
      host = 
      192.168.1.21
      # instance = SQLEXPRESS
      # instance = MSSQLSERVER
      port = 1433
      client charset = UTF-8
      tds version = 8.0
      text size = 20971520
      Note: the freetds.conf file you use should have "text size = 20971520" as mentioned in the FreeTDS on Windows section otherwise you might see sessions logging out or worse apache segmentation faults. Also see FreeTDS.
      sudo touch /RAID/local/lib/FreeTDS/include/tds_sysdep_public.h
      sudo touch /RAID/local/lib/FreeTDS/lib/libsybdb.a
      連線測試
      sudo /RAID/local/lib/FreeTDS/bin/tsql -S MSsql -U sa
      Note: 
      TDSVER=8.0
      tsql -H [伺服器名稱  xxxx.database.windows.net ] -p 1433 –D [資料庫名稱 ] -U [使用者帳號 -P [使用者密碼 ]

      Apache Portable Runtime
      http://apr.apache.org/download.cgi
      $ ./configure \
      --prefix=/RAID/local/lib/APR \
      --exec-prefix=/RAID/local/lib/APR
      $ make
      $ make install
      $ ./configure \
      --prefix=/RAID/local/lib/APR-iconv \
      --exec-prefix=/RAID/local/lib/APR-iconv \
      --with-apr=/RAID/local/lib/APR
      make
      $ make install
      $ ./configure \
      --prefix=/RAID/local/lib/APR-util \
      --exec-prefix=/RAID/local/lib/APR-util \
      --with-apr=/RAID/local/lib/APR \
      --with-apr-iconv=RAID/local/lib/APR-iconv \
      --with-crypto=/RAID/local/lib/OpenSSL \
      --with-freetds=/RAID/local/lib/FreeTDS \
      --with-mysql=/RAID/local/srv/MySQL \
      --with-openssl=/RAID/local/lib/OpenSSL
      make
      $ make install
      sudo nano /etc/ld.so.conf
      /RAID/local/lib/APR-util/lib
      PERL 5 regular expression pattern matching
      $ ./configure \
      --prefix=/RAID/local/lib/PCRE \
      --exec-prefix=/RAID/local/lib/PCRE \
      --enable-utf8
      make
      $ make install
      A Massively Spiffy Yet Delicately Unobtrusive Compression Library
      ./configure \
      --prefix=/RAID/local/lib/zlib \
      --eprefix=/RAID/local/lib/zlib
      make
      $ make install
      • Apache
      $ ./configure \
      --prefix=/RAID/local/srv/Apache \
      --exec-prefix=/RAID/local/srv/Apache \
      --enable-ssl \
      --enable-so \
      --enable-deflate \
      --enable-modules=mod_unixd \
      --enable-modules=mod_access_compat \
      --with-apr=/RAID/local/lib/APR \
      --with-apr-util=/RAID/local/lib/APR-util \
      --with-pcre=/RAID/local/lib/PCRE \
      --with-ssl=/RAID/local/lib/OpenSSL
      $ nano /RAID/local/Apache/conf/httpd.conf
      ServerRoot "/RAID/local/srv/Apache"
      ServerAdmin email@gmail.com
      ServerName 127.0.0.1:80
      DocumentRoot "/RAID/local/www"
      ErrorDocument 404 /404_Apple.html
      AddDefaultCharset utf-8
      <Directory "/RAID/local/www">
      ScriptAlias /cgi-bin/ "/RAID/local/www/cgi-bin/"
      <Directory "/RAID/local/www/cgi-bin">
      AddType application/x-httpd-php .php
      <IfModule dir_module>
          DirectoryIndex index.html index.htm index.php
      </IfModule>
      ErrorLog "|/RAID/local/srv/Apache/bin/rotatelogs -l /RAID/Log/Apache-error-%Y-%m-%d.log 86400"
      CustomLog "|/RAID/local/srv/Apache/bin/rotatelogs -l /RAID/Log/Apache-access-%Y-%m-%d.log 86400" common
      LoadModule rewrite_module modules/mod_rewrite.so
      LoadModule php7_module modules/libphp7.so 
      • apachectl - Apache HTTP Server Control Interface
      $ sudo /RAID/local/srv/Apache/bin/apachectl configtest
      $ sudo /RAID/local/srv/Apache/bin/apachectl start
      $ sudo /RAID/local/srv/Apache/bin/apachectl restart
      $ sudo /RAID/local/srv/Apache/bin/apachectl stop

      官方網站:http://php.net
      檔案來源:http://php.net/downloads.php
      • $ sudo apt install libjpeg-dev
      • sudo apt install libpng++-dev
      • sudo apt install libxpm-dev
      • sudo apt install libxft-dev
      • sudo apt install libmcrypt-dev
      • sudo apt install libssh2-1-dev
      • sudo apt install libgmp-dev
      • sudo apt install libtool-bin
      • sudo apt install re2c
      • sudo apt install autoconf
      ./configure \
      --prefix=/RAID/local/lib/cURL \
      --exec-prefix=/RAID/local/lib/cURL \
      --with-libssh2
      make
      $ make install
      $ ./configure \
      --prefix=/RAID/local/srv/PHP \
      --exec-prefix=/RAID/local/srv/PHP \
      --with-config-file-path=/RAID/local/conf \
      --with-pdo-mysql=/RAID/local/srv/MySQL \
      --with-mysqli=mysqlnd \
      --with-pdo-dblib=/RAID/local/lib/FreeTDS \
      --with-pdo-mysql=/RAID/local/srv/MySQL \
      --with-pdo-odbc=unixODBC,/RAID/local/lib/unixODBC \
      --with-apxs2=/RAID/local/srv/Apache/bin/apxs \
      --with-curl=/RAID/local/lib/cURL \
      --with-openssl \
      --with-pear \
      --with-mcrypt \
      --with-zlib \--with-jpeg-dir \
      --with-png-dir \
      --with-xpm-dir \
      --with-freetype-dir \
      --with-gd \
      --with-gmp \

      --enable-bcmath \
      --enable-intl \
      --enable-fpm \
      --enable-ftp \
      --enable-zip \
      --enable-mbstring \
      --enable-mysqlnd \
      --enable-re2c-cgoto \
      --enable-sockets \
      --enable-soap \
      --enable-debug \

      --enable-gd-native-ttf \
      --enable-gd-jis-conv
      make
      $ make install
      $ cp php.ini-production /RAID/local/conf/php.ini
      $ sudo /RAID/local/srv/Apache/bin/apachectl stop
      $ sudo /RAID/local/srv/Apache/bin/apachectl start
      $ wget http://pear.php.net/go-pear.phar
      $ sudo /RAID/local/srv/PHP/bin/php go-pear.phar
      $ /RAID/local/srv/PHP/bin/pear version

      [ EZGO13 ] ProFTP 1.3.6rc4

      官方網站:http://www.proftpd.org
      檔案來源:http://ftp.heanet.ie/mirrors/ftp.proftpd.org/distrib/source/proftpd-1.3.6rc4.tar.gz

      $ sudo apt-get install libwrap0-dev

      $ ./configure \
      --prefix=/RAID/local/srv/ProFTP \
      --exec-prefix=/RAID/local/srv/ProFTP \
      --enable-shadow \
      --enable-autoshadow \
      --enable-openssl \
      --with-modules=mod_ratio:mod_readme:mod_wrap \
      --with-openssl-cmdline=/RAID/local/lib/OpenSSL/bin

      $ make

      $ sudo make install

      $ nano /RAID/local/conf/proftpd.conf
      PersistentPasswd on
      ServerAdmin email@gmail.com

      關閉 Ident 和使用者網域反查
      IdentLookups off
      UseReverseDNS off

      使用本地時間
      SetEnv TZ :/etc/localtime
      TimesGMT off

      設定支援下載續傳、上傳續傳、支援 FXP
      AllowStoreRestart on
      AllowRetrieveRestart on
      AllowForeignAddress on

      顯示站台歡迎訊息
      DeferWelcome on

      允許被設定成不得由遠端登入的帳號 (invalid shell) 能 FTP 進來
      RequireValidShell off

      設定使用者登入和登出會看到的訊息檔
      DisplayLogin /RAID/local/conf/proftpd_welcome.msg
      DisplayQuit /RAID/local/conf/proftpd_logout.msg

      指定站台系統 Log 位置
      SystemLog /RAID/Log/ProFTP_proftpd.log

      ScoreboardFile /var/run/proftpd.scoreboard

      PidFile /var/run/proftpd.pid

      定義 Log 格式,紀錄登入 (login.log) 和傳檔 (transfer.log) 的細節
      # TransferLog /RAID/Log/xferlog
      LogFormat myxfer "%{%Y-%m-%d %H:%M:%S}t [%u] \"%m %f\" (%bB/%TS)"
      LogFormat myauth "%{%Y-%m-%d %H:%M:%S}t [%u] \"%r\": %S (%a)"
      ExtendedLog /RAID/Log/ProFTP_login.log auth myauth
      ExtendedLog /RAID/Log/ProFTP_transfer.log read,write myxfer


      • 歡迎訊息(會顯示登入位址、伺服器時間、硬碟可用空間、目前路徑和連線數量)
      $ nano /RAID/local/conf/proftpd_welcome.msg
      Welcome %U from %R to %L site !
      Current Time: %T
      Available Capacity: %F KB
      Current Directory: %C
      Current/Max Allow Connection: %N/%M
      • 登出的訊息檔(會顯示連線完,總共上傳和下載的檔案和容量)
      $ nano /RAID/local/conf/proftpd_logout.msg
      Upload: %{total_bytes_in} bytes, %i files
      Download: %{total_bytes_out} bytes, %o files
      Bye Bye, %U from %R !
      • 啟動 ProFTP
      $ sudo /RAID/local/srv/ProFTP/sbin/proftpd -c /RAID/local/conf/proftpd.conf &



      OpenSSL 1.1.0c

      官方網站:https://www.openssl.org/
      檔案來源:https://www.openssl.org/source/

      2017年1月4日 星期三

      [ Ubuntu ] ssh Server


      • 安裝
      $ sudo apt-get install openssh-server
      • 組態檔設定
      $ sudo nano /etc/ssh/sshd_config
      # 把允許 Root 登入的參數改掉
      PermitRootLogin no
      • 啟動
      $ sudo /etc/init.d/ssh restart
      • 開機自動啟動
      $ sudo update-rc.d ssh defaults