NAS 詳細搭建方案 - 安裝Ubuntu Server

目錄


Ubuntu Server


1 下載與安裝

1.1 下載地址

Ubuntu官網下載: http://cdimage.ubuntu.com/releases/18.04/release/
我這裏採用的版本爲 Ubuntu Server 18.04.1 LTS

1.2 安裝

和安裝win server一樣,先鏡像上傳到ESXI,然後直接新建虛擬機就可以了。硬件配置我分配了2G內存和20G硬盤。
加載完畢後,選擇語言、選擇安裝位置、選擇引導位置,然後等待安裝結束重啓。

2 後續配置

2.1 設置root密碼

sudo passwd root

Password:你當前的密碼
Enter new UNIX password:這個是root的密碼
Retype new UNIX password:重複root的密碼

2.2 設置靜態IP

Ubuntu18.04採用的是netplan來管理network。所以可以在/etc/netplan/目錄下創建一個以yaml結尾的文件。比如01-netplan.yaml文件。
然後在此文件下寫入以下配置(注意保留空格縮進):

network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      dhcp4: no
      addresses: [192.168.1.102/24]
      gateway4:  192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 114.114.114.114]

然後重啓網絡

sudo netplan apply

2.3 修改時區

輸入timedatectl status如果顯示的時間不對,則使用如下命令修改時區

sudo timedatectl set-timezone 'Asia/Shanghai'

2.4 更新系統,升級應用

添加更新源。服務器版的ubuntu更新源很少,需要吧一些常用的更新源添加進去

sudo vi /etc/apt/sources.list

# 在最後添加下列源,並保存: #######################################
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse

# 163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
# ######################################################################

更新源及系統:

sudo apt-get update
sudo apt-get upgrade
  • 如果update出錯
sudo vim /etc/resolv.conf
把nameserver的值換爲8.8.8.8

再重啓網絡服務

/etc/init.d/networking restart

2.5 掛載nas盤

  • 掛載
sudo apt-get install nfs-common
cd ~
sudo mkdir nfs
cd nfs
sudo mkdir Download
sudo mount -t nfs 192.168.1.100:/Download /home/username/nfs/Download
  • 卸載
sudo umount 192.168.1.100:/Download /home/username/nfs/Download

3 安裝必要的軟件

sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install make
sudo apt-get install unzip
sudo apt-get install apache2
sudo apt-get install -y php7.2
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章