電腦聯網的情況下自動安裝流程:
打開終端
1.安裝ssh服務端
sudo apt-get install openssh-server
2.查看有沒有成功啓動ssh
ps -aux | grep ssh
顯示有 /usr/sbin/sshd
root 1147 0.0 0.3 65512 6196 ? Ss 4月08 0:12 /usr/sbin/sshd
3.啓動ssh或者重啓ssh
/etc/init.d/ssh start 或 /etc/init.d/ssh restart
問題解決:
1.在第一步安裝ssh服務端的時候如果遇到 軟件包有未滿足的依賴關係錯誤,原因是openssh-client與openssh-server所依賴的版本不同,解決方法是下載對應版本的openssh-client後再下載openssh-server。
sudo apt-get install openssh-client=1:7.2p2-4 下載openssh-client 等於號後面跟的是錯誤提示裏面括號裏面的內容
2.使用外國的souce源會比較慢,有時候還會報連接不上的錯誤,下面添加阿里源,當然國內其他源也可以
備份/etc/apt/sources.list
#備份
cp /etc/apt/sources.list /etc/apt/sources.list.bak
在/etc/apt/sources.list文件前面添加如下條目
#添加阿里源
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
參考: