服務器開發 Ubuntu

  • 2020 年 5 月 29 日
  • 筆記

一、Ubuntu安裝

為什麼用Ubuntu,作為服務器初學者開發,如果真的要買蘋果系統電腦性價比不高,所以在window系統中安裝Linux虛擬機是不二之選。為什麼用Ubuntu不多說了,開始安裝吧。

以window 10 為例:

1)點擊控制面板->搜索”開發者設置”->設置開發者模式

 

 

 2)點擊控制面板->搜索「啟用或關閉windows功能」->打勾適用於Linux的windows子系統

 

 

  3)打開windos商店->搜索「linux」->出現結果多為Linux虛擬機->安裝Ubuntu18.04版本

簡單說明:依據評分筆者第一次下載了第一個版本,結果一切配置成功,開啟時出現死循環,找了很多原因,最後換了Ubuntu版本解決了。

表示很無語,所以依個人情況下載,筆者在這裡提供錯誤經驗。

 

 

   4)首次啟動

第一次啟動會慢,請等待一會,就會出現輸入username和password,一定要注意密碼輸入是不顯示的,所以輸入密碼一定要慢、

慢、慢。筆者第一次輸入按錯了忘記密碼,結果只能重新安裝……….

   5)更新下載源

因為原始下載源是國外的,下載東西比較慢,所以更新國內下載源會變快不少。

#備份指令

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

#添加源指令

sudo vim /etc/apt/sources.list

#在打開的文件中添加如下阿里源(i=編輯操作,esc=退出編輯,:wq=保存並推出 前面有個「:」號

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

如圖所示:

 

 #更新源

sudo apt-get update
sudo apt-get upgrade

 6)去除每次密碼輸入

#打開特定文件指令

sudo visudo

變為如下:之後點擊ctrl+s保存,ctrl+x退出。以防萬一重新進入看一下有沒有成功修改。