2014年4月9日 星期三

安裝debian server

RAM: 2G
硬碟:8G

欲安裝的軟體:
screen, sudo, vim, git, mysql( mysql-server, mysql-client,  ),

安裝sudo
http://sharadchhetri.com/2013/08/07/sudo-command-not-found-debian-7/
$ apt-get update
$ apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
$ sudo apt-get install vim
bash: sudo: command not found
$ su -
# apt-get install sudo
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  sudo
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 0 B/851 kB of archives.
After this operation, 1,885 kB of additional disk space will be used.
Media change: please insert the disc labeled
 'Debian GNU/Linux 7.4.0 _Wheezy_ - Official i386 CD Binary-1 20140208-12:25'
in the drive '/media/cdrom/' and press enter => 要你插光碟
解法:
http://askubuntu.com/questions/236288/apt-get-asks-me-to-insert-cd-why
sudo gedit /etc/apt/sources.list
把這行註解掉:
# deb cdrom:[Ubuntu 12.10 _Quantal Quetzal_ - Release amd64 (20121017.5)]/ quantal main restricted
然後別忘了: sudo apt-get update
就能 # apt-get install sudo 了

user_name@linux:~$ sudo apt-get install vim
出現錯誤:
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for user_name:
user_name is not in the sudoers file.  This incident will be reported.
解法:
用root 編輯這個檔案:
# vi /etc/sudoers
加入這一行:
user_name ALL=(ALL:ALL) ALL
user_name就能使用sudo安裝套件了

vim 沒highlight
在~/.vimrc裡面加入這行: syntax on
或將 /etc/vim/vimrc 的" syntax on 註解拿掉

安裝mysql
http://ariejan.net/2007/12/12/how-to-install-mysql-on-ubuntudebian/
$ sudo apt-get update
$ sudo apt-get dist-upgrade  # 什麼是apt-get dist-upgrade
※ upgrade: 系統將現有的 Package 升級, 如果有相依性的問題, 而此相依性 需要安裝其它新的 Package 或 影響到其它 Package 的相依性時, 此 Package 就不會被升級, 會保留下來.
※ dist-upgrade: 可以聰明的解決相依性的問題, 如果有相依性問題, 需要 安裝/移除 新的 Package, 就會試著去 安裝/移除 它. (所以通常這個會被認為是有點風險的升級)
$ sudo apt-get install mysql-server mysql-client  # 我安裝時他就提示要我設置mysql的root密碼,故不用另外用指令設置了
如果裝好mysql和apache後需要裝php5-mysql才能讓php用mysql( mysql, mysqli 擴展 )
$ sudo apt-get install php5-mysql

安裝php
$ sudo apt-get install php5  # 網路上找到的都要安裝 libapache2-mod-php5 ,但php5安裝完就有裝libapache2-mod-php5了
$ dpkg --get-selections | grep php
libapache2-mod-php5                             install
php5                                            install
php5-cli                                        install
php5-common                                     install

新增資料庫
# mysqladmin create xxx
錯誤訊息:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
解法:
照這篇改密碼後就可以了
http://magicsun.pixnet.net/blog/post/25768313-mysqladmin%3A-connect-to-server-at-'localhost'-failed-%E8%99%95%E7%90%86
雖然改的密碼前後都一樣( 我原本mysql -u root -p 可以登入 ),估計是mysql> FLUSH PRIVILEGES; 的關係


2014年4月7日 星期一

KDE常見問題

因為GNOME的cinnamon在雙螢幕時無法像zbar或UltraMon 一樣底下有兩個工作列( dual monitor panel ),所以改用KDE plasma(雖然KDE也是有一堆不習慣的缺點... 用linux辦公深深體會到linux is free if your time is no value)
ex.
1. panel 在左右時會浮在視窗上面無法固定
2. 桌面沒有東西,需要新增一個資料夾的panel,然後將這個panel指到桌面資料夾去,而且這個panel還不能調整大小
3. 在左下角K中搜尋程式,中文會找不到,只能打英文
KDE Plasma上仍使用cinnamon 軟體的軟體:
終端機 - gnome-terminal
File manager - nemo

用了KDE遇到的問題:
skype選取聯絡人時顏色無法閱讀
解法:
1. 編輯 ~/.config/Trolltech.conf
2. 在 [Qt%20Plugin%20Cache%204.8.false] 區間內找到這行:
usr\lib\kde4\plugins\styles\oxygen.so=0, 1, , 2014-02-01T10:37:25
然後把他刪掉
3. 重啟skype
(重開機後就無效了,改用下面方法)
http://ubuntuforums.org/showthread.php?t=2098775
for me, only the following actions made stable effect:
1. install kde-config-gtk gtk2-engines-oxygen:i386
2. go to Sytem Settings -> Application Appearance ( KDE: K=>設定=>系統設定=>應用程式外觀 )
a. colors - select Oxygen Gold ( 顏色=>機制=>選Oxygen Gold => 套用 )
b. GTK+ appearance - select oxygen-gtk  ( 左邊那個GTK分頁 )

KDE更改預設file manager:
http://ubuntuforums.org/showthread.php?t=893591&p=5615038#post5615038
expand KDE Components -> File Associations -> expand Inode -> Directory
Then move Konqueror above Dolphin in the Application preference order, apply

在桌面新增gnome-terminal捷徑(因為konsole的screen被選取標題的會閃爍)
~/桌面 $ ln -s /usr/bin/gnome-terminal

gnome-terminal 在 KDE 桌面啟動時會自動縮小
http://blog.roodo.com/rocksaying/archives/25394946.html
目前在 KDE 下解決 gome-terminal 縮小的方法是利用 KDE 的「視窗行為」微調。從「系統設定」/「視窗行為」/「視窗規則」(System Settings/Window Behavior/Window Rules)頁面,增加一條規則,其內容如下列:
※ 視窗比對 - 「視窗類別」,「完全符合」: gnome-terminal。
※ 大小與位置 - 勾選「遵循位置限制」,「強制」,「否」。 ("Obey geometry restrictions", "Force", "No")

Kde 不要透明=>左右無解,需換桌面主題=>放棄
https://forum.kde.org/viewtopic.php?f=67&t=94807 (未試)
換主題需清cache => delete the entire /var/tmp/kdecache-$USER/ directory
http://forum.kde.org/viewtopic.php?f=17&t=89913  (未試)
換主題:
K->Settings->System Settings->Workspace Appearance->Desktop Theme->Details.
Select Panel Background and choose "file." Then select your new panel-background.svgz image.
I chose /usr/share/kde4/apps/desktoptheme/default/opaque/widgets/panel-background.svgz

讓kde plasma左右兩視窗工作列taskbar只顯示在同一個螢幕的面板上
在”工作管理員”元件(需在面板上新增工作管理員元件)上點右鍵=>工作管理員設定=>一般=>過濾器=>勾選”只顯示目前螢幕上的工作”和”只顯示目前活動裡的工作”

KDE桌面上的那块桌面图标面板怎么调出来?
http://www.guokr.com/question/354783/
桌面點右鍵 => 新增元件 => 選”資料夾” => 新增後點元件設定圖示 => 位置 => 顯示桌面資料夾

KDE 4 滑鼠單擊啟動改成雙擊啟動 
左下角應用程式選單->應用程式->設定->系統設定->輸入裝置->滑鼠->「點兩下開啟檔案或目錄」

安裝新酷音詞庫
https://github.com/chewing/chewing-utils
$ wget https://github.com/chewing/chewing-utils/archive/master.zip
$ unzip master.zip
$ cd chewing-utils-master/hash-editor/
$ make
$ cd src
$ ./che  #可以把他建立連結到桌面
(後來發現不用這麼麻煩,新酷音新增詞庫,你打好字把他選好後enter,他就會自動記憶了)

延長螢幕變暗時間
K => 搜尋 powerdevil ( 省電模式 )

chrome和firefox在linux按backspace無法上一頁
1. 使用alt + <- 上一頁  和 alt+->下一頁
2. chrome安裝套件: Backspace As Back/Forward for Linux
3. firefox
    a. 開新分頁網址列打上: about:config
    b. 搜尋"browser:backspace_action",将其值由2 修改成0 即可