Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, January 8, 2014

[Linux] CentOS + Dropbox + git

1. CentOS上用command line安裝Dropbox
> wget --no-check-certificate -O dropbox.tar.gz "https://www.dropbox.com/download?plat=lnx.x86_64"
> tar xvfz dropbox.tar.gz
> cd .dropbox-dist ; ./dropboxd
這時候會出現一串URL,用browser去連那個URL,然後輸入dropbox的帳號密碼。
> ./dropboxd &

2. 安裝git
> sudo yum install git

3. 設定git
> git config --global user.name "yourname"
> git config --global user.email "username@e-mail"
> git config --global alias.st status
> git config --global alias.co checkout
> git config --global color.ui true
> git config --global credential.helper cache
> git config --global credential.helper 'cache --timeout=3600'
> git config --global http.sslVerify false

4. dropbox上repository設定
> mkdir -p ~/Dropbox/Project/newproject
> cd ~/Dropbox/Project/newproject
> git init --bare

5. 開發目錄repository設定
> mkdir -p ~/Project/newproject
> cd ~/Project/newproject
> git init
把code copy進~/Project/newproject目錄下

6. commit code到dropbox
> git add .
> git commit -m "initial version"
> git remote add dropbox ~/Dropbox/Project/newproject
> git push dropbox master

7. 測試pull
刪除project目錄
> rm -rf ~/Project/newproject
重建project目錄
> mkdir ~/Project/newproject
> git init
> git remote add dropbox ~/Dropbox/Project/newproject
> git pull dropbox master


Monday, December 27, 2010

SSH 免密碼登錄備忘

$ ssh-keygen -t rsa
$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ chmod 600 ~/.ssh/authorized_keys
這個步驟經常忘記
$ ssh localhost

Friday, December 11, 2009

[Linux] CentOS的apache設定with selinux

安裝好CentOS,啟動httpd後,在/var/www/html下建了新目錄後,browse時會發現:
403 Forbidden
到error_log去看,會發現:
(13)Permission denied: access to /search/ denied

解法方法:
方法1
# vi /etc/sysconfig/selinux
SELINUX=enforcing --> SELINUX=disabled

# reboot

方法2
# ls -Z
drwxr-xr-x apache apache user_u:object_r:user_home_t search

# sudo chcon -R -h -t httpd_sys_content_t search


要連線遠端的mysql時,error_log會出現:(遠端的mysql帳號,密碼,權限設定都沒問題)
Can't connect to MySQL server on '192.168.0.9'

解法方法:
# sudo setsebool -P httpd_can_network_connect_db 1
# sudo service httpd restart


用curl時,command line正常,但在httpd下,卻出現:
curl error no 7
Permission denied

解決方法:
# sudo setsebool -P httpd_can_network_connect 1
# sudo service httpd restart



Reference:
http://blog.roodo.com/saycheese/archives/1600863.html
http://wiki.ubuntu.org.cn/index.php?title=Quick_HOWTO_:_Ch20_:_The_Apache_Web_Server/zh&variant=zh-hant

Wednesday, December 9, 2009

vim指令備忘

vim指令備忘
:%s/aaa/bbb/igc : 置換
:%s/ //g : 刪除DOS的換行^M
:%s= *$== : 刪除行尾空白
:g/^s*$/d : 刪除所有空行
:g!/^str/d : 刪除不含字串'str'的行

Tuesday, November 17, 2009

[Ubuntu] stardict擴充字典檔

1. 下載字典檔
http://stardict.sourceforge.net/Dictionaries.php

2. 安裝字典檔
把下載回來的字典檔解壓縮,然後整個目錄COPY到 /usr/share/stardict/dic/ 該目錄下

Friday, October 30, 2009

[Ubuntu] 升級9.10後,vmware滑鼠失靈了

Ubuntu升級9.10後,vmware滑鼠失靈了
一整個很怪,無法點任何東西,然後鼠標會亂飄

解決方法如下:

修改 /etc/vmware/bootstrap 這個檔案
加入一行
VMWARE_USE_SHIPPED_GTK=force

重新執行vmware

Tuesday, September 29, 2009

[Linux] kubuntu的software update一直有4個blocked updates

kubuntu的software update一直有4個blocked updates
要如何消除呢?
sudo apt-get update
sudo apt-get dist-upgrade

Monday, August 24, 2009

[Linux] CentOS無法升級時

CentOS在yum update時,有時候會有Dependency的Error。
此時,執行
yum clean metadata
有時候,可以解決問題。

Monday, August 3, 2009

[Kubuntu] apt-get update時,GPG error

修改完/etc/apt/sources.list後,
在做apt-get update時,出現
W: GPG error: http://ppa.launchpad.net jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 632D16BB0C713DA6
W: You may want to run apt-get update to correct these problems

此時,執行
gpg --keyserver subkeys.pgp.net --recv 632D16BB0C713DA6
gpg --export --armor 632D16BB0C713DA6 | sudo apt-key add -

即可解決。

Thursday, June 18, 2009

[Linux] 在現有的Hadoop Cluster上安裝與運行NUTCH

This tutorial uses 5 CentOS Linux Servers to build Hadoop cluster.
machine1(192.168.0.1) : namenode, jobtracker
machine2-5(192.168.0.2-5) : datanode

1. Add a user and create working directories for Nutch and Hadoop.
sudo useradd -d /home/nutch nutch
sudo mkdir /home/search
sudo chown -R hadoop:hadoop /home/search
sudo as hadoop and change to the home directory.
Apply this step to machine1-5.

2. Download and upgrade JAVA
download the latest java package from the link blow:
http://www.java.com/en/download/manual.jsp#lin
chmod a+x jdk-6u14-linux-i586-rpm.bin
./jdk-6u14-linux-i586-rpm.bin
Apply this step to machine1-5.

3. Modify /etc/hosts
Add these hosts to /etc/hosts
machine1 192.168.0.1
machine2 192.168.0.2
machine3 192.168.0.3
machine4 192.168.0.4
machine5 192.168.0.5
Apply this step to machine1-5.

4. Download Hadoop-0.19.1
login to machine1.
wget http://www.meisei-u.ac.jp/mirror/apache/dist/hadoop/core/hadoop-0.19.1/hadoop-0.19.1.tar.gz
5. Download Nutch-1.0
wget http://www.meisei-u.ac.jp/mirror/apache/dist/lucene/nutch/nutch-1.0.tar.gz
6. Unpack hadoop-0.19.1.tar.gz and nutch-1.0.tar.gz
tar xvfz hadoop-0.19.1.tar.gz
tar xvfz nutch-1.0.tar.gz
mv ~/hadoop-0.19.1 /home/search/hadoop
mv ~/nutch-1.0 /home/search/nutch
cd /home/search/hadoop
7. Edit hadoop-env.sh in Hadoop Directory.
vi conf/hadoop-env.sh
Attach the following to the hadoop-env.sh.
export JAVA_HOME=/usr/java/jdk1.6.0_14
export HADOOP_HOME=/home/search/hadoop
export HADOOP_CONF_DIR=/home/search/hadoop/conf
export HADOOP_SLAVES=$HADOOP_CONF_DIR/slaves
export HADOOP_LOG_DIR=/tmp/hadoop/logs
export HADOOP_PID_DIR=/tmp/hadoop/pid
export NUTCH_HOME=/home/search/nutch
export NUTCH_CONF_DIR=/home/search/nutch/conf
8. Export the environment variables.
source conf/hadoop-env.sh
9. Edit the hadoop-site.xml
vi conf/hadoop-site.xml
The contents are as follow.
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://192.168.0.1:9000/</value>
</property>
<property>
<name>mapred.job.tracker</name>
<value>192.168.0.1:9001</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/tmp/hadoop/hadoop-${user.name}</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>mapred.task.tracker.http.address</name>
<value>0.0.0.0:0</value>
<property>
<name>mapred.child.java.opts</name>
<value>-Xmx512m</value>
</property>
<property>
<name>dfs.block.size</name>
<value>5120000</value>
</property>
</configuration>
10. Edit the conf/masters and conf/slave
The contents of conf/masters:
machine1
The contents of conf/slaves
machine2
machine3
machine4
machine5
11. Deploy Hadoop Env to datanode.
scp -r /home/search/hadoop machine2:/home/search
scp -r /home/search/hadoop machine3:/home/search
scp -r /home/search/hadoop machine4:/home/search
scp -r /home/search/hadoop machine5:/home/search
12. Start up Hadoop.
bin/hadoop namenode -format
bin/start-all.sh
13. Edit the nutch-site.xml
cd /home/search/nutch
vi conf/nutch-site.xml
The contents are as follow:
<configuration>
<property>
<name>http.agent.name</name>
<value>nutch</value>
<description>HTTP 'User-Agent' request header. </description>
</property>
<property>
<name>http.agent.description</name>
<value>Nutch_Test</value>
<description>Further description</description>
</property>
<property>
<name>http.agent.url</name>
<value>localhost</value>
<description>A URL to advertise in the User-Agent header. </description>
</property>
<property>
<name>http.agent.email</name>
<value>test@test.org.tw</value>
<description>An email address
</description>
</property>
<property>
<name>http.robots.agents</name>
<value>nutch</value>
<description>The agent strings we'll look for in robots.txt files,
comma-separated, in decreasing order of precedence. You should
put the value of http.agent.name as the first agent name, and keep the
default * at the end of the list. E.g.: BlurflDev,Blurfl,*
</description>
</property>
<property>
<name>plugin.folders</name>
<value>/home/search/nutch/plugins</value>
<description>Directories where nutch plugins are located. </description>
</property>
<property>
<name>plugin.includes</name>
<value>protocol-(http|httpclient)|urlfilter-regex|parse-(text|html|js|ext|msexcel|mspowerpoint|msword|oo|pdf|rss|swf|zip)|index-(more|basic|anchor)|query-(more|basic|site|url)|response-(json|xml)|summary-basic|scoring-opic|urlnormalizer-(pass|regex|basic)</value>
<description> Regular expression naming plugin directory names</description>
</property>
<property>
<name>parse.plugin.file</name>
<value>parse-plugins.xml</value>
<description>The name of the file that defines the associations between
content-types and parsers.</description>
</property>
<property>
<name>db.max.outlinks.per.page</name>
<value>-1</value>
<description> </description>
</property>
<property>
<name>http.content.limit</name>
<value>-1</value>
</property>
<property>
<name>indexer.mergeFactor</name>
<value>500</value>
<description>The factor that determines the frequency of Lucene segment
merges. This must not be less than 2, higher values increase indexing
speed but lead to increased RAM usage, and increase the number of
open file handles (which may lead to "Too many open files" errors).
NOTE: the "segments" here have nothing to do with Nutch segments, they
are a low-level data unit used by Lucene.
</description>
</property>
<property>
<name>indexer.minMergeDocs</name>
<value>500</value>
<description>This number determines the minimum number of Lucene
Documents buffered in memory between Lucene segment merges. Larger
values increase indexing speed and increase RAM usage.
</description>
</property>
</configuration>
14. Edit the crawl-urlfilter.txt
vi conf/crawl-urlfilter.txt
The contents are as follow.
# skip ftp:, & mailto: urls
-^(file|ftp|mailto):
# skip image and other suffixes we can't yet parse
-\.(gif|GIF|jpg|JPG|png|PNG|ico|ICO|css|sit|eps|wmf|mpg|xls|gz|rpm|tgz|mov|MOV|exe|jpeg|JPEG|bmp|BMP)$
# skip URLs containing certain characters as probable queries, etc.
-[*!@]
# accept anything else
+.*
15. Create a directory with a flat file of root urls.
mkdir urls
echo "http://www.apache.org" >> urls/urls.txt
16. Copy seeds list to hadoop DFS
../hadoop/bin/hadoop fs -put urls urls
17. Copy conf/nutch-site.xml and conf/crawl-urlfilter.txt to hadoop conf folder.
cp conf/nutch-site.xml conf/crawl-urlfilter.txt /home/search/hadoop/conf
18. Deploy nutch configure files to namenode.
scp /home/search/hadoop/conf/nutch-site.xml /home/search/hadoop/conf/crawl-urlfilter.txt machine2:/home/search/hadoop/conf
scp /home/search/hadoop/conf/nutch-site.xml /home/search/hadoop/conf/crawl-urlfilter.txt machine3:/home/search/hadoop/conf
scp /home/search/hadoop/conf/nutch-site.xml /home/search/hadoop/conf/crawl-urlfilter.txt machine4:/home/search/hadoop/conf
scp /home/search/hadoop/conf/nutch-site.xml /home/search/hadoop/conf/crawl-urlfilter.txt machine5:/home/search/hadoop/conf
19. Start crawling.
cd /home/search/nutch
../hadoop/bin/hadoop jar nutch-1.0.job org.apache.nutch.crawl.Crawl urls -dir crawl -depth 5 -topN 10000

Friday, June 12, 2009

[Linux] 無法compile pftp shit edition的問題

在Linux下,compile pftp shit edition時,會出現

In function ‘int open(const char*, int, ...)’, inlined from ‘bool CTCP::ReadFile(char*, long int)’ at tcp.cc:1180:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments make[1]: *** [tcp.o] Error 1

解決方法:

編輯src/tcp.cc
跳到1180行
找到
open(name, O_CREAT | O_TRUNC | O_RDWR | O_BINARY)) == -1) {
改成
open(name, O_CREAT | O_TRUNC,0664 | O_RDWR | O_BINARY)) == -1) {
然後make dynamic

Reference:
pftp-shit wont compile

Friday, June 5, 2009

[Linux] SSH的Remote Forwarding

早大的網路,管的真的很嚴。
但還是有辦法突破^_^

A : 學校的個人電腦 (Linux, Private IP)
B : SSH Server (Linux, Public IP, 有Firewall,對外只能用port 22)
C : 家裏的電腦 (皆可)

A可以連到B,C
B可以連到C,但不能連到A
C可以連到B,但不能連到A

要如何從C連到A呢?
可以用SSH Remote Forwarding

在A上執行
ssh -N -R 55588:localhost:22 user_of_B@ip.of.B

此時就可以從C用SSH到B之後,再從B SSH到A了
C_SHELL> ssh user_of_B@ip.of.B
B_SHELL> ssh -p 55588 user_of_A@localhost

Wednesday, June 3, 2009

[Linux] 解決 Nutch 中 Cache 亂碼的問題

Edit cache.jsp
--- cached.jsp.orig 2009-02-18 12:17:25.000000000 -0500
+++ cached.jsp.patched 2009-02-18 12:43:26.000000000 -0500
@@ -40,6 +40,7 @@
.getLocale().getLanguage();

Metadata metaData = bean.getParseData(details).getContentMeta();
+ Metadata parseMetaData = bean.getParseData(details).getParseMeta();

String content = null;
String contentType = (String) metaData.get(Metadata.CONTENT_TYPE);
@@ -49,7 +50,7 @@
// but I don't know how to emit 'byte sequence' in JSP.
// out.getOutputStream().write(bean.getContent(details)) may work,
// but I'm not sure.
- String encoding = (String) metaData.get("CharEncodingForConversion");
+ String encoding = (String) parseMetaData.get("CharEncodingForConversion");
if (encoding != null) {
try {
content = new String(bean.getContent(details), encoding);

Reference:
Nutch缓存乱码解决方案

Wednesday, May 20, 2009

[Linux] Solr 1.3.0 + Tomcat 6.0.18

1. Download Solr-1.3.0
Download the latest stable release from this link:
http://www.apache.org/dyn/closer.cgi/lucene/solr/
wget http://www.meisei-u.ac.jp/mirror/apache/dist/lucene/solr/1.3.0/apache-solr-1.3.0.tgz

2. Download Tomcat
cd ~
wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz

3. Unpack Tomcat
tar xvfz apache-tomcat-6.0.18.tar.gz
mv ./apache-tomcat-6.0.18 /home/search/tomcat

4. Edit Server.xml.
cd /home/search/tomcat
vi conf/server.xml

Modify the server.xml as following.
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8"
useBodyEncodingForURI="true" />

5. Setup the environment variables for solr.
echo "export CATALINA_BASE=/home/search/tomcat" >> ~/.bashrc
echo "export CATALINA_HOME=/home/search/tomcat" >> ~/.bashrc
echo "export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre" >> ~/.bashrc
echo "export PATH=${JAVA_HOME}/bin:${PATH}" >> ~/.bashrc
source ~/.bashrc
6. Unpack Solr
tar xvfz apache-solr-1.3.0.tgz
7. Setup Solr
cp apache-solr-1.3.0/dist/apache-solr-1.3.0.war /home/search/tomcat/webapps/solr.war
cp -r apache-solr-1.3.0/example/solr /home/search/solr
echo "export JAVA_OPTS="$JAVA_OPTS -Dsolr.solr.home=/home/search/solr" >> ~/.bashrc

8. Startup tomcat
cd /home/search
/home/search/tomcat/bin/startup.sh
9. Test Solr
http://localhost:8080/solr/admin
Reference:
http://owahab.com/content/installing-and-configuring-solr-debian-gnulinux

Tuesday, May 19, 2009

[Linux] Nutch + Hadoop + Tomcat

1. Add a user and create working directories for Nutch and Hadoop.
sudo useradd -d /home/nutch nutch
sudo mkdir /home/search
sudo chown -R nutch:nutch /home/search

login as nutch.

2. Download the latest stable release of Nutch.
Download the latest stable release from here:
http://lucene.apache.org/nutch/release/
for Example:
wget http://www.meisei-u.ac.jp/mirror/apache/dist/lucene/nutch/nutch-1.0.tar.gz
3. Unpack the latest stable release of Nutch.
tar xvfz nutch-1.0.tar.gz
mv nutch-1.0 /home/search/nutch
cd /home/search/nutch

4. Edit the nutch-site.xml
vi conf/nutch-site.xml
The contents are as follow:
<configuration>
<property>
<name>http.agent.name</name>
<value>nutch</value>
<description>HTTP 'User-Agent' request header. </description>
</property>
<property>
<name>http.agent.description</name>
<value>Nutch_Test</value>
<description>Further description</description>
</property>
<property>
<name>http.agent.url</name>
<value>localhost</value>
<description>A URL to advertise in the User-Agent header. </description>
</property>
<property>
<name>http.agent.email</name>
<value>test@test.org.tw</value>
<description>An email address
</description>
</property>
<property>
<name>http.robots.agents</name>
<value>nutch</value>
<description>The agent strings we'll look for in robots.txt files,
comma-separated, in decreasing order of precedence. You should
put the value of http.agent.name as the first agent name, and keep the
default * at the end of the list. E.g.: BlurflDev,Blurfl,*
</description>
</property>
<property>
<name>plugin.folders</name>
<value>/home/search/nutch/plugins</value>
<description>Directories where nutch plugins are located. </description>
</property>
<property>
<name>plugin.includes</name>
<value>protocol-(http|httpclient)|urlfilter-regex|parse-(text|html|js|ext|msexcel|mspowerpoint|msword|oo|pdf|rss|swf|zip)|index-(more|basic|anchor)|query-(more|basic|site|url)|response-(json|xml)|summary-basic|scoring-opic|urlnormalizer-(pass|regex|basic)</value>
<description> Regular expression naming plugin directory names</description>
</property>
<property>
<name>parse.plugin.file</name>
<value>parse-plugins.xml</value>
<description>The name of the file that defines the associations between
content-types and parsers.</description>
</property>
<property>
<name>db.max.outlinks.per.page</name>
<value>-1</value>
<description> </description>
</property>
<property>
<name>http.content.limit</name>
<value>-1</value>
</property>
<property>
<name>indexer.mergeFactor</name>
<value>500</value>
<description>The factor that determines the frequency of Lucene segment
merges. This must not be less than 2, higher values increase indexing
speed but lead to increased RAM usage, and increase the number of
open file handles (which may lead to "Too many open files" errors).
NOTE: the "segments" here have nothing to do with Nutch segments, they
are a low-level data unit used by Lucene.
</description>
</property>
<property>
<name>indexer.minMergeDocs</name>
<value>500</value>
<description>This number determines the minimum number of Lucene
Documents buffered in memory between Lucene segment merges. Larger
values increase indexing speed and increase RAM usage.
</description>
</property>
</configuration>
5. Edit the crawl-urlfilter.txt
vi conf/crawl-urlfilter.txt
The contents are as follow.
# skip ftp:, & mailto: urls
-^(ftp|mailto):
# skip image and other suffixes we can't yet parse
-\.(gif|GIF|jpg|JPG|png|PNG|ico|ICO|css|sit|eps|wmf|mpg|xls|gz|rpm|tgz|mov|MOV|exe|jpeg|JPEG|bmp|BMP)$
# skip URLs containing certain characters as probable queries, etc.
-[*!@]
# accept anything else
+.*

6. Create a directory with a flat file of root urls.
mkdir urls
echo "http://www.waseda.ac.jp" >> urls/urls.txt

7. Edit hadoop-env.sh
vi conf/hadoop-env.sh
Attach the following to the hadoop-env.sh.
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export HADOOP_HOME=/home/search/nutch
export HADOOP_CONF_DIR=/home/search/nutch/conf
export HADOOP_SLAVES=$HADOOP_CONF_DIR/slaves
export HADOOP_LOG_DIR=/tmp/hadoop/logs
export HADOOP_PID_DIR=/tmp/hadoop/pid
export NUTCH_HOME=/home/search/nutch
export NUTCH_CONF_DIR=/home/search/nutch/conf

8. Export the environment variables.
source conf/hadoop-env.sh
9. Edit the hadoop-site.xml
vi conf/hadoop-site.xml
The contents are as follow.
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000/</value>
<description> </description>
</property>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9001</value>
<description> </description>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/tmp/hadoop/hadoop-${user.name}</value>
<description> </description>
</property>
</configuration>

10. Startup Hadoop
bin/hadoop namenode -format
bin/start-all.sh

11. Test the hadoop
Hadoop Map/Reduce Administration Page
12. Add the urls directory to the hadoop filesystem.
bin/hadoop dfs -put urls urls
13. Start to Crawl.
bin/nutch crawl urls -dir crawl -depth 3 -topN 100
14. Download Tomcat
cd ~
wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz

15. Unpack Tomcat
tar xvfz apache-tomcat-6.0.18.tar.gz
mv ./apache-tomcat-6.0.18 /home/search/tomcat

16. Edit Server.xml.
cd /home/search/tomcat
vi conf/server.xml

Modify the server.xml as following.
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8"
useBodyEncodingForURI="true" />

17. Change Nutch search page as tomcat's root page.
cd /home/search/nutch
mkdir web
cd web
jar -xvf ../nutch-1.0.war
mv /home/search/tomcat/webapps/ROOT /home/search/tomcat/webapps/ROOT.org
mv /home/search/nutch/web /home/search/tomecat/webapps/ROOT

18. Edit nutch-site.xml in tomcat.
cd /home/search/tomcat
vi webapps/ROOT/WEB-INF/classes/nutch-site.xml


Modify as following.
<configuration>
<property>
<name>searcher.dir</name>
<value>/home/search/crawl</value>
</property>
</configuration>

19. Download the crawled result to local.
cd /home/search/nutch
bin/hadoop dfs -get crawl /home/search/crawl

20. Start tomcat
/home/search/tomcat/bin/startup.sh
21. Search in the crawled index
http://localhost:8080


Reference:
Nutch 安裝使用
http://wiki.apache.org/nutch/NutchHadoopTutorial
http://wiki.apache.org/nutch/NutchTutorial

Tuesday, April 28, 2009

[Linux] 64 bit Flash 10 for Linux

wget http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.22.87.linux-x86_64.so.tar.gz
tar zxvf libflashplayer-10.0.22.87.linux-x86_64.so.tar.gz
sudo cp libflashplayer.so /usr/lib/mozilla/plugins/


可以解決在64bit ubuntu中,firefox無法撥放youtube影片的問題。

Friday, April 24, 2009

[Linux] How to mount dmg file.

在Linux下解壓縮與mount dmg file的方法。

1. 如果dmg有壓縮過,要先解壓縮。
下載與安裝dmg2img
tar -zxvf dmg2img.tar.gz
make all
解壓縮dmg file
dmg2img -i /path/to/inputfile.dmg -o /path/to/outputfile.img


2. mount 解壓縮之後的dmg file
sudo mount -t hfsplus -o loop /path/to/outputfile.img /mount/point


Reference:
How to mount a DMG imagefile?

[ubuntu] Install apache2, mysql, php

Ubuntu下安裝apache2, mysql, and php的方式
安裝apache2 with perfork mpm
sudo apt-get install apache2 apache2-mpm-prefork

安裝php5
sudo apt-get install php5 libapache2-mod-php5 php5-cli php5-dev php5-gd php5-imagick php5-mcrypt php5-xmlrpc

起動php5的mod
sudo a2enmod php5

安裝mysql
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

重起 Apache2
sudo /etc/init.d/apache2 force-reload

設定eAccelerator
下載eAccelerator
http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.zip
解壓縮eaccelerator-0.9.5.3.zip
cd eaccelerator-0.9.5.3
安裝aAccelerator
sudo /usr/bin/phpize ; sudo ./configure --enable-eaccelerator=shared --with-php-config=/usr/bin/php-config ; sudo make ; sudo make install
建立 eAccelerator 快取
sudo mkdir /var/tmp/eaccelerator ; sudo chmod 0777 /var/tmp/eaccelerator
新增 /etc/php5/conf.d/eaccelerator.ini
sudo vim /etc/php5/conf.d/eaccelerator.ini
內容如下:
extension="eaccelerator.so"
eaccelerator.shm_size="32"
eaccelerator.cache_dir="/var/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
重起 Apache2
sudo /etc/init.d/apache2 force-reload


Reference
阿駕零零壹 © 學習筆記 | [Ubuntu] Apache 2 + MySQL + PHP ( + FastCGI ) on Ubuntu 8.04 Server

[Kubuntu] ubuntu如何安裝.rpm file

sudo apt-get install alien
sudo alien -k XXXXXXX.rpm
sudo dpkg -i XXXXXXX.deb


我試了VMWARE的RPM之後,好像無效:~

Reference:
Installing using an RPM file

[kubuntu] ubuntu 升級 9.04 後 無法起動vmware的解決方法

kubuntu 升級 9.04 之後,VMWARE執行時會出現
Xlib: extension "RANDR" missing on display ":0.0".

解決方式如下:
sudo mv mv /usr/lib/vmware/modules/binary /usr/lib/vmware/modules/binary.old
sudo vmware


Reference:
http://communities.vmware.com/message/1147315