顯示具有 ubuntu 標籤的文章。 顯示所有文章
顯示具有 ubuntu 標籤的文章。 顯示所有文章

vi 輸入方向鍵上下左右,會出現ABCD

Posted by on | | 0 意見
vi在“輸入模式”(inser mode)時:
1.輸入方向鍵會出現ABCD
2.倒退鍵(Backspace)沒有用

可以在user的家目錄下,新增檔案“.vimrc",在檔案中加入下列2行內容:
set nocompatible
set backspace=2

存檔離開。
再重新使用vi時,方向和倒退鍵就有用囉~

PostgreSql如何新增使用者

Posted by on | | 0 意見

psql 進入後,下底下的指令即可:

CREATE USER username WITH PASSWORD 'password';
ALTER USER username  WITH PASSWORD 'password' VALID UNTIL 'infinity';
ALTER USER username  WITH PASSWORD 'password' VALID UNTIL 'Jan 31 2030';

參考資料:
http://www.postgresql.org/docs/8.0/static/sql-alteruser.html
http://www.cyberciti.biz/faq/howto-add-postgresql-user-account/

PostgreSql 如何本機登入呢?

Posted by on | | 0 意見

** OS系統:
本機只能用 postgres 這個user,來操作 postgresql
#sudo -s
#su postgres

進入 postgresql 的指令:psql
#psql

ubuntu source.list

Posted by on | | 0 意見
今天發現一個好站
http://repogen.simplylinux.ch/

可以産生指定server的source.list

因為用了國外人的ubuntu server image,改連到比較近的mirror server,還是會比較快的!


1秒鐘,1行指令,裝好lamp server on ubuntu

Posted by on | | 0 意見

裝了很多次後,人是會懶的,科技來自於人性~


執行底下指令:
apt-get install lamp-server^

ps:真的有^符號
可參考:Install Lamp Server on Ubuntu

tw.archive.ubuntu.com有時會連不上,ubuntu 的 apt-get install 就會失敗!

Posted by on | | 0 意見


解法:用其他來源!

編輯來源表:
vi /etc/apt/sources.list

取代所有的:
:%s/tw.archive.ubuntu.com/mirror.nttu.edu.tw/g

存檔:
:qw

更新:
apt-get update



ps:好用的指令
Every occurrence in file:              :%s/OLD/NEW/g

如何在ubuntu底下使用網路atm呢?

Posted by on | | 0 意見

如何在ubuntu底下使用網路atm呢?

網路己經有很多解答了,重點整埋如下:

  1. 安裝drivers
  2. 安裝firefox
  3. 安裝firefox-pluging for 玉山銀行的webATM

ubuntu之VI的上上下下左右左右BA

Posted by on | | 0 意見

今天重灌完ubuntu後,vi在editor模式時,上下左右鍵竟然失去功能,怎麼按都會出現ABCD,backspace也沒有效了方法,怎麼辦??
後來發現最簡單的,就是在自己的家目錄下,新增一個檔案,$HOME/.vimrc,裡頭加入3行:
set nocompatible
set backspace=indent,eol,start
set bs=2

這時再使用vi就正常囉~

ubuntu 如何安裝 spotify 呢?

Posted by on | | 0 意見

ubuntu 如何安裝 spotify 呢?

執行底下的指令即可:
sudo add-apt-repository http://repository.spotify.com stable non-free
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 94558F59
sudo apt-get update
sudo apt-get install spotify-client

請參考:
https://www.spotify.com/tw/download/previews/

ubuntu 中,如何産生.desktop的檔案呢?

Posted by on | | 0 意見

.desktop副檔名的檔案,是可以放在桌面上,來啟動應用程式地~(看起來是,沒有認真研究)

os:ubuntu 13.xx

執行底下指令:
gnome-desktop-item-edit xxxxx.desktop --create-new

xxxxx.desktop 就是您要建立的檔名

建立好後,再copy到您桌面上,就可以用滑鼠click它囉~

可參考底下這一篇:
http://askubuntu.com/questions/67925/how-to-create-a-desktop-shortcut-in-unity


xxxxx.desktop這個檔案,其實是個純文字檔,裡頭設定啟動時需要的資訊,
可參考底下這篇:
https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles


ubuntu + drupal + apache solr

Posted by on | | 0 意見

**需要先安裝java環境:
apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

**下載 apache solr:
http://www.apache.org/dyn/closer.cgi/lucene/solr/4.5.1

解壓縮,出現目錄,solr-4.5.1
cd solr-4.5.1/example
java -jar start.jar

就可以啟動solr server囉~
(因為solr有內建jetty)
查看 solr 狀態 - http://您的server:8938/solr

**加入中文分詞功能:
https://code.google.com/p/ik-analyzer/

下載 IK Analyzer 2012FF_hf1.zip
解壓縮,出現目錄,IK Analyzer 2012FF_hf1
cd IK Analyzer 2012FF_hf1
cp IKAnalyzer.cfg.xml solr-4.5.1/example/etc
cp stopword.dic solr-4.5.1/example/etc
cp yours.dic solr-4.5.1/example/etc

vi solr-4.5.1/example/solr/collection1/conf/schema.xml
修改或加入底下設定:

< fieldType name="text" class="solr.TextField" >
< analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/ >
< /fieldType >

**Drupal 要加入二個model:
search api - https://drupal.org/project/search_api
search api solr search - https://drupal.org/project/search_api_solr

完成~

ubuntu 上如何 新增 opencc-php ?

Posted by on | | 0 意見


1.安裝opencc
$ apt-cache search opencc
libopencc-dev - simplified-traditional chinese conversion library - development
libopencc0 - simplified-traditional chinese conversion library - runtime
opencc - simplified-traditional chinese conversion tool

$ apt-get install opencc libopencc-dev

2.安裝php5-dev
$ apt-get install php5-dev

3.下載opencc-php
https://github.com/BYVoid/opencc-php


4.製作 php 的 extenstion : opencc.so
cd opencc-php
phpize
./configure
make
make install (root)

5.修改php.ini,加入一行:
cd /private/etc
vi php.ini

extension=opencc.so

6.重啟apache:
service apache2 restart

7.測試:
請到剛剛下載的open-cc目錄裡,有個測試程式:opencc.php

8.完成囉,讚!


如何安裝 opencc ? 如何讓 mac 的 php 也呼叫 opencc 來轉碼 ??

Posted by on | | 0 意見


開發環境:
mac os 10.6.8
PHP 5.3.15

需要的工具:
ruby (mac有預設安裝)
homebrew
phpize(phpize 命令是用來準備 PHP 外掛模組的編譯環境的。)
opencc
opencc-php

安裝:

如何改變ubuntu預設的文字編輯器呢?How to change the default editor in ubuntu?

Posted by on | | 0 意見


因為ubuntu預設的editor是nano,但在中文commend環境下,它常常跳行會錯誤。

所以想要改預設的editor,只要下底下的指令,就會顯示目前預設的,以及您要改成那一個:

sudo update-alternatives --config editor

就醬~


好用的console的指令

Posted by on | | 0 意見

CTRL+A = 游標移到最“前”方
CTRL+E = 游標移到最“後”方
CTRL+U = 刪除游標“前”的所有資料
CTRL+K = 刪除游標“後”的所有資料
CTRL+L = 類似“clear”指令

ubuntu無法更新-Unable to connect to mirror.nttu.edu.tw

Posted by on | | 0 意見

ubuntu無法更新

問題:
Unable to connect to mirror.nttu.edu.tw

解法:
1.sudo vi /etc/apt/sources.list

2.把 mirror.nttu.edu.tw 全取代成 "可更新ubuntu的主機位置"
例如:
:1,$s/mirror.nttu.edu.tw/ubuntu.cs.nctu.edu.tw/g

3.sudo apt-get update //更新最新的套件資訊

4.sudo apt-get upgrade //更新套件程式(這一步找時間再做就可以了)


ubuntu上安裝exim4

Posted by on | | 0 意見
不想主機變成別人的轉信站,所以找了個純送信的軟體來裝,看起來exim4好像還蠻多人裝的!

安裝步驟:
Step1:安裝 exim4 (MTU:純送信元件)
apt-get install exim4-daemon-light mailutils

Step2:設定組態檔
dpkg-reconfigure exim4-config
設定請參考網路上的文章
反正一路安enter,就ok了(除了要輸入smtp server的地方)

======================================================
設定步驟如下:(僅供參考)

使用 smarthost 來傳送郵件;並藉由 SMTP 或是 fetchmail 來接收郵件
mail sent by smarthost; received via SMTP or fetchmail

系統郵件名稱 (mail name):
輸入你的網域名稱(例如:code.onnie.biz)

在有 SMTP 連線傳入時,要進行監聽的 IP 位址 (listen on for incoming SMTP connections):
127.0.0.1(只寄這台主機的email)

要進行接收的其它郵件位址 (Other destinations for which mail is accepted):
保留空白

要替哪些主機進行郵件轉寄 (Machines to relay mail for):
保留空白

外寄郵件時所使用的 smarthost 的 IP 位址或主機名稱 (Machine handling outgoing mail for this host):
你的smtp server ip

是否在外送郵件中隱藏本機的郵件名稱 (hide local mail name in outgoing mail):
否 (No)

是否保持最小的 DNS 查詢量 (don’t keep number of DNS-queries minimal):
否 (No)

本機郵件的傳送方式:
存放在 /var/mail 裡的 mbox 格式

是否將設定檔分散成較小的檔案 (split configuration into small files):
否 (No)

root 及 postmaster 的郵件代收者:
輸入ubuntu系統中指定的使用者帳號(多位使用者的話,以空白字元來分隔)

完成!
===================================================


Step3:測試
echo "Hello ! " | mail -s "Testing Mail" xyz@aaa.bbb.ccc

Step4:查看log
tail -n 20 /var/log/exim4/mainlog

完成~~