環境:Ubuntu 16.04
以下命令若無加粗備注說明在本地計算機操作,則都是在服務器端操作
1 修改Ubuntu軟件源
Ubuntu安裝好之后,安裝軟件源的服務器地址在境外,速度會比較慢,因此建議修改軟件源為國內鏡像,這樣安裝和更新軟件會更快些,此處使用的是清華大學開源軟件鏡像
1.1 備份原有軟件源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
1.2 修改軟件源為國內鏡像
用編輯器打開/etc/apt/source.list
sudo vi /etc/apt/sources.list
而后將文件內原有內容清空,復制以下內容
# 默認注釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消注釋deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiversedeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse# 預發布軟件源,不建議啟用# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
2 更新軟件
更新軟件列表
sudo apt-get update
更新本地軟件
sudo apt-get upgrade
3 創建新用戶
剛登陸進去的時候,默認是root用戶,由于root用戶擁有很高的權限,也就意味著具有更大的破壞性,因此需要創建一個新用戶來作為日常使用用戶,需要更高權限的時候,再使用sudo命令來獲取。
此處假設我們要創建的用戶名為'xiaoming'
創建用戶并創建用戶文件夾
useradd -m xiaoming
為用戶設置密碼
passwd xiaoming
切換到新用戶并進入用戶文件夾
su - xiaoming
給新用戶賦予超級管理員權限
sudo usermod -a -G adm xiaomingsudo usermod -a -G sudo xiaoming
4 安裝并使用ssh遠程登陸
(ssh的安裝和配置在我另外一篇文章 //www.jb51.net/article/115994.htm 內已有詳細說明,為方便閱讀,特重新整理后粘貼如下)
安裝ssh服務
sudo apt-get install openssh-server
開啟ssh服務
sudo /etc/init.d/ssh start
查看本機IP地址
inet字段后面的就是你的IP地址
sudo ifconfig
新聞熱點
疑難解答
圖片精選