[Linux] Ubuntu: 相关工具及配置

1. 网络配置

  sudo vim /etc/network/interfaces
  // 编辑以下信息,设置静态IP地址
  auto eth0
  iface eth0 inet static
  address 192.x.x.x
  netmask 192xxx
  broadcast xxxx
  gateway xxxxx
  dns-nameservers *.*.*.*, ...

  dhcp:

 auto lo
 iface lo inet loopback

 auto eth0
 iface eth0 inet dhcp

   //重启网络服务
  sudo /etc/init.d/networking restart
  ifconfig // 查看网络相关设置。

eth0: ERROR while getting interface flags: No such device

由于Linux将MAC地址缓存了,所以在copy虚机后一般会出现这种错误.如果用ifconfig -a 会发现eth1,而没有eth0.

解决方法:

 1. 将 /etc/sysconfig/network/ifcfg-eth0 改名为ifcfg-eth1,然后重起网络服务sudo /etc/init.d/networking restart.

 2.   删除网络配置缓存文件 rm /etc/udev/rules.d/70-persistent-net.rules, 然后重启机器.

2.安装openssh协议

  sudo apt-get install openssh-server openssh-client

3.安装设置防火墙

  sudo apt-get install ufw
  sudo ufw enable //启用
  sudo ufw allow openssh //允许openssh端口
  sudo ufw status //查看ufw状态

4.打开ssh协议后,可以用Putty、Psftp、pscp等工具联接了

    psftp 简单使用
    open 192.168.1.X // 联接服务器
    cd  .. //设置服务器对应目录
    lcd .. //设置本地对应该目录
    put a.html // 上传本地文件(a.html)到服务器
    get a.html // 下载服务器上的文件(a.html)
    put -r dir // 上传本地目录和文件
    get -r dir // 下载目录和文件
   

5.更新

更新源列表: sudo apt-get update

更新软件:    sudo apt-get upgrade

 
   

原文地址:https://www.cnblogs.com/abeen/p/1752490.html