顯示具有 網站 標籤的文章。 顯示所有文章
顯示具有 網站 標籤的文章。 顯示所有文章

2011年4月24日 星期日

如何在 Linux 架設 Samba 網路芳鄰分享檔案

Linux : Ubuntu、Ubuntu Server

Windows : Windows 7

 

1.安裝Samba

# sudo apt-get install samba

 

2.備份smb.conf

# cp /etc/samba/smb.conf /etc/samba/smb.conf-bak

 

3.新增使用者(有兩種)

使用舊的版本

# smbpasswd –a user

完成後密碼檔在/etc/samba/smbpasswd

smbpasswd –h 可以查看更多參數

使用新的版本

# pdbedit –a user

完成後可用pdbedit –L 查看目前使用者

pdbedit –x 刪除使用者

 

4.編輯smb.conf

# vim /etc/samba/smb.conf

 

1 [global]

2 workgroup = BohanSamba

3 netbios name = BohanPC

4 security = user

5

6 [share]

7 path = /home/download/

8 valid users = download

9 read only = no

10 browseable = yes

11 create mask = 0755
12 directory mask = 0755

 

5.重新啟動samba(有兩種)

使用舊的版本

# /etc/init.d/samba restart

使用新的版本

# sudo service smbd restart

# sudo service nmbd restart

 

6. 輸入IP 帳號 密碼

\\ yourip

windows7samba

7.刪除連線

開啟命令提示字元輸入

net use * /delete

2011年3月23日 星期三

Ubuntu 使用 NO-IP

1.先去noip網站註冊

http://www.no-ip.com/


 

2.加入Host 對應

Noip


3.安裝noip套件

$ sudo apt-get install noip2

或者是到noip下載解壓縮 之後編譯安裝


 

4.安裝畫面如下


第一次安裝會跳出以下畫面

noipmail

noipassword

noiptime

noipgroup

noipdevice

noipfinish

 

5. 測試有沒有成功

connect

connectpaswd

 

noiptest

6. noip命令

USAGE: noip2 [ -C [ -F][ -Y][ -L hosts_groups][ -U #min]
        [ -u username][ -p password][ -x progname]]
        [ -c file][ -d][ -D pid][ -i addr][ -S][ -M][ -h]
Version Linux-2.1.7
Options: -C                         create configuration data
               -F                          force NAT off
               -Y                          select all hosts/groups
               -L hosts_groups  select supplied hosts/groups
               -U minutes           set update interval
               -u username        use supplied username
               -p password        use supplied password
               -x executable       use supplied executable
               -c config_file        use alternate data path
               -d                           increase debug verbosity
               -D processID       toggle debug flag for PID
               -i IPaddress         use supplied address
               -I interface            use supplied interface
              -S                           show configuration data
              -M                          permit multiple instances
              -K processID        terminate instance PID
              -z                           activate shm dump code
              -h                           help (this text)

 

重新設定的話輸入

$ noip2 –C

 

已經有設定資料的話先刪除 noip porcess

$ noip2 –K processID

 

顯示現在電腦設定

$ noip2 –S

謝謝收看!

2010年11月20日 星期六

如何在FreeBSD上安裝MySQL?

1.先參考前一篇寫的如何在FreeBSD上安裝Apache+Php?

2.安裝MySQL-Server

# cd /usr/ports/databases/mysql51-server

# make WITH_CHARSET=utf8 WITH_XCHARSET=all

# make install

安裝成功

You already have a group "mysql", so I will use it.

mysql:*:88:88::0:0:MySQL Daemon:/nonexistent:/sbin/nologin

You already have a user "mysql", so I will use it.

************************************************************************

Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag)

the first time you start the MySQL server after an upgrade from an

earlier version.

************************************************************************

install-info --quiet /usr/local/info/mysql.info /usr/local/info/dir

===> Installing rc.d startup script(s)

===> Compressing manual pages for mysql-server-5.1.33

===> Registering installation for mysql-server-5.1.33

===> SECURITY REPORT:

This port has installed the following files which may act as network

servers and may therefore pose a remote security risk to the system.

/usr/local/libexec/mysqld

This port has installed the following startup scripts which may cause

these network services to be started at boot time.

/usr/local/etc/rc.d/mysql-server

If there are vulnerabilities in these programs there may be a security

risk to the system. FreeBSD makes no guarantee about the security of

ports included in the Ports Collection. Please type 'make deinstall'

to deinstall the port if this is a concern.

For more information, and contact details about the security

status of this software, see the following webpage:

http://www.mysql.com/

2.安裝Php5-MySQL

# cd /usr/ports/databases/php5-mysql

# make

# make install

安裝成功

===> Installing for php5-mysql-5.2.9
===> php5-mysql-5.2.9 depends on file: /usr/local/include/php/main/php.h - found
===> php5-mysql-5.2.9 depends on shared library: mysqlclient.14 - found
===> Generating temporary packing list
===> Checking if databases/php5-mysql already installed
===> Registering installation for php5-mysql-5.2.9
****************************************************************************
The following line has been added to your /usr/local/etc/php/extensions.ini
configuration file to automatically load the installed extension:
extension=mysql.so
****************************************************************************

3.讓開機啟動MySQL

# vi /etc/rc.conf

加入mysql_enable=”yes”

4.匯入資料庫 與 設定MySQL密碼

參考之前的文章

(1) Ubuntu 如何用指令匯出 MySQL 的資料庫?

(2) Ubuntu 裡重新設定 MySQL root 密碼

“FreeBSD 停止/啟動 MySQL服務路徑為 /usr/local/etc/rc.d/mysql-server”

5.安裝phpmyadmin

# cd /usr/ports/databases/phpmyadmin

# make

# make install

"建議去官網下載 並解壓到 /usr/local/www/apache22/data/ 會比較快"

6.測試畫面

MySQLphpmyadmin

如何在FreeBSD上安裝Apache+Php?

FreeBSD Version : 7.2
1.切換成 root 權限
# su
2.安裝 Apache
# cd /usr/ports/www/apache22
# make config (想要什麼功能在這裡選擇 Mysql記得勾選 方便日後升級)
# make
# make install (建議make install分開做)
 
成功安裝訊息
Your hostname must be resolvable using at least 1 mechanism in
/etc/nsswitch typically DNS or /etc/hosts or apache might
have issues starting depending on the modules you are using.
===> Installing rc.d startup script(s)
===> Compressing manual pages for apache-2.2.11_4
===> Running ldconfig
/sbin/ldconfig -m /usr/local/lib
===> Registering installation for apache-2.2.11_4
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/lib/libapr-1.so.3
This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/apache22
/usr/local/etc/rc.d/htcacheclean
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://httpd.apache.org/
 
3.安裝 Php (php5 & php5-extension)
# cd /usr/ports/lang/php5
# make config (想要什麼功能在這裡選擇)
# make
# make install
 
成功安裝訊息
***************************************************************
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
***************************************************************
===> Compressing manual pages for php5-5.2.9
===> Registering installation for php5-5.2.9
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/apache22/libphp5.so
/usr/local/bin/php
/usr/local/bin/php-cgi
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://www.php.net/
 
# cd /usr/ports/lang/php5-extensions
# make config
# make
# make install
 
成功安裝訊息
===> Returning to build of php5-extensions-1.3
===> Configuring for php5-extensions-1.3
===> Installing for php5-extensions-1.3
===> php5-extensions-1.3 depends on file: /usr/local/include/php/main/php.h - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/bz2.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/ctype.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/dom.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/filter.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/ftp.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/hash.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/iconv.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/json.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/mssql.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/mysql.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/mysqli.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/ncurses.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/odbc.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/pcre.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/pdo.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/pdo_sqlite.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/posix.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/session.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/simplexml.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/snmp.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/sockets.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/spl.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/sqlite.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/tokenizer.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/xml.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/xmlreader.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/xmlwriter.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/zip.so - found
===> php5-extensions-1.3 depends on file: /usr/local/lib/php/20060613/zlib.so - found
===> Generating temporary packing list
===> Checking if lang/php5-extensions already installed
===> Registering installation for php5-extensions-1.3
 
4.Apache 基本設定
# vi /usr/local/etc/apache22/httpd.conf
 
<IfModule dir_module>
    DirectoryIndex index.html index.php (為了支援php格式)
</IfModule>
 
將下列兩列加到最後一行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
 
5.開機時啟動 Apache
# vi /etc/rc.conf
加入 apache22_enable=”YES”
 
6.測試畫面 (預設目錄在/usr/local/www/apache22/data/)



 

2010年9月22日 星期三

.htaccess網頁認證 保護網頁目錄

作業系統 : Ubuntu 8.04LTS

1.編輯
# vim /etc/apache2/http.conf

將上述資料輸入進去存檔
/var/ww/webftp/ 為要保護的網頁目錄


2.新增.htaccess於/var/www/webftp/
# vim /var/www/webftp/.htaccess 

 
AuthName 為視窗的訊息
Authtype 認證模式
AuthUserFile 密碼檔的路徑(盡量別放在網頁目錄裡)
bohan 為使用者

3. 設定密碼
# htpasswd -c /var/www/.htpasswd bohan


4.畫面(Google瀏覽器)




2010年8月3日 星期二

Ubuntu 裡重新設定MySQL root密碼

1.先停止MySQL
#/etc/init.d/mysql stop
2.輸入下列即可進入mysql
# mysqld_safe --skip-grant-tables &
3. 換成root
#mysql -u root
4.出現mysql> 後輸入下列指令
mysql> use mysql;
mysql> update user set password=PASSWORD("newpassword") where User='root';
mysql> flush privileges;
mysql> quit
5.再啟動MySQL
#/etc/init.d/mysql start

2010年7月31日 星期六

Ubuntu如何用指令匯出MySQL 的資料庫?

開啟終端機輸入下列指令

1.匯出某資料庫
# mysqldump -u root -p '密碼' 某資料庫名稱 > 輸出名稱.sql
或者是
# mysqldum p -u root -p 某資料庫名稱 > 輸出名稱.sql    按enter後再輸入mysql密碼
如果要所有資料庫匯出
# mysqldump -u root -p '密碼' -A > 多個輸出名稱.sql

2. 匯入某資料庫
# mysql -u root -p 某資料庫名稱 < 輸出名稱.sql 或是 sql語法
匯入多個
# mysql -u root -p -A < 多個輸出名稱.sql 

參數眾多 
請愛用 man mysqldump, man mysql
謝謝收看!!

2010年7月26日 星期一

Ubuntu裡安裝joomla

首先開啟終端機 安裝以下套件
  • apache2
  • php5
  • php5-mysql
  • mysql-server
  • mysql-client
  • phpmyadmin
先建資料夾 mkdir /var/www/想要的名稱 
再到這裡下載所需套件 http://www.joomla.org.tw/download

解壓縮至/var/www/想要的名稱
開啟browser 輸入http://localhost/想要的名稱
這樣就可進入安裝步驟了