如果直接從debian抓自動的話, 記憶體只有100mb而已, 真的太少 而且不能裝mysql 會有問題
<http://forum.cse.yzu.edu.tw/Linux/debian-sh4/download.php>
所以一定要從sh4twbox安裝 把uboot做更新的動作 讓記憶體可以吃到完整的256mb
來把網樂通裝上debian吧
準備動作:
1. 針, 可以去按RESET
2.網樂通,
3.網路線
4.一台有dhcp的switch
5. 一隻4g的隨身碟
開始動作: 以下有些事拷貝過來的 因為我懶得打字
1. 去抓 sh4twbox-0.9.2.7z 把他解壓縮之後全部檔案弄進隨身碟裡面的最外層(隨身碟要格式化成fat32)
2.
插入USB,按住 RESET, 插上電源
等待閃燈三下後放開 RESET (console log),
算30秒應該會出現藍燈,拔掉電源線 把隨身碟把出來 (過程中會看到藍燈一閃一閃,代表使用 SMIT UBOOT 更新 UBOOT)
------------------------底下這個我比較看不懂
安裝完之後可以將 iptvubootupdate.bin 更名,可以節省開機時間。(不更名或刪除的話,UBOOTWPDA會自動判斷相同版本,略去不升級),UBOOTWPDA判斷 RESET 只有開機的一瞬間,以後若需要外部USB優先開機也只要按一下子就好。
3.
隨身碟拿去電腦裡面, 去 Debian 下載那個rootfs ,
解壓縮之後把那個targer.tgz丟進隨身碟 並把他改名為src.tgz
插上網樂通 一樣按住reset 開機, IP從switch上面查看看 然後用telnet 連近去
以下是網路上COPY的
選擇作業系統(如 fedora/debian/wonderbox, 我選了Debian 下載那個rootfs), 附檔名為 .tgz 或 .txz 放進剛才的 USB 碟, 建議下載最迷你的 sh4twbox-<版號>.txz,(注意不是 .7z) ,如果USB目錄裏同時有多個 *.tgz 檔, 會自動安裝最後一個。另外也可以稍候在選單輸入下載網址安裝。
插入USB,拔電源,插網路線,按住 RESET,插上電源
亮紅燈代表外部USB開機中,就可放開 RESET鍵,大約40秒開機完成變成藍燈
下列方式選擇一種就可以得知網樂通 IP
ping sh4twbox
使用寬頻分享器指定網樂通的 MAC 分配固定 IP
查看寬頻分享器內部資訊得知分配給網樂通的 IP
自己的機器設定 192.168.168.1, ping 192.168.168.168
使用 ip scan 類程式掃描區域網路
知道 IP 後,使用 telnet 連線進網樂通,建議使用 pietty/putty 並且設定 session log 但記得要設定為 telnet port
帳號 root, 密碼 twpda打兩次
4. 進去網樂通後 , 輸入sh4twbox 按enter
看到以下的畫面
sh4twbox login: root
Password:
Enter 'sh4twbox' for install/recover sh4twbox.
22:48:26[0]root@sh4twbox / # sh4twbox <- 輸入後出現選單
Disk /dev/sda: 2021 MB, 2021654528 bytes <- 由這些特徵判斷出 sda1 是安裝碟
201 heads, 19 sectors/track, 1033 cylinders
Units = cylinders of 3819 * 512 = 1955328 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 1034 1973248 b Win95 FAT32
Disk /dev/sdb: 8027 MB, 8027897856 bytes <- 由8GB 判斷出 sdb 是目標碟
247 heads, 62 sectors/track, 1023 cylinders
Units = cylinders of 15314 * 512 = 7840768 bytes
Device Boot Start End Blocks Id System //這邊不一定是sdb1 sdb2而已 有的會有3跟4
/dev/sdb1 1 5 38254 6 FAT16
/dev/sdb2 6 135 995410 83 Linux
... 略
==============
Hostname:sh4twbox
Uptime : 20:38:32 up 29 min, 1 users, load average: 0.00, 0.00, 0.00
Free Mem:219 MB
IP Addr :192.168.0.11 192.168.168.168
boot from <- 必須是空的代表外部 USB 正確開機並全部載入記憶體
last command:
root pts/0 192.168.0.1:3369 Sun Oct 27 20:38 still logged in
==============
=== sh4twbox v0.9.2 MENU ===
1) Back to Shell (default)
2) Set Time (Sun Oct 27 20:38:32 CST 2013)
9) Reboot
p2) format first two partitions and install sh4twbox or other OS
p1) Replace one partition and install sh4twbox or other OS
h) show more choice options
============ Please Enter Number:
Disk /dev/sda: 2021 MB, 2021654528 bytes <- 由這些特徵判斷出 sda1 是安裝碟
201 heads, 19 sectors/track, 1033 cylinders
Units = cylinders of 3819 * 512 = 1955328 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 1034 1973248 b Win95 FAT32
Disk /dev/sdb: 8027 MB, 8027897856 bytes <- 由8GB 判斷出 sdb 是目標碟
247 heads, 62 sectors/track, 1023 cylinders
Units = cylinders of 15314 * 512 = 7840768 bytes
Device Boot Start End Blocks Id System //這邊不一定是sdb1 sdb2而已 有的會有3跟4
/dev/sdb1 1 5 38254 6 FAT16
/dev/sdb2 6 135 995410 83 Linux
... 略
==============
Hostname:sh4twbox
Uptime : 20:38:32 up 29 min, 1 users, load average: 0.00, 0.00, 0.00
Free Mem:219 MB
IP Addr :192.168.0.11 192.168.168.168
boot from <- 必須是空的代表外部 USB 正確開機並全部載入記憶體
last command:
root pts/0 192.168.0.1:3369 Sun Oct 27 20:38 still logged in
==============
=== sh4twbox v0.9.2 MENU ===
1) Back to Shell (default)
2) Set Time (Sun Oct 27 20:38:32 CST 2013)
9) Reboot
p2) format first two partitions and install sh4twbox or other OS
p1) Replace one partition and install sh4twbox or other OS
h) show more choice options
============ Please Enter Number:
如果你的sdb 有1 2 3 4 , 可能是預設切割 , 你一定要自己來 我把他弄成兩個分割區
第一是32MB而已 , 第二 = (全部拿走-32MB)
請參考這篇 將網樂通手工切割 不想看的話就往下看直接做
下指令
fdisk /dev/sdb
然後用d 把四個全部砍掉
在用n 新增 記得用primary 第一個只須+32MB
再按n 新增 一樣用primary 第二個用+7500MB
再按n新增 一樣用primary 第三個直接enter全部拿走
把sdb3變成swap
按 t–>3–>82(代表swap)–>enter
再按n新增 一樣用primary 第三個直接enter全部拿走
把sdb3變成swap
按 t–>3–>82(代表swap)–>enter
切割完了按w儲存
跳出後,格式化分割區。
mkdosfs -F16 -n bootwpda -v /dev/sdb1
mkfs.ext4 /dev/sdb2
mkdosfs -F16 -n bootwpda -v /dev/sdb1
mkfs.ext4 /dev/sdb2
結束之後 我讓網樂通重新開機 記得要插著隨身碟按RESET鍵 再進去一次
5. 重開機後再打sh4twbox
- target disk device(default:sdb) : sdb
- source file put on device or none (default:/dev/sda1) : /dev/sda1
- source file or download URL (default:auto) : 直接按Enter 即可
就會自己跑, 會看到隨身碟在閃 他在抓那個debian的src.tgz檔
跑有點久 請讓他自己弄 , 跑完之後隨身碟拔開 按9 重開機
就成功刷成debian啦 而且記憶體有256mb(可以下free指令查看)
把swap 掛上去
在弄成重開機回自己掛
vi /etc/fstab
增加下面這行
/dev/sda3 swap swap defaults 0 0
把swap 掛上去
| mkswap /dev/sda3 |
| swapon /dev/sda3 |
在弄成重開機回自己掛
vi /etc/fstab
增加下面這行
/dev/sda3 swap swap defaults 0 0
6. 架設vsFTPd
讓網樂通可以被鎖在home底下 ,然後新增一個資料夾 , 我可以讓房客抓到我的BT下載資料夾
他們也不會跑到home外面去 只能進去自己的資料夾新增刪除 , 但可以去別人的下載 不能刪除
指令
他們也不會跑到home外面去 只能進去自己的資料夾新增刪除 , 但可以去別人的下載 不能刪除
指令
apt-get install vsftpd
touch /etc/vsftpd.chroot_list
vim /etc/vsftpd.conf
/etc/vsftpd.conf
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# Run standalone with IPv6?
# Like the listen parameter, except vsftpd will listen on an IPv6 socket
# instead of an IPv4 one. This parameter and the listen parameter are mutually
# exclusive.
#listen_ipv6=YES
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=no
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in your local time zone. The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to Archer's FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
chroot_local_user=YES # 一定要yes
chroot_list_enable=YES #一定要yes
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list # 要逃出home就要把user設在裡面
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=ftp #這個地方有修改到
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/private/vsftpd.pem
local_max_rate=1000000 #限制下載的速度為1MB
local_root=/home
vim /etc/vsftpd.conf
/etc/vsftpd.conf
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# Run standalone with IPv6?
# Like the listen parameter, except vsftpd will listen on an IPv6 socket
# instead of an IPv4 one. This parameter and the listen parameter are mutually
# exclusive.
#listen_ipv6=YES
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=no
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in your local time zone. The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to Archer's FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
chroot_local_user=YES # 一定要yes
chroot_list_enable=YES #一定要yes
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list # 要逃出home就要把user設在裡面
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=ftp #這個地方有修改到
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/private/vsftpd.pem
local_max_rate=1000000 #限制下載的速度為1MB
local_root=/home
讓房客可以透過FTP下載到我的外掛隨身碟Seagate
因為chroot的關係 房客跑不出來home 所以要掛載目錄
在隨身碟新增電影的下載位置 //這是我預設BT下載位置
在home底下設定一個資料夾叫做 BT
因為chroot的關係 房客跑不出來home 所以要掛載目錄
在隨身碟新增電影的下載位置 //這是我預設BT下載位置
在home底下設定一個資料夾叫做 BT
mount --bind /media/Seagate/BT_Download /home/BT
這樣就可以從BT這個資料夾下載到隨身硬碟抓的電影
沒有留言:
張貼留言