虚拟机-Debian服务器配置

目的:用虚拟机中的Debian 8 操作系统作为web服务器

一、安装操作系统

首先要在vmware中安装一个debian操作系统,由于要让在局域网中的其他计算机能访问到此虚拟操作系统,因此在vmware中的网络连接方式设置为“桥接”模式。

二、设置IP地址

其次需要给debian设置静态IP地址。如下操作:

$ vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

把内容改成:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
# iface eth0 inet dhcp
iface eth0 inet static
address 10.19.10.0
netmask 255.255.255.0

然后重启服务:

$ sudo /etc/init.d/networking restart

三、虚拟机上网

由于网络受限,只有网络管理员才能给指定IP地址的计算机开通上网权限,所以这里需要借助物理机来作为代理服务器,通过物理机来实现虚拟机上网。

物理机是win7,安装ccproxy软件,把debian的IP地址(就是上面设置的10.19.10.0)加入。

虚拟机中需要知道物理机的IP地址和代理端口号。在debian中编辑 /etc/apt/apt.conf 这个文件,若没有则新建。在文件中输入以下内容:

Acquire{
http::proxy "http://10.19.10.200:808"
}

物理机IP:10.19.10.200

物理机代理端口:808

这样虚拟机就可以进行apt-get了。

2009年3月9日 上午1:20 ]

Debian全局代理

export http_proxy=”http://user:pass@youProxyAddress:port/

export https_proxy=”http://user:pass@youProxyAddress:port/

#可以将以上内容增添到/etc/profile中,可以在系统启动的时候就自动设置代理

Debian Apt-get代理

sudo nano /etc/apt/apt.conf

添加下列内容

Acquire {

  http::proxy “http://user:pass@yourProxyAddress:port”

  }

https://sites.google.com/site/debianpackageshare/Home/linux-tips/page-47

--End--