红联Linux门户
Linux帮助

Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署

发布时间:2017-04-01 15:59:12来源:简书作者:蒋承爱拖延
一、Ubuntu Server 16.10 LTS 系统安装(同样适用于Ubuntu 17.04 Server版本。)
Ubuntu 16.10/Ubuntu 17.04 分为桌面版 (desktop)和服务器版(Server)。两者对于用户而言,最大的区别在于桌面版有图形操作界面,而服务器版本只能使用命令行来对系统进行控制 (目前服务器版本也可以在安装完成后,自行添加图形界面)。从使用者的角度来说,由于舍弃了图形界面,并且拥有更为稳定的更新支持,服务器版本更加适用于长期、稳定和低功耗(降低服务器的使用量,内存、CPU、显卡等)的运行并向外界提供服务,而桌面版的Ubuntu则更适合用于日常的办公和娱乐。
Ubuntu Server的下载地址:http://www.ubuntu.com/download
以下的回答摘自Ubuntu Documentation。
What's the difference between desktop and server?
1.The first difference is in the CD contents. The "Server" CD avoids including what Ubuntu considers desktop packages (packages like X, Gnome or KDE), but does include server related packages (Apache2, Bind9 and so on). Using a Desktop CD with a minimal installation and installing, for example, apache2 from the network, one can obtain the exact same result that can be obtained by inserting the Server CD and installing apache2 from the CD-ROM. (服务器版本的安装包内含服务器基础应用,例如 Apache2, Bind9;而桌面版本的安装包则包含Gnome,KDE, X 等应用)
2.The Ubuntu Server Edition installation process is slightly different from the Desktop Edition. Since by default Ubuntu Server doesn't have a GUI, the process is menu driven, very similar to the Alternate CD installation process. (安装的过程不同,服务器版本由于没有图形界面,安装的过程是通过菜单选项来进行的。这个我们接下去会接触到)
3.Before 12.04, Ubuntu server installs a server-optimized kernel by default. Since 12.04, there is no difference in kernel between Ubuntu Desktop and Ubuntu Server since linux-image-server is merged into linux-image-generic. (12.04 之前的服务器版本是使用了服务器优化的内核的,而12.04之后,桌面版和服务器版本的内核就没有什么区别了。)
4. For Ubuntu LTS releases before 12.04, the Ubuntu Desktop Edition only receives 3 years of support. This was increased to 5 years in Ubuntu LTS 12.04 In contrast, all Ubuntu LTS Server Edition releases are supported for 5 years.(12.04之前的桌面版只有3年的支持服务,而所有的服务器版本都拥有5年的支持更新服务。)
我使用的安装环境是VMware vSphere Clinet, 是针对服务器集群应用的虚拟机环境。用启动盘成功引导之后,出现下面的界面。选择安装语言English (目前在虚拟机内安装Ubuntu 14之后的服务器版本均不能选择中文(简体)选项,会在安装过程中出现异常而导致安装失败。)
以下安装Ubuntu 16.10 Server/Ubuntu 17.04 Server开始,图片的下方有详细讲解。
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择安装语言:English
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
默认选择第一项:Install Ubuntu Server
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择时区:Hong Kong
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择键盘布局所属国家:English(US)
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择键盘布局 English (US)
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
等待预加载
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择主网卡(一般机器上都只会有一个网卡,选择默认按回车就好)
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
设置主机名,主机名就是在网域中你部署的服务器的名字
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
输入用户名(请务必牢记,用来登陆使用)
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
填写密码(请务必牢记,如果是测试用的,可以不填)
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择否
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
根据你的物理地址,检测到你的时区。如果没有错误,则选Yes继续,如果有误可以选择No来手动选择
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
对磁盘进行分区,建议选择Manual手动来进行分区
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
进入分区界面,可以查看到当前的磁盘总量,我的磁盘大小是2.2TB,选中并回车来新建一个分区
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择  Yes 来新建一个空白分区表
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
这样我们就基于硬盘的总量建立了一个空白的新空间,点击磁盘空闲空间
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择新建新分区
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
输入分区大小,最先创建的时/boot分区,建议大小为200MB。(我的物理空间比较大,所以填了400MB)
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择主分区 Primary
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择 新分区建在可用给空间的首部或者尾部, 选择 Beginning 开始位置
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择 Ext4 journaling file system 。更改 Mount Point 分区挂载点 为 /boot。点击分区设定结束 (Done Setting Up)
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
继续选择空闲空间,创建新分区
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
创建交换空间分区 swap area (建议大小为内存大小的1.5 ~ 2 倍)
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择Primary,主分区
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择 Beginning,头部
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择 swap area
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
继续创建新分区
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
填写max将剩余的空闲空间都用于新分区
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择 Ext4 journaling file system,就可以确认了。
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
最后形成的分区表如图所示,选择结束分区并写入磁盘来进行执行分区操作。
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择是来执行分区操作
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
如果需要使用 HTTP proxy来访问外网的,则在此处填写。没有就直接选择继续就好
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
基于服务器的稳定性考虑,建议选择不自动更新。对关键更新采用手动操作。
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择需要安装的软件,根据自己服务器的需要来进行选择,也可以在安装完毕后自行手动添加。
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
默认选择 Yes
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
选择继续,系统自动重启,这时候要把加载的安装光盘退出来。
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
进入登录界面,Ubuntu Server 16.10 安装完毕。(注:和Ubuntu 17.04 Server安装完成画面一样。)
 
二、开启管理员Root账号
一般我们在服务器内的操作都需要通过管理员Root账号来进行。 
sudo passwd root  #启用Root账号并设置密码, 根据提示输入两次密码
su root  #从普通用户切换到root用户,根据提示输入root密码
su moodletsg #从root用户切回到普通用户,在 su 之后输入你自己的用户名
sudo passwd -l root #禁用root账号,要重启则输入 sudo passwd root 再次设置密码
参考文章:
Ubuntu 16.10入门了解/下载/安装/基本使用方法一条龙指引:http://www.linuxdiyf.com/linux/25080.html
 
三、设置网络环境
1、首先查看下当前的网络环境
ifconfig  # 查看当前的网络连接情况,类似于Windows命令提示符环境下的 ipconfig
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
2、配置网络
通过nano来编辑网络配置文件,该文件位于/etc/network下,文件名为interface
nano /etc/network/interface
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
当前的网络IP获取方式为 DHCP模式,我们的服务器需要采用固定IP来使外部用户使用服务器上提供的服务。修改#The primary network interface 下的内容:
auto ens192
iface ens192 inet static     #inet static 设定为静态IP
address 172.30.10.140   #设定静态IP地址,可根据ifconfig中的IP地址信息来填写
netmask 255.255.255.0    #子网掩码,根据你的网段设置来填写
gateway 172.30.10.1          #网关,根据你的服务器所在网段的网关地址来填写
dns-nameservers 172.20.123.9  #设置DNS
dns-nameservers 8.8.8.8 
Ctrl + o                              #保存配置
Ctrl + x                              #退出
service networking restart #重启网络,应用新配置。如果出现新配置未生效,则需要重启服务器。
如果在设置完成后发现仍然无法上网,则需要查看DNS缓存配置
nano /etc/resolv.conf  #在命令行中输入,来编辑DNS缓存配置文件
nameserver 172.20.123.9  #设置首选DNS
nameserver 8.8.8.8    #设置备用DNS
Ctrl + o
Ctrl + x
Ubuntu 16.10 Server/Ubuntu 17.04 Server安装及基本部署
 
三、更新
在正式开始使用Ubuntu Server之前,对软件源和软件包进行更新,以便于后续的软件安装。
apt-get update   #更新源
apt-get upgrade #更新软件包
 
本文永久更新地址:http://www.linuxdiyf.com/linux/29660.html