在终端中输入ifconfig 查看网卡接口,会显示eth0,也可能会显示eth1,或者eth2,以此往下类推,此时我们需要eth0
sudo gedit /etc/network/interfaces 添加如下内容: auto eth0 iface eth0 inet static address 192.168.7.xxx //xxx代表Ubuntu的ip,也即是60+座位号 gateway 192.168.7.1 netmask 255.255.255.0
dns-nameservers 202.96.134.133(配置DNS)注意以前配置方法重启会被覆盖.保存退出
sudo /etc/init.d/networking restart //重启网络
在终端中输入命令 ping www.baidu.com 出现如下界面,代表可以ping通外网。
======================================================================
sudo apt-get install ssh
如果你使用的是虚拟机Vmware,那我们可以安装vmware tools以提高系统的图形和 鼠标的性能(在这之前,如果要从虚拟机切换回WINDOWS 窗口,需要同时按 CTRL+AL)
启动虚拟机,点击 vmware 菜单上的VM ==> Install vmware tools
复制VMwareTools-8.4.8-491717.tar.gz到主文件夹
打开终端(CTRL+ALT+T), cd ~
tar zxf VMwareTools-8.4.8-491717.tar.gz
cd vmware-tools-distrib/
sudo ./vmware-install.pl
提示的时候一路按回车下去,经过一会后,就安装完成了。之后你 可以比较方便的设置虚拟机的屏幕大小了,鼠标也可以在 WINDOWS 和 linux 间自如 滑动了。
vmtools卸载:
进入到/usr/bin目录,执行脚本sudo vmware-uninstall-tool.pl
注:ubuntu 12.04已经安装了最新版本的samba服务器,无需安装。如果使用12.04以前的版本,最好是按下边的方法升级一下samba,12.04版本无需下列操作
卸载samba,smbclient,samba-common $sudo apt-get remove samba-common$sudo apt-get remove smbclient$sudo apt-get remove samba
安装Ubuntu samba服务器:
sudo apt-get install samba
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo vi /etc/samba/smb.conf
[share]
path = /home/share // 共享路径
available = yes
browseabe = yes
public = yes
writable = yes
1>. sudo apt-get install vim
2>. sudo apt-get install ctags
3>. sudo gedit /etc/vim/vimrc.local添加以下内容
==============================================================
set tags=tags;
set autochdir
set nocp
syntax on "语法高亮"
set nocompatible "使用vim的键盘模式"
set nu "设置行号"
set nobackup "不需要备份"
set confirm "未保存或者只读时,弹出确认"
set mouse=a "鼠标可用"
set selection=exclusive
set selectmode=mouse,key
set showcmd "显示未完成命令"
set tabstop=4 "tab为4个空格"
set shiftwidth=4 "行交错"
set cindent "c文件类型自动缩进"
set autoindent "自动对齐"
set smartindent "智能缩进"
set hlsearch "高亮查找匹配"
set background=dark "背景色"
set showmatch "显示匹配"
set ruler "右下角显示光标位置"
set noerrorbells "不发出警告声"
set foldenable
set foldmethod=syntax
filetype plugin indent on
set fileencodings=gbk,utf-8,gb2312,gb18030,cp936
set termencoding=gbk,utf-8,gb2312,gb18030,cp936
=======================================================================
3>. 保存退出
1>.sudo passwd root(设置ROOT密码)
2>.sudo su(切换到root用户)
3>.exit(返回普通用户)
1>. sudo apt-get install vsftpd2>. sudo vi /etc/vsftpd.conf anonymous_enable=NO local_enable=YES write_enable=YES
添回如下形式(如果前面有#号,需要将#号去掉):
3>. sudo /etc/init.d/vsftpd restart
#sudo apt-get install nfs-kernel-server
ubuntu12.04中的已经是最新版本了,无需安装
打开/etc/exports文件,在末尾加入:
/opt/nfs *(rw,sync,no_root_squash)
注:nfs允许挂载的目录及权限,在文件/etc/exports中进行定义,各字段含义如下:
/opt/nfs:要共享的目录
* :允许所有的网段访问
rw :读写权限
sync:资料同步写入内存和硬盘
no_root_squash:nfs客户端共享目录使用者权限
重启服务:
sudo /etc/init.d/portmap restart <---重启portmap,
sudo /etc/init.d/nfs-kernel-server restart <---重启nfs服务
showmount -e <---显示共享出的目录
注:nfs是一个RPC程序,使用它前,需要映射好端口,通过portmap设定
命令执行情况如下:
sudo /etc/init.d/portmap restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart portmap
portmap start/running, process 474
sudo /etc/init.d/nfs-kernel-server restart
* Stopping NFS kernel daemon [ OK ]
* Unexporting directories for NFS kernel daemon... [ OK ]
* Exporting directories for NFS kernel daemon...
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/home/xgc".
Assuming default behaviour ('no_subtree_check').
NOTE: this default has changed since nfs-utils version 1.0.x
[ OK ]
* Starting NFS kernel daemon [ OK ]
showmount -e
Export list for xgc-VirtualBox:
/home/kevin *
现在可以在本机上试一下:
sudo mount -t nfs IPADDRESS:/opt/nfs /mnt
注:localhost为本机linux的IP地址
这样就把共享目录挂到了/mnt目录,取消挂载用:
sudo umount /mnt
若出现umount.nfs: /mnt: device is busy说明/mnt文件夹正在使用,应关闭才能卸载。
如果用在嵌入式设备上挂载,要加上参数-o nolock
我在开发板上使用的挂载命令:
mount -t nfs -o nolock IPADDRESS:/opt/nfs /mnt
1>.apt-get install tftp (安装客户端).
2>. apt-get install tftpd (安装服务端).
3>. apt-get instal xinetd (守护进程)
4>. sudo mkdir /tftpboot
5>. sudo chmod 777 -R /tftpboot
6>. sudo vi /etc/xinetd/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
7>. sudo /etc/init.d/xinetd restart
8>.sudo ufw disable (禁用防火墙).
9>. 测试TFTP
从服务器下载文件(存放在 /tftpboot目录下的test文件)
tftp IPaddress(192.168.x.xxx)
tftp> get test(获取下取文件)
tftp> quit (退出)
查看当前目录是否下载了test(不要在/tftpboot目录下执行以上命令).
2>. sudo gedit /etc/apt/sources.list替换
deb http://tw.archive.ubuntu.com/ubuntu raring main restricted universe multiverse deb http://tw.archive.ubuntu.com/ubuntu raring-security main restricted universe multiverse deb http://tw.archive.ubuntu.com/ubuntu raring-updates main restricted universe multiverse deb http://tw.archive.ubuntu.com/ubuntu raring-backports main restricted universe multiverse deb http://tw.archive.ubuntu.com/ubuntu raring-proposed main restricted universe multiverse deb-src http://tw.archive.ubuntu.com/ubuntu raring main restricted universe multiverse deb-src http://tw.archive.ubuntu.com/ubuntu raring-security main restricted universe multiverse deb-src http://tw.archive.ubuntu.com/ubuntu raring-updates main restricted universe multiverse deb-src http://tw.archive.ubuntu.com/ubuntu raring-backports main restricted universe multiverse deb-src http://tw.archive.ubuntu.com/ubuntu raring-proposed main restricted universe multiverse
3>. sudo apt-get upgrade
4>. sudo apt-get update