操作系統版本:
root@openstack-computer:~# more /etc/os-release NAME="Ubuntu" VERSION="16.04.5 LTS (Xenial Xerus)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 16.04.5 LTS" VERSION_ID="16.04" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" VERSION_CODENAME=xenial UBUNTU_CODENAME=xenial
操作系統版本爲16.04.5服務器版
本文目錄:
1.操作系統安裝
2.系統優化
本文介質:
鏈接:https://pan.baidu.com/s/1LenCI68uacAE-U_uIj1ecg
提取碼:dbfr
16.04.5各版本下載地址:http://nl.releases.ubuntu.com/16.04/?_ga=2.15533814.1988147862.1543216875-909190780.1539682835
Part1 操作系統安裝
語言選擇‘English’,16.04版本如果選擇‘中文(簡體)’安裝過程中會報錯‘無法安裝busybox-initramfs’,貌似這是個bug
回車
選擇‘English’
如圖,回車
選擇'No',回車
選擇如圖,回車
回車
安裝中
選擇網卡
配置網絡
DHCP配置失敗,回車
手動配置網絡
配置ip
掩碼
網關
name server爲空
主機名
domain爲空
新建用戶monitor
回車,下一步
設置密碼,回車
確認密碼,回車
選擇Yes,啓用弱密碼
選擇No,不加密家目錄
時區選擇,隨便選一個,系統裝好後可以修改
分區設置,選擇手動
選擇磁盤
選擇Yes
選擇磁盤,準備分區設置
創建新的區
大小爲500M
選擇主分區
選擇Beginning
準備設置文件系統格式和掛載點
文件系統格式爲Ext4
掛載點爲boot
go back
繼續分區,回車
同理,創建爲主分區的swap分區,大小爲8GB,文件系統格式選擇swap
返回
創建卷組和邏輯卷
使用全部剩餘磁盤空間
選擇爲主分區
文件系統類型爲lvm
返回
配置卷組邏輯卷
選擇Yes
創建卷組
卷組名爲rootvg
磁盤選擇/dev/sda3
開始創建邏輯卷
選擇唯一的vg rootvg,回車
邏輯卷名爲root
大小爲10GB
同理創建opt、var、usr、tmp、home等邏輯卷
查看已創建的邏輯卷
選擇Finish,準備掛載邏輯卷
選擇邏輯卷home,如圖
默認爲未使用狀態
文件系統選擇Ext4
掛載點默認爲空,選擇/home
同理掛載其它邏輯卷
配置完成如圖
完成分區,寫入磁盤
選擇Yes
系統安裝中
爲空,繼續
不更新
安裝包選擇,這裏選擇ssh和virtual machine host,ssh是爲了方便遠程登錄,virtual machine host是kvm服務
選擇Yes
彈出磁盤,繼續
完成安裝,使用monitor賬號登陸
Part2 系統優化
系統已完成安裝,此時可以通過crt、putty等工具遠程登錄
1.允許root登陸並設置root密碼
monitor@openstack-computer:~$ sudo view /etc/ssh/sshd_config PermitRootLogin yes PasswordAuthentication yes monitor@openstack-computer:~$ sudo service ssh restart
設置root的密碼
monitor@openstack-computer:~$ sudo su - root root@openstack-computer:~# passwd root Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
2.配置ip和dns
root@openstack-computer:~# view /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 auto ens160 iface ens160 inet static address 172.27.34.38 netmask 255.255.255.0 network 172.27.34.0 broadcast 172.27.34.255 gateway 172.27.34.1 dns-nameserver 218.104.111.122 dns-search foo.org.bar.co root@openstack-computer:~# service networking restart
dns-nameserver請根據實際情況填寫,配置後重啓網絡服務
3.配置apt源
root@openstack-computer:~# view /etc/apt/sources.list deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse root@openstack-computer:~# apt update
將源設置爲阿里源並更新
4.修改時區
查看當前時區
root@openstack-computer:~# date -R Thu, 29 Nov 2018 03:53:49 -0500
修改時區
root@openstack-computer:~# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
驗證
root@openstack-computer:~# date -R Thu, 29 Nov 2018 16:58:15 +0800
時區修改完成
至此完成Ubuntu16.04.5操作系統安裝