1. 安裝 mysql-server & mysql-client
2. 安裝對應的 mysql perl & php libraries
3. 安裝 mysql server 的時侯, 會要求設定 root password. 如果忘了 root password, 也可以重新安裝 mysql server, 就會重新設定 root password
4. 用 mysql -u root -p 進入, 然後增加需要的 account
mysql> CREATE USER 'somebody'@'localhost' IDENTIFIED BY 'somepassword';
5. 建立 database
mysql> create database;
6. Export database
# Export table structure and data
mysqldump -u username -ppassword database_name > dump.sql
# Export table structure only
mysqldump -u username -ppassword –no-data database_name > dump.sql
# Export data only
mysqldump -u username -ppassword –no-create-info database_name > dump.sql
# Export multiple databases
mysqldump -u username -ppassword –databases db_name1 [db_name2 ...] > dump.sql
# Export all databases
mysqldump -u username -ppassword –all-databases > dump.sql
# Import table
mysql -u username -ppassword database_name < dump.sql
2012年7月17日 星期二
Ubuntu 上的 skype 和 MSN
sudo apt-get install emesene
sudo add-apt-repository ppa:telepathy/ppa
sudo apt-get update
sudo apt-get install empathy
sudo apt-get install pidgin
sudo apt-add-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update
sudo apt-get install skype
sudo add-apt-repository ppa:telepathy/ppa
sudo apt-get update
sudo apt-get install empathy
sudo apt-get install pidgin
sudo apt-add-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update
sudo apt-get install skype
2012年7月11日 星期三
一步步架設 GIT server(2) --- GIT remote with HTTP-dav server
透過 SSH 有先天上的存取權限問題, 解法也很直觀
1. 透過 SSH public key cipher
2. 改用 HTTP/HTTPS server
今天就讓我們試試看 GIT HTTP 的架設
Server : my.web.server
Path : /var/git/project.git
WebPage : /project.git
First, we have to describe some concept :
A GIT HTTP server is a git server, using webdav file system through http protocol.
The result structure looks like
Server Side
1. HTTPD(auth and server control)
2. WebDav(access method and exceptions)
3. File System(www-data read/write permission for contain files)
4. GIT bare server(GIT protocol)
For this 4 rules, we will set them to
1. HTTPD(auth and server control) -- setting up basic authtype and password file
2. WebDav(access method and exceptions) -- setting no access limit to read and directory listing, auth limitation for write and create
3. File System(www-data read/write permission for contain files) -- be sure all file under the repositories with www-data as owner and group
4. GIT bare server(GIT protocol) -- create a bare server by git init -- bare
My first try follows the guide in this page , using the following git_project1.conf :
Second, we tried a git-http-backend suggestion.
Here is the setting of git_project2.conf
This worked for git clone "git clone http://Git@localhost/project2.git" but failed on push and got the following message :
Due to error 22 is confusing, we got block here for a long day. Finally we know that this error means the file accessing in project2 requires authentication but we didn't set. The reason is got no match.
And additionally, if we change the project2 setting to project1, the push could work, where we have to type password twice.
It is time to review the behavior of webdav. The 1 and 2 lead to a simple conclusion : we only have to make read/list require no auth and write/change/create require auth.
Here is the final try
Alias /project3.git /var/www/project3.git
Allow from all
DAV on
AuthType Basic
AuthName "Git"
AuthUserFile /etc/apache2/passwd.git
require valid-user
Finally it works for both clone/fetch and push.
1. 透過 SSH public key cipher
2. 改用 HTTP/HTTPS server
今天就讓我們試試看 GIT HTTP 的架設
Server : my.web.server
Path : /var/git/project.git
WebPage : /project.git
First, we have to describe some concept :
A GIT HTTP server is a git server, using webdav file system through http protocol.
The result structure looks like
Server Side
1. HTTPD(auth and server control)
2. WebDav(access method and exceptions)
3. File System(www-data read/write permission for contain files)
4. GIT bare server(GIT protocol)
For this 4 rules, we will set them to
1. HTTPD(auth and server control) -- setting up basic authtype and password file
2. WebDav(access method and exceptions) -- setting no access limit to read and directory listing, auth limitation for write and create
3. File System(www-data read/write permission for contain files) -- be sure all file under the repositories with www-data as owner and group
4. GIT bare server(GIT protocol) -- create a bare server by git init -- bare
My first try follows the guide in this page , using the following git_project1.conf :
Alias /project1.git /var/www/project1.gitAfter restarting apache2 server, issuing git clone command "git clone http://Git@localhost/project1.git", we got an error
Allow from all
DAV on
AuthType Basic
AuthName "Git"
AuthUserFile /etc/apache2/passwd.git
Require valid-user
Cloning into 'project1'...After searching the solutions, we guess this is a apache-dav-git cowork bug : all file accessing requires authentication but only first file gets a user/password prompt.
Password for 'http://Git@localhost':
error: The requested URL returned error: 401 (curl_result = 22, http_code = 401, sha1 = 515a49392b55fead641c664d771776b0580e2ac2)
error: Unable to find 515a49392b55fead641c664d771776b0580e2ac2 under http://Git@localhost/project1.git
Cannot obtain needed blob 515a49392b55fead641c664d771776b0580e2ac2
while processing commit ecc69bb265fbcb017e472fa0f12d7260ff106f29.
error: Fetch failed.
Second, we tried a git-http-backend suggestion.
Here is the setting of git_project2.conf
Alias /project2.git /var/www/project2.git
Allow from all
DAV on
AuthType Basic
AuthName "Git"
AuthUserFile /etc/apache2/passwd.git
Require valid-user
This worked for git clone "git clone http://Git@localhost/project2.git" but failed on push and got the following message :
#> git push origin master
Password for 'http://Git@localhost':
error: Cannot access URL http://Git@localhost/project2.git/, return code 22
fatal: git-http-push failed
Due to error 22 is confusing, we got block here for a long day. Finally we know that this error means the file accessing in project2 requires authentication but we didn't set. The reason is
And additionally, if we change the project2 setting to project1, the push could work, where we have to type password twice.
It is time to review the behavior of webdav. The 1 and 2 lead to a simple conclusion : we only have to make read/list require no auth and write/change/create require auth.
Here is the final try
Alias /project3.git /var/www/project3.git
Allow from all
DAV on
AuthType Basic
AuthName "Git"
AuthUserFile /etc/apache2/passwd.git
require valid-user
Finally it works for both clone/fetch and push.
一步步架設 GIT server(1) --- GIT remote server through SSL
GIT 對 soho 的人來說非常適合, 因爲
1. 具有 local version control 的能力, 在開發的時候, 可以不必跟 server 作非常平凡的查詢.
2. 可以很輕易的開 branch, 同時有很嚴謹的 merge 管控
可是, 架設 GIT server 很複雜.我決定一步一步學習, 最後的目標
a. 架設 https 支援的 git server, 同時可以用 public-key 取代 password
b. 設定好 GitHub
c. 學習使用 repo
第一步 : 架好使用 SSH + 密碼登入的 git server
Server : my.remote.server
User : myname
Password : mypassword
Path : /home/myname/git-repo/
Source
Server : my.source.archive
Path : /home/myname/source-code/
Test Site
Server : my.test.site
Path : /home/myname/git-test/
Server 端 :
1. Login with myname
2. cd git-repo
3. git init --bare
Source 端 :
1. Login with myname
2. mkdir source-code-git
3. cd source-code-git
4. git init
5. git remote add "git-myrepo" "ssh://myname@my.remote.server/~myname/git-repo"
6. git fetch git-myrepo
type mypassword to pass
7. copy source code from ~/source-code/ to ~/source-code-git/
8. git add . ; git commit -m "Commit Message"
9. git push git-myrepo master
Test 端
1. Login with myname
2. mkdir my-git-test
3. cd my-git-test
4. git init
5. git remote add "git-myrepo" "ssh://myname@my.remote.server/~myname/git-repo"
6. git fetch git-myrepo
7. git checkout master
1. 具有 local version control 的能力, 在開發的時候, 可以不必跟 server 作非常平凡的查詢.
2. 可以很輕易的開 branch, 同時有很嚴謹的 merge 管控
可是, 架設 GIT server 很複雜.我決定一步一步學習, 最後的目標
a. 架設 https 支援的 git server, 同時可以用 public-key 取代 password
b. 設定好 GitHub
c. 學習使用 repo
第一步 : 架好使用 SSH + 密碼登入的 git server
Server : my.remote.server
User : myname
Password : mypassword
Path : /home/myname/git-repo/
Source
Server : my.source.archive
Path : /home/myname/source-code/
Test Site
Server : my.test.site
Path : /home/myname/git-test/
Server 端 :
1. Login with myname
2. cd git-repo
3. git init --bare
Source 端 :
1. Login with myname
2. mkdir source-code-git
3. cd source-code-git
4. git init
5. git remote add "git-myrepo" "ssh://myname@my.remote.server/~myname/git-repo"
6. git fetch git-myrepo
type mypassword to pass
7. copy source code from ~/source-code/ to ~/source-code-git/
8. git add . ; git commit -m "Commit Message"
9. git push git-myrepo master
Test 端
1. Login with myname
2. mkdir my-git-test
3. cd my-git-test
4. git init
5. git remote add "git-myrepo" "ssh://myname@my.remote.server/~myname/git-repo"
6. git fetch git-myrepo
7. git checkout master
2012年7月9日 星期一
訂閱:
意見 (Atom)