Openwrt安装软件
简介Openwrt是个很自由的开源路由器系统,软件包支持几千个,功能很强大!
安装的方法主要有两种,telnet或者ssh连接后台安装和 页面安装。
下面的所有步骤的前提是当前的路由器已经联网!
telnet或ssh原始的openwrt默认是没有密码的,只开启了telnet没有开启ssh,当第一次配置完用户名和密码后,关闭了telnet开启了ssh,用户可以随时连上路由器,下面我用ssh连接的。
Openwrt管理软件包的命令是opkg,下面是命令的帮助
root@Jack:/tmp/opkg-lists# opkg--help opkg:unrecognized option `--help' opkgmust have one sub-command argument usage:opkg [options...] sub-command [arguments...] wheresub-command is one of: PackageManipulation: update 升级 Update list ofavailable packages upgrade <pkgs> 升级某一个软件 Upgrade packages install <pkgs> 安装某一个软件 Install package(s) configure <pkgs> 配置某一个软件 Configure unpacked package(s) remove <pkgs|regexp> 删除软件 Remove package(s) flag <flag> <pkgs> Flag package(s) <flag>=hold|noprune|user|ok|installed|unpacked (one perinvocation) InformationalCommands: list 列出openwrt所有支持的软件包 List availablepackages list-installed 列出本机已经安装的软件包 List installed packages list-upgradable 列出可以升级的软件包 ist installed and upgradable packages list-changed-conffiles List user modified configuration files files <pkg> List files belonging to<pkg> search <file|regexp> List package providing <file> find <regexp> List packages whose name ordescription matches <regexp> info[pkg|regexp] 显示软件包的信息 Display all info for <pkg> status [pkg|regexp] 显示软件包的状态 Display all status for <pkg> download<pkg> 下载一个软件包到当前目录 Download<pkg> to current directory compare-versions <v1> <op><v2> compare versionsusing <= < > >= = << >> print-architecture List installable package architectures depends [-A] [pkgname|pat]+ whatdepends [-A] [pkgname|pat]+ whatdependsrec [-A] [pkgname|pat]+ whatrecommends[-A] [pkgname|pat]+ whatsuggests[-A] [pkgname|pat]+ whatprovides [-A] [pkgname|pat]+ whatconflicts [-A] [pkgname|pat]+ whatreplaces [-A] [pkgname|pat]+ Options: -A Query all packages not just thoseinstalled -V[<level>] Set verbosity level to <level>. --verbosity[=<level>] Verbosity levels: 0errors only 1normal messages (default) 2informative messages 3 debug 4 debuglevel 2 -f <conf_file> Use <conf_file> as the opkgconfiguration file --conf <conf_file> --cache <directory> Use a package cache -d <dest_name> Use <dest_name> as the the rootdirectory for --dest <dest_name> package installation, removal, upgrading. <dest_name>should be a defined dest name from theconfiguration file, (but can also be a directory namein a pinch). -o <dir> Use <dir> as the rootdirectory for --offline-root <dir> offline installation of packages. --add-arch<arch>:<prio> Registerarchitecture with given priority --add-dest<name>:<path> Registerdestination with given path ForceOptions: --force-depends Install/remove despite faileddependencies --force-maintainer Overwrite preexisting config files --force-reinstall Reinstall package(s) --force-overwrite Overwrite files from other package(s) --force-downgrade Allow opkg to downgrade packages --force-space Disable free space checks --force-postinstall Run postinstall scripts even in offlinemode --force-remove Remove package even if prerm script fails --noaction No action -- test only --download-only No action -- downloadonly --nodeps Do not follow dependencies --nocase Perform case insensitivepattern matching --force-removal-of-dependent-packages Remove packageand all dependencies --autoremove Remove packages that were installed automaticallyto satisfy dependencies -t Specify tmp-dir. --tmp-dir Specify tmp-dir. regexp could be something like 'pkgname*''*file*' or similar e.g. opkg info 'libstd*' or opkg search'*libop*' or opkg remove 'libncur*' root@Jack:/tmp/opkg-lists#
如果你想要安装一个软件,但是不知道什么具体的名字,可以用命令获取到软件包的名字(opkg list |grep 软件名),然后安装,比如我想要安装tftp
root@Jack:/tmp/opkg-lists# opkg list|grep tftp atftp- 0.7-1 - TFTP client atftpd- 0.7-1 - TFTP server erlang-inets- 5.8 - Erlang/OTP is a general-purpose programming language and runtimeenvironment. Erlang has built-in support for concurrency, distribution and fault tolerance. . This Erlang/OTPpackage provides a container for Internet clients and servers. Currently a FTP client, a HTTPclient and server, and a tftp client andserver have been incorporated in Inets. iputils-tftpd- 20101006-1 - Program tftpd from iputils Trivial File Transfer Protocolserver. kmod-ipt-nathelper- 3.7.10-1 - Default Netfilter (IPv4) Conntrack and NAT helpers Includes: - ftp- irc - tftp tftp-hpa- 0.48-3 - An enhanced version of the BSD TFTP client tftpd-hpa- 0.48-3 - An enhanced version of the BSD TFTP server
通过上面的命令我找到我想要的tftp服务器的名字为tftpd-hpa,这样就可以先用
#opkgdownload tftpd-hpa
下载软件包,然后用
#opkginstall tftpd-hpa
来安装。也可以直接用
#opkg installtftpd-hpa
会直接先下载再自动安装。最后用
#opkglist-installed |grep tftpd-hpa
来查看是不是已经安装上了!
页面安装
进入页面system->software
在filter里面输入“tftpd”,点击“find package”,在下面的框中就显示出当前openwrt支持的软件包,找到需要的,点击install即可。见下图
刚才遇到了一个小问题在源码中修改tomcat 的链接器的端口以及url的编码方式没有生效:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
改成了这样:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="utf-8"/>
没有生效:
找了一下原因:
原来我在VM arguments里设置了 这个启动参数:-Dcatalina.home=${project_loc:/tomcat-7.0.x/java/org/apache/catalina/startup/Bootstrap.java}/output/build
也就是说我改源码没有经过ant打包,这个包里面的配置并没有改过来。
重新打过包之后:
在看tomcat的源码:
在CoyoteAdapter的service方法里
req.getParameters().setQueryStringEncoding
(connector.getURIEncoding());
这段代码获取的URIEncoding确实改成了utf-8,不设置的话是为null的,如果为null的话,默认的编码方式是iso-8859-1
#安装VBox依赖
apt-get update
apt-get install gcc make dkms build-essential pentium-builder
sudo apt-get install xserver-xorg xserver-xorg-core
sudo reboot
#安装VBox Extension
sudo mount /dev/cdrom/
sudo ./VBoxLinux*.run
sudo reboot
#配置网络
sudo vi /etc/network/interfaces
auto eth1
iface eth1 inet static
address 192.168.56.4
netmask 255.255.255.0
gateway 192.168.56.1
sudo /etc/init.d/networking restart
sudo reboot
########################################################################
#安装NFS server
sudo apt-get install nfs-kernel-server
sudo /etc/init.d/nfs-kernel-server restart
sudo /etc/init.d/portmap restart
showmount -e 127.0.0.1
mkdir /share
sudo chmod -R 777 /share
sudo vi etc/exports
/share *(rw,sync)
#客户端
sudo apt-get install nfs-common
mkdir /share
sudo chmod -R 777 /share
sudo vi /etc/fstab
192.168.56.4:/share /share nfs rw 0 0
mount -t nfs 192.168.56.4:/share /share
########################################################################