ubuntu系统常用软件的安装和配置

来源:互联网 发布:透明桌面日历软件 编辑:程序博客网 时间:2024/06/05 11:07

1.切换到root账号:

lte@Eikis:~$ sudo -s

[sudo] password for clj:  \\clj为安装系统的时候配置的普通用户名,输入在安装时设置的密码

root@Eikis:~#

 

2.添加root用户登录密码

root@Eikis:/# passwd root

Enter new UNIX password:          \\输入你想设的root的密码

Retype new UNIX password:

passwd: password updated successfully

 

3.更新

root@Eikis:~# apt-get update

 

4.安装ssh(便于远程使用ssh软件登录,以达到远程或跨平台操作)

root@Eikis:~# apt-get install ssh

配置ssh配置文件(使远程使用ssh能使用root登录)
root@Eikis:~# vim /etc/ssh/sshd_config 
 27 LoginGraceTime 120
 28 #PermitRootLogin without-password \\注释这行
 29 PermitRootLogin yes \\添加这行
 30 StrictModes yes

 

5.安装vim(便于编辑文本)

root@Eikis:~# apt-get install vim

 

6.安装wireshark 

root@Eikis:~# add-apt-repositoryppa:eugenesan/ppa

root@Eikis:~# apt-get update

root@Eikis:~# apt-get install wireshark

 

7.安装samba(便于在window平台映射linux平台共享文件夹)

root@Eikis:~# apt-get install samba

 

7.1 修改配置文件

root@Eikis:~# vi /etc/samba/smb.conf

102行

#   security = user

将102行前面的“#”号删除,如下

              security = user

 

在最后添加下面几行:

[public]

       path = /public

       public = yes

       writeable = yes

       browseable = yes

       guest ok = yes

 

7.2 进入主目录

root@Eikis:/# cd /

 

7.3在主目录创建一个名为public文件夹(共享目录)

root@Eikis:/# mkdir public

 

7.4修改新建文件夹的权限

root@Eikis:/# chmod 777 public

 

7.5 重启smbd

root@Eikis:/# /etc/init.d/smbd restart

 

7.6 查看PC的ip

root@Eikis:/# ifconfig

 

7.7 用自己的电脑通过ip进入linux 电脑自己刚刚创建的共享文件夹(public)里面

win+r(运行)输入: \\192.158.58.20  (192.158.58.20是linux PC的ip)

或win+e,点击映射网络驱动器: \\192.158.58.20 \public

 

7.8 将ubuntu-14.04.4-desktop-amd64(linux系统镜像) 和安装KVM虚拟机的文件拷贝到public文件夹中(为下面在虚拟机安装系统做铺垫)

 

8.安装kvm虚拟机

8.1. Install KVM

root@Eikis:/# apt-get install kvm qemu-kvmlibvirt-bin virtinst bridge-utils virt-viewer

 

8.2 Add user to the groups, and re-login after this :

root@Eikis:/# adduser root libvirtd

 

8.3 verify the installation:

root@Eikis:/# virsh -c qemu:///system list

 

8.4 配置网络IP(以桥接方式)

root@Eikis:/# vi /etc/network/interfaces

# This file describes the networkinterfaces available on your system

# and how to activate them. For more information,see interfaces(5).

 

# The loopback network interface

auto lo

iface lo inet loopback

 

# The primary network interface

auto eth0

iface eth0 inet manual

 

auto eth1

iface eth1 inet manual

 

auto eth2

iface eth2 inet manual

 

auto eth3

iface eth3 inet manual

 

auto eth4

iface eth4 inet manual

 

# bridge interfaces

auto br0

iface br0 inet static

       address172.0.5.170

       netmask255.255.255.0

       gateway172.0.5.1

       #dns-* options are implemented by the resolvconf package, if installed

       dns-nameservers8.8.8.8

       bridge_portseth0

       bridge_stp off

       bridge_fd 0

       bridge_maxwait 0

 

auto br1

iface br1 inet static

       address 172.1.1.170

       netmask 255.255.255.0

       bridge_portseth1

       bridge_stp off

       bridge_fd 0

       bridge_maxwait 0

 

auto br2

iface br2 inet static

       address 172.2.1.170

       netmask 255.255.255.0

       bridge_portseth2

       bridge_stp off

       bridge_fd 0

       bridge_maxwait 0

 

auto br3

iface br3 inet static

       address 172.3.1.170

       netmask 255.255.255.0

       bridge_portseth3

       bridge_stp off

       bridge_fd 0

       bridge_maxwait 0

 

 

auto br4

iface br4 inet static

       address 172.4.1.170

       netmask 255.255.255.0

       bridge_portseth4

       bridge_stp off

       bridge_fd 0

       bridge_maxwait 0

 

8.5 reboot the PC(使新配置的IP生效)

root@Eikis:/# reboot

 

8.6 enter root user

lte@Eikis:~$ sudo -s

 

8.7 Create the VM:

 

root@Eikis:/# virt-install --name Eikisvm1-r 2048 --disk path=/var/lib/libvirt/images/Eikisvm1_img,size=70 --vcpu=2--os-type linux -w bridge=br0 -w bridge=br1, -w bridge=br2, -w bridge=br3, -wbridge=br4 --virt-type kvm --cdrom=/public/ubuntu-14.04.3-desktop-amd64.iso

 

8.8 在虚拟机执行1-6步(以配置linux的基本软件)

 

8.9 Set auto start:(配置虚拟机开机启动)

root@Eikis:/# virsh autostart ltepc15vm1

 

8.10 shutdown <VM>(做一个原本,通过下面的克隆,创建多个虚拟机,必须关闭,不然克隆的虚拟机创建启动后,因为配置一样,导致IP冲突,ssh连不上)

root@Eikis:/#virsh shutdown ltepc15vm1

 

8.11 Clone VM on the same host:(若需创建多个虚拟机,可以通过克隆来创建,已达到配置一样的虚拟机)

root@Eikis:/#virt-clone--connect=qemu:///system -o Eikisvm1 -n Eikisvm2 -f/var/lib/libvirt/images/Eikisvm2_img

root@Eikis:/#virt-clone--connect=qemu:///system -o Eikisvm1 -n Eikisvm3 -f/var/lib/libvirt/images/Eikisvm3_img


8.12、若从一台机器的虚拟机考到另外一台的虚拟机

a.拷贝/etc/libvirt/qemu/下的Eikisvm1.xml,并修改名称为Eikisvm2.xml

        b.virsh define Eikisvm2.xml  :virsh list --all可以看到拷贝的虚拟机

        c、拷贝/etc/libvirt/qemu/autostart/Eikisvm1.xml并修改名称,让虚拟机能自启。


 

9.登录虚拟机Eikisvm2 和 Eikisvm3,修改主机名,这里列举Eikisvm2

9.1登录到虚拟机

root@Eikis:/# virt-viewer Eikisvm2

9.2 切换到root用户

lte@Eikisvm2:~$ sudo -s

[sudo] password for clj:

 

9.3修改hostname:

root@Eikisvm2:~# vi /etc/hosts

第二行修改如下:

127.0.1.1       Eikisvm2

 

root@Eikisvm2:~# vi /etc/hostname

第一行修改如下:

Eikisvm2

 

9.4设置终端显示:

配置shell环境变量脚本
  /etc/profile (所有用户都生效)
vim ~/.bashrc (当前用户生效)

root@Eikisvm2:~# vim ~/.bashrc:

1)、设置显示有颜色:

 32 TERM=xterm-color(添加此选项)

 33 case "$TERM" in

 34    xterm-color) color_prompt=yes;;

 35 esac

2)、设置显示路径名的最后一个:

 53 if [ "$color_prompt" = yes ];then

 54 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[    00m\]\$ '

 55 else

 56    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

 57 fi

把上述项加粗的w改为大写,小写w代表全路径名。

root@Eikisvm2:~# source ~/.bashrc:

9.5、设置vim:

vim  /etc/vim/vimrc

1)、显示行号: set nu

2)Tab键缩进4个空格: ts=4

 

 

9.4 重启虚拟机

root@Eikisvm2:~# reboot

 

10.在虚拟机(vm1,vm2,vm3)修改ip,根据PC规划表

root@Eikisvm2:~# vi /etc/network/interfaces

# interfaces(5) file used by ifup(8) andifdown(8)

auto lo

iface lo inet loopback

 

auto eth0

 

iface eth0 inet static

 

       address172.0.5.37

 

       netmask255.255.255.0

 

       gateway172.0.5.1

 

       dns-nameservers8.8.8.8

      

      

auto eth1

 

iface eth1 inet static

 

       address172.1.1.37

 

       netmask255.255.255.0

 

 

 

auto eth2

 

iface eth2 inet static

 

       address172.2.1.37

 

       netmask255.255.255.0

 

最后重启虚拟机:

root@Eikisvm2:~# reboot

 

在主机上查看正在运行的虚拟机:virsh list (加-all,把所有的虚拟机都列出来。包括没运行的)

编辑虚拟机配置文件:virshedit ltepc11vm1

启动虚拟机:virshstart 虚拟机的名称

关闭虚拟机:virshdestroy 虚拟机名称

安装多一个虚拟机是可以复制已存在的,但要先停掉已存在的虚拟机

1 0