要想做好一個程序員,基本的服務器構架的能力還是需要有的。除了在本地開發,我們還要學會如何去部署我們開發好的系統。由於Linux的開源免費且功能強大,性能卓越。很多企業都會選擇將服務部署在Linux系統上,所以我們對Linux也需要有一定的瞭解這樣才能將工作做的更好,這裡我比較喜歡Ubuntu版本的Linux。如果你沒有其他的電腦來搭建Linux我們可以利用虛擬機安裝,如果你電腦配置不高的話可以選擇安裝服務器版本,這樣基本不影響你電腦的運行。
前期準備
我們需要先下載好系統和VMware虛擬機,系統可以進Ubuntu官網下載你認為合適的版本,我下載的是 ubuntu-18.04.2-live-server-amd64.iso 服務器版本(無圖形界面)。VMware虛擬機百度一下就可以找到了,我們找個綠色版本就可以了(安裝簡單無需激活)。
VMware新建Ubuntu虛擬機
運行VMware並點擊新建虛擬機,在彈出的“新建虛擬機嚮導”窗口中選擇-->自定義(高級)-->硬件兼容這裡我默認選了Workstation14.x,下一步選擇我們下載好的服務器鏡像文件ubuntu-18.04.2-live-server-amd64.iso 。接下來配置下服務器的相關信息,處理器和內存大小可以根據自己電腦性能適當的調整,網絡選擇NAT其他的都選擇推薦即可。
這裡需要注意的是Ubuntu中root用戶是保留用戶所以用戶名不能用root
安裝ubuntu系統
Please choose your preferred language。
配置好之後VMware會啟動虛擬機並加載ubuntu鏡像,等加載完成之後便進入了安裝Ubuntu界面。首先我們需要選擇系統使用的語言,服務器版本沒有中文這裡我們選擇English即可(按鍵盤Enter鍵確認選擇)。
Please select your keyboard layout below,or select "Identify keyboard" to detect your layout automatically
接著要我們選擇鍵盤佈局(默認時美式鍵),我們也可以通過“Identify keyboard”選擇來自動檢測佈局。這裡可以保持默認設置,直接回車。
Welcome to Ubuntu ! The world's favourite platform for clouds, clusters, and amazing internet things. This is the installer for Ubuntu on servers and internet devices.
這裡我們選擇安裝【Install Ubuntu】,後面兩個是雲端服務可以暫時略過。
Configure at least one interface this server can use to talk to other machines,and which preferably provides sufficient access for updates.
這裡是讓我們配置至少一個可用於與其他計算機對話的接口,默認通過dhcp的方式獲取到一個IP地址192.168.128.128,可以直接選擇【Done】進入下一步。
If this system requires a proxy to connect to the internet, enter its details here;If you need to use a HTTP proxy to access the outside world,enter the proxy information here.Otherwise,leave this blank;the proxy information should be given in the standard form of http://[[user][:pass]@]host[:port]/
如果你的系統需要通過代理來鏈接Internet就可以在這裡配置,否則留空即可。這裡我沒有使用代理,所以直接選擇【Done】繼續下一步。
If you use an alternative mirror for Ubuntu, enter its details here;you may provide an archive mirror that will be used instead of the default 'http://archive.ubuntu.com/ubuntu'
這裡讓我們配置Ubuntu鏡像源,默認是 'http://archive.ubuntu.com/ubuntu'。這個後面可以修改,這裡我們先忽略直接選擇【Done】繼續下一步
The installer can guide you through partitioning an entire disk either directly or using LVM, or, if you prefer,you can do it manually;If you choose to partition an entire disk you will still have a chance to review and modify the results.
這裡讓我們選擇分區方式,程序提供了3中方式分別是使用整個磁盤、使用整個磁盤並設置lvm或者手動分區,這裡我選擇【Use An entire Disk】分區直接回車下一步。下一頁顯示VMware為我們虛擬的磁盤,選擇該磁盤繼續直接回車下一步即可。
Selecting Continue below will begin the installation process and result in the loss of data on the disks selected to be formatted;You will not be able to return to this or a previous screen once the installation has started;Are you sure you want to continue?
程序為我們自動分配好了內存,1M用於bios,其他的全部劃分到了根目錄。直接選擇【Done】繼續下一步,然後會彈出一個提示窗口,告訴我們選擇繼續將開始安裝過程並會格式化的磁盤(數據會丟失,提醒 備份)。這裡我用的虛擬機所以沒影響的,直接選擇【Continue】繼續下一步。
Enter the username and password you will use to log in to the system;You can configure SSH access on the next screen but a password is still needed for sudo.
創建一個用於登錄系統的用戶,依次輸入你的名字、服務器主機名、用戶名、用戶密碼即可,填好之後選擇【Done】繼續下一步。
You can chose to install the OpenSSH server package to enable secure remote access to your serve.
OpenSSH簡稱SSH,通過SSH可以實現遠程訪問服務器,安裝時用空格鍵選擇,選中之後跳到【Done】繼續下一步。
These are popular snaps in server environments. Select or deselect with SPACE,press ENTER to see more details of the package,publisher and versions abailable.
這是服務器中常見的服務,如果你需要安裝可以通過空格選擇或取消選擇,這裡可以在後面用到的時候再安裝,選擇【Done】下一步。
完成以上配置之後就進入了安裝過程,這裡需要點時間還請耐心等待,安裝完成後會在[View full log]按鈕下多出一個[Reboot Now]按鈕。我們選擇【Reboot Now】重啟ubuntu,接下來我們就可以開啟Linux之旅了!
總結:
Ubuntu服務器版本安裝很簡單,只要理解 了每一步的意思就知道該怎麼選擇了。以上內容是小編給大家分享的Linux實戰001:VMware下安裝Ubuntu18.04(服務器版),希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回覆大家的。
閱讀更多 編程手札 的文章