使用root账户两种方法
1. 用安装时的账户给root设定密码
sudo passwd root
2. sudo -i
允许root远程ssh登录
sudo vi /etc/ssh/sshd_config
PermitRootLogin yes
sudo service ssh restart
查询软件包是否安装
dpkg -l | grep package-name
查看已安装软件包内的文件
dpkg -L package-name
查询文件所对应的软件包
dpkg -S file-name
安装sysv-rc-conf管理开机自启服务
aptitude -y install sysv-rc-conf
sysv-rc-conf --list
sysv-rc-conf
useradd建立用户时建立用户目录和mail目录
vi /etc/default/useradd
SHELL=/bin/bash
CREATE_MAIL_SPOOL=yes
vi /etc/login.defs
CREATE_HOME yes
使用mail查看邮件
aptitude -y install mailutils
加入mail group才可使用mail命令查看邮件
usermod -G mail user-name
使用阿里云源
vi /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
设定主机名
vi /etc/hosts
remove or comment the line beginning with 127.0.1.1
vi /etc/hostname
设定静态IP地址--eth0
vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.44.13
netmask 255.255.255.0
gateway 192.168.44.200
dns-nameservers 210.22.84.3
不设定IP地址--eth1
auto eth1
iface eth1 inet manual
up ip link set dev $IFACE up
down ip link set dev $IFACE down
设定静态路由
up route add -net 172.20.11.0/16 gw 172.20.10.254 dev eth1
down route del -net 172.20.11.0/16 gw 172.20.10.254 dev eth1
安装KVM
aptitude -y install qemu-kvm libvirt-bin virtinst bridge-utils
modprobe vhost_net
echo vhost_net >> /etc/modules
设定bridge interface --只对有线网卡有效
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.168.44.13
netmask 255.255.255.0
gateway 192.168.44.200
dns-nameservers 210.22.84.3
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
设定active-backup mode bonding interface
auto eth0
iface eth0 inet manual
bond-master bond0
bond-primary eth0
auto eth1
iface eth1 inet manual
bond-master bond0
auto bond0
iface bond0 inet static
address 192.168.44.13
netmask 255.255.255.0
gateway 192.168.44.200
dns-nameservers 210.22.84.3
bond-mode active-backup
bond-miimon 100
bond-slaves eth0 eth1
设定 802.3ad LACP mode bonding interface
auto eth0
iface eth0 inet manual
bond-master bond0
auto eth1
iface eth1 inet manual
bond-master bond0
auto bond0
iface bond0 inet static
address 192.168.44.13
netmask 255.255.255.0
gateway 192.168.44.200
dns-nameservers 210.22.84.3
bond-mode 4
bond-miimon 100
bond-lacp-rate 1
bond-slaves eth0 eth1
reboot
修改注释颜色
vi /etc/vim/vimrc
highlight Comment ctermfg=none
Hot Add vm disk to ubuntu in vmware workstation:
aptitude -y install scsitools
cat /proc/partitions
add vm disk
rescan-scsi-bus
cat /proc/partitions
fdisk /dev/sdx
Regenerate OpenSSH Host Keys
dpkg-reconfigure openssh-server
安装virt-manager管理工具:(参考http://www.ilanni.com/?p=6055)
apt-get update; apt-get -y install virt-manager qemu-system
转载于:https://blog.51cto.com/hj192837/1412864