[Ubuntu] SmartCard Reader issue

EZ100PU driver:

http://www.castech.com.tw/in-download-02.aspx?cid=C_00000001&id=P_00000001

install driver and install pcsc

# apt-get install pcscd pcsc-tools

# vi /etc/udev/rules.d/92-pcscd-ccid.rules

# If not adding the device, go away
ACTION!="add", GOTO="pcscd_ccid_rules_end"
SUBSYSTEM!="usb", GOTO="pcscd_ccid_rules_end"
ENV{DEVTYPE}!="usb_device", GOTO="pcscd_ccid_rules_end"

# Castles Technology Co., Ltd EZUSB PC/SC Smart Card Reader
ATTRS{idVendor}=="0ca6″, ATTRS{idProduct}=="0010″, GROUP="pcscd"

# All done
LABEL="pcscd_ccid_rules_end"

must correct idVender and idProduct by # lsusb

then restart udev # service udev restart

# pcscd -f

# pcsc_scan

http://softsmith.blogspot.tw/2011/10/ubuntu-1110-webatm.html

[Ubuntu] MySQL誤刪root忘記密碼

剛剛不小心誤刪root…真是悲劇

1.關閉服務
#/etc/init.d/mysql stop

2.安全模式啟動,不檢查權限
#mysqld_safe –-skip-grant-tables &

3.進入mysql指令
#mysql

4.選擇mysql資料庫
mysql> use mysql

5.加入名為root的user
mysql> insert into user set user=’root';

6.更新密碼
mysql> update user set password=password(‘123456′) where user=’root';

7.更新權限設定
mysql> update user set Host=’localhost’,select_priv=’y’, insert_priv=’y’,update_priv=’y’,
Alter_priv=’y’,delete_priv=’y’,create_priv=’y’,drop_priv=’y’,reload_priv=’y’,shutdown_priv=’y’,
Process_priv=’y’,file_priv=’y’,grant_priv=’y’,References_priv=’y’,index_priv=’y’,create_user_priv=’y’,
show_db_priv=’y’,super_priv=’y’,create_tmp_table_priv=’y’,Lock_tables_priv=’y’,execute_priv=’y’,
repl_slave_priv=’y’,repl_client_priv=’y’,create_view_priv=’y’,show_view_priv=’y’,create_routine_priv=’y’,
alter_routine_priv=’y’,create_user_priv=’y’,Event_priv=’y’,Trigger_priv=’y’ where user=’root';

8.套用新權限
mysql> flush privileges;

9.離開mysql
mysql> quit

10.強制關閉mysql服務
#killall mysqld

11.正常啟動mysql
#/etc/init.d/mysql start

[Ubuntu] rsync鏡像備份

1.先安裝cifs-utils,smbfs掛載cifs或smbfs
# apt-get install cifs-utils smbfs

2.測試掛載異地資料夾
# mount-t cifs //[ip]/[remote_folder] /backup -o username=user,password=pass
# mount -t smbfs //[ip]/[remote_folder] /backup -o username=user,password=pass

#df -h 查看掛載情況 //*.*.*.*/backup 1.9T 32G 1.8T 2% /backup

3.寫備份script
# vi /opt/autobackup.sh

#!/bin/sh
mount -t smbfs //*.*.*.*/backup /backup -o username=user,password=*****
today=`/bin/date +%Y%m%d`
mkdir -p /backup/$today
mysqldump -u root –password=***** –all-databases –lock-tables=0 > /backup/$today/all_databases.sql
rsync -av /var/www /backup/www_backups

 

#chmod 700 /opt/autobackup.sh
修改成可執行

4.測試執行備份
# /opt/autobackup.sh

5.加入自動排程
# crontab -e

30 23 * * * /opt/autobackup.sh

每天23點30分執行一次備份

 

以上mysql每天的備份都存在該天的資料夾

www為差異備份,鏡像至backup_www

[Ubuntu] Java runtime environment

Install Standard Java runtime environment
# apt-get install default-jre

List of jre:
# apt-cache search jre
default-jre – Standard Java or Java compatible Runtime
default-jre-headless – Standard Java or Java compatible Runtime (headless)
docbook-xsl – stylesheets for processing DocBook XML to various output formats
gcj-4.6-jre – Java runtime environment using GIJ/classpath
gcj-4.6-jre-headless – Java runtime environment using GIJ/classpath (headless version)
gcj-4.6-jre-lib – Java runtime library for use with gcj (jar files)
gcj-jre – Java runtime environment using GIJ/classpath
gcj-jre-headless – Java runtime environment using GIJ/classpath (headless version)
icedtea-6-jre-cacao – Alternative JVM for OpenJDK, using Cacao
icedtea-6-jre-jamvm – Alternative JVM for OpenJDK, using JamVM
libreoffice – office productivity suite
openjdk-6-jre – OpenJDK Java runtime, using Hotspot JIT
openjdk-6-jre-headless – OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-6-jre-lib – OpenJDK Java runtime (architecture independent libraries)
icedtea-7-jre-cacao – Alternative JVM for OpenJDK, using Cacao
icedtea-7-jre-jamvm – Alternative JVM for OpenJDK, using JamVM
libanimal-sniffer-java – JDK/API verification tools
libcommons-exec-java – a library to reliably execute external processes from within the JVM
libgeronimo-osgi-support-java – Java libraries providing OSGi lookup support for Geronimo projects
libgeronimo-osgi-support-java-doc – Documentation for libgeronimo-osgi-support-java
libjrexx-java – automaton based regular expression API for java
openjdk-6-jre-zero – Alternative JVM for OpenJDK, using Zero/Shark
openjdk-7-jre – OpenJDK Java runtime, using Hotspot JIT
openjdk-7-jre-headless – OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-7-jre-lib – OpenJDK Java runtime (architecture independent libraries)
openjdk-7-jre-zero – Alternative JVM for OpenJDK, using Zero/Shark

[Ubuntu] MySQL+Apache+PHP+phpmyadmin

懶人指令:
  • apt-get install mysql-server apache2 php5 libapache2-mod-auth-mysql php5-mysql phpmyadmin
MySQL database server
  • apt-get install mysql-server
Apache HTTP Server metapackage
  • apt-get install apache2
PHP server-side metapackage
  • apt-get install php5
Apache 2 module for MySQL authentication
  • apt-get install libapache2-mod-auth-mysql
MySQL module for php5
  • apt-get install php5-mysql
MySQL web administration tool
  • apt-get install phpmyadmin

[Ubuntu] apt-get 用法

搜尋套件:
apt-cache search [關鍵字]

查相依性:
apt-cache depends [套件]

更新清單:
apt-get update

更新套件:
apt-get -y dist-upgrade

安裝套件:
apt-get install [套件1] [套件2]

移除套件:
apt-get remove [套件1] [套件2]

情除暫存:
apt-get clean