先確認 /usr/sbin/sshd 是否存在,若已存在則繼續使用 ps -ef | grep ssh 確認 sshd (SSH Server) 是否執行。
若sshd檔案存在,只是尚未執行,可啟動ssd。
$ sudo /etc/init.d/ssh start
若以上皆確認不存在,則可以
$ sudo apt-get install openssh-server
進行安裝 SSH Server。
$ ssh localhost
設定開機時自動啟動 SSH Server。
$ sudo update-rc.d ssh defaults
測試一下
#
2014年3月30日 星期日
ASUS VC60 i3-3110M 安裝 ubuntu 14.04 (beta2)
先至 Ubuntu 官方網站下載 Ubuntu 14.04 (Beta 2) Desktop 64bits ISO
http://releases.ubuntu.com/14.04/ubuntu-14.04-beta2-desktop-amd64.iso
把iso檔案燒錄至USB隨身碟中,Windows 電腦可以使用 Win32 Disk Imager完成燒錄。
以Ubuntu 14.04 USB隨身碟開機,可試用、可安裝至ASUS VC60 i3-3110M的無作業系統版電腦。
測試結果:
Ubuntu 13.04 Desktop 64bits : 不支援VC60的無線網路卡、支援S/PDIF數位音效輸出及類比輸出
Ubuntu 13.10 Desktop 64bits : 無法完成開機(不知道原因為何)
Ubuntu 14.04 (Beta 2) Desktop 64bits : 支援VC60的無線網路卡、支援S/PDIF數位音效輸出及類比輸出
$ uname -a
Linux myhost 3.13.0-20-generic #42-Ubuntu SMP Fri Mar 28 09:56:33 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
好機器,不買嗎?:P
#
http://releases.ubuntu.com/14.04/ubuntu-14.04-beta2-desktop-amd64.iso
把iso檔案燒錄至USB隨身碟中,Windows 電腦可以使用 Win32 Disk Imager完成燒錄。
以Ubuntu 14.04 USB隨身碟開機,可試用、可安裝至ASUS VC60 i3-3110M的無作業系統版電腦。
測試結果:
Ubuntu 13.04 Desktop 64bits : 不支援VC60的無線網路卡、支援S/PDIF數位音效輸出及類比輸出
Ubuntu 13.10 Desktop 64bits : 無法完成開機(不知道原因為何)
Ubuntu 14.04 (Beta 2) Desktop 64bits : 支援VC60的無線網路卡、支援S/PDIF數位音效輸出及類比輸出
$ uname -a
Linux myhost 3.13.0-20-generic #42-Ubuntu SMP Fri Mar 28 09:56:33 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
好機器,不買嗎?:P
#
2014年2月3日 星期一
Mac OS X 10.9.1 + Wintec WBT-100 GPS Data Logger
準備工作:完成藍芽配對與應用程式安裝
完成 WBT-100 GPS 與 Mac OS X 藍芽配對
至 gpsbabel.org 下載 GPSBabel-1.4.4.dmg 並完成安裝
方法一:以GUI方式操作應用程式GPSBabelFE
選取 Device , 範例為 /dev/cu.WBT100-SPPslave
Download Format 為 Wintec WBT-100/200 GPS Download
設定Output Format為GPX XML, 範例 File Name 為 mytrack
按下Apply執行後,經過一小段時間,即可將GPS Data log 自WBT-100下載完成囉
以 Google Earth 開啟 mytrack
方法二:開終端機直接下指令
/Applications/GPSBabelFE.app/Contents/MacOS/gpsbabel -i wbt -f/dev/cu.WBT100-SPPslave -o gpx -F ~/Desktop/mytrack.gpx
2013年12月19日 星期四
ubuntu networking interface 設定
使用情境:
- eth0固定網卡 / wlan0無線網卡 各一
- 配置固定IP (eth0: 192.168.1.XX / wlan0: 192.168.1.YY)
- private network : 192.168.1.XXX
- gateway : 192.168.1.1
/etc/network/interfaces 設定檔內容:
auto lo iface lo inet loopback iface eth0 inet static address 192.168.1.XX netmask 255.255.255.0 gateway 192.168.1.1 allow-hotplug wlan0 iface wlan0 inet static wpa 2 wpa-ssid <YOUR_SSID> wpa-psk <YOUR_PASSWORD> address 192.168.1.YY netmask 255.255.255.0 gateway 192.168.1.1
*以上也適用 Raspberry Pi / Wheezy 環境
#
2013年11月29日 星期五
Mac OS X 安裝及使用 Homebrew
ubuntu apt 用習慣的朋友,應該也能很快適應 Homebrew for Mac OS X的。
安裝步驟參考官網及實際經驗筆記如下:
> ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
延伸閱讀:
安裝步驟參考官網及實際經驗筆記如下:
> ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
> brew update
接著就能安裝自己想要的 UNIX Packages,如:wget, curl, lynx ...
> brew install wget
> brew install lynx
查詢經安裝的套件列表
> brew list
或是想要移除已經安裝的套件
> brew uninstall wget
自動更新已經安裝的套件
> brew upgrade wget
其他功能可以藉由Help看指令參數及用法
> brew help
延伸閱讀:
#
2013年11月18日 星期一
Ubuntu precise amd64 安裝筆記
# apt-get update &
sudo apt-get -y update
sudo apt-get dist-upgrade
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev vim
# install python
sudo apt-get install build-essential
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
cd /tmp
wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar -xvf Python-2.7.6.tgz
cd Python-2.7.6
./configure
make
sudo make altinstall
# install easy_install for python 2.7
cd ..
sudo apt-get install python-setuptools
# install Flask for python
sudo easy_install Flask
# prepare to install uwsgi, nginx
sudo useradd -r -g www-data -s /bin/false uwsgi
sudo mkdir -p /var/www/myapp
sudo chown uwsgi:www-data /var/www/myapp -R
sudo useradd -G www-data myuser
sudo usermod -a -G www-data myuser
# install uwsgi
sudo pip install uwsgi
sudo mkdir -p /var/log/uwsgi
sudo touch /var/log/uwsgi/myapp.log
cd /var/www/myapp
sudo vi uwsgi.xml
sudo /usr/local/bin/uwsgi -x uwsgi.xml
# install nginx
sudo apt-get install nginx
sudo service nginx start
cd /etc/nginx/
cd sites-enabled/
sudo vi default
uwsgi.xml
<?xml version="1.0"?>
<uwsgi id="myapp">
<module>application:app</module>
<socket>/tmp/uwsgi.sock</socket>
<socket>127.0.0.1:8000</socket>
<processes>4</processes>
<chdir>/var/www/myapp</chdir>
<pidfile>/tmp/myapp.pid</pidfile>
<daemonize>/var/log/uwsgi/myapp.log</daemonize>
<stats>/tmp/myapp.stats</stats>
<log-format>``%(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) `` "%(referer)" "%(uagent)"</log-format>
<uid>uwsgi</uid>
<gid>www-data</gid>
<chmod-socket>775</chmod-socket>
</uwsgi>
/etc/nginx/sites-enabled/default
server {
listen 8080;
root /var/www/myapp;
server_name myapp;
try_files $uri @uwsgi;
location @uwsgi {
include uwsgi_params;
uwsgi_pass unix:/tmp/myapp.sock;
}
}
2013年11月14日 星期四
安裝 elasticsearch 與 python client for elasticsearch
安裝 elasticsearch
官網下載 http://www.elasticsearch.org/download/
解開壓縮檔後,至bin目錄下即可執行啟動 elasticsearch
> elasticsearch.bat 或 > elasticsearch.sh
安裝 urllib3 package
> easy_install urllib3 或 > pip install urllib3
或至官網下載https://pypi.python.org/pypi/elasticsearch
接著利用下列程式測試一下...
安裝 python client for elasticsearch package
接著利用下列程式 estest.py 測試一下...
測試成功結果 (timestamp依照系統時間而不同):
官網下載 http://www.elasticsearch.org/download/
解開壓縮檔後,至bin目錄下即可執行啟動 elasticsearch
> elasticsearch.bat 或 > elasticsearch.sh
安裝 urllib3 package
> easy_install urllib3 或 > pip install urllib3
或至官網下載https://pypi.python.org/pypi/elasticsearch
接著利用下列程式測試一下...
# -*- coding: utf-8 -*-
import urllib3
http = urllib3.proxy_from_url('http://proxy.hinet.net/')
r = http.request('GET', 'http://tekibrain.blogspot.com/')
print r.status # 正常的話應該會印出 '200',網站傳回 HTTP Return code '200'
print r.data # 印出網頁原始碼資料
安裝 python client for elasticsearch package
> easy_install elasticsearch
或者
> pip install elasticsearch
或至官網下載 https://pypi.python.org/pypi/urllib3
接著利用下列程式 estest.py 測試一下...
# -*- coding: utf-8 -*-
from datetime import datetime
from elasticsearch import Elasticsearch
# 預設連線至 ElasticSearch Server Port 9200, localhost:9200
es = Elasticsearch()
# 加入資料進行索引, 自己設定 id = 1
# http://localhost:9200/social/tweet/1
setdata = es.index(index="social", doc_type="tweet", id=1, body={"content": "大家好","user":{"name":"老王","id":670085},"tags":["demo","test"], "timestamp": datetime.now()})
print 'set data => '
print setdata
setdata = es.index(index="social", doc_type="tweet", id=2, body={"content": "大家好2","user":{"name":"小王","id":670086},"tags":["demo","test2"], "timestamp": datetime.now()})
print 'set data => '
print setdata
# 取得 id=1 資料
getdata = es.get(index="social", doc_type="tweet", id=1)['_source']
print '-------------------------'
print 'get data <= '
es.indices.refresh(index="social")
# Search:
qdoc = {
"query": {
"match" : {
"tags" : "demo"
}
}
}
getdata = es.search(index="social", body=qdoc)
print 'get data <= '
#print type(getdata)
print("Got %d Hits:" % getdata['hits']['total'])
for hit in getdata['hits']['hits']:
print("%(content)s %(user)s: %(tags)s" % hit["_source"])
測試成功結果 (timestamp依照系統時間而不同):
> python estest.py
set data =>
{u'_type': u'tweet', u'_id': u'1', u'ok': True, u'_version': 44, u'_index': u'social'}
set data =>
{u'_type': u'tweet', u'_id': u'2', u'ok': True, u'_version': 42, u'_index': u'social'}
-------------------------
get data <=
get data <=
Got 2 Hits:
大家好2 {u'name': u'\u5c0f\u738b', u'id': 670086}: [u'demo', u'test2']
大家好 {u'name': u'\u8001\u738b', u'id': 670085}: [u'demo', u'test']
#
訂閱:
文章 (Atom)