1. 程式人生 > >Ubuntu15.1安裝openssh-server

Ubuntu15.1安裝openssh-server

客戶端電腦通過SSH訪問Ubuntu伺服器,伺服器上必須得安裝SSH-server才可以。
1、如果Ubuntu系統不是最新系統,需要更新apt-get:sudo apt-get update,如果更新失敗,可能需要換源,即修改/etc/apt/sources.list檔案:
(1)備份:sudo cp sources.list sources.list.bak
(2)sudo gedit /etc/apt/sources.list 修改檔案內容,把原來檔案內容刪掉,替換成下面的:

# deb cdrom:[Ubuntu 15.10 _Wily Werewolf_ - Release amd64 (20151021)]/ wily main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ wily main restricted #Added by software-properties # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://old-releases.ubuntu.com/ubuntu/ wily main restricted deb-src http://old-releases.ubuntu.com/
ubuntu/ wily multiverse universe #Added by software-properties ## Major bug fix updates produced after the final release of the ## distribution. deb http://old-releases.ubuntu.com/ubuntu/ wily-updates main restricted deb-src http://old-releases.ubuntu.com/ubuntu/ wily-updates restricted multiverse main universe #Added by software-properties
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://old-releases.ubuntu.com/ubuntu/ wily universe deb http://old-releases.ubuntu.com/ubuntu/ wily-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://old-releases.ubuntu.com/ubuntu/ wily multiverse deb http://old-releases.ubuntu.com/ubuntu/ wily-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://old-releases.ubuntu.com/ubuntu/ wily-backports main restricted universe multiverse deb-src http://old-releases.ubuntu.com/ubuntu/ wily-backports main restricted universe multiverse #Added by software-properties deb http://old-releases.ubuntu.com/ubuntu/ wily-security main restricted deb-src http://old-releases.ubuntu.com/ubuntu/ wily-security restricted multiverse main universe #Added by software-properties deb http://old-releases.ubuntu.com/ubuntu/ wily-security universe deb http://old-releases.ubuntu.com/ubuntu/ wily-security multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu wily partner # deb-src http://archive.canonical.com/ubuntu wily partner

之前用別的源一直不好使,通過https://askubuntu.com/questions/848427/wily-old-release-repositories找到了問題,貌似是wily has been moved.

2、換源之後,執行sudo apt-get update,更新。
3、安裝ssh:sudo apt-get install openssh-server。
4、用xshell連線虛擬機器的ssh:
在這裡插入圖片描述
ssh的相關命令:
1、檢查虛擬機器ssh服務是否開啟:service sshd status
2、啟動SSH服務:service sshd start
重啟:/etc/init.d/ssh restart

附:ubuntu映象下載地址

ubuntu 14.04:
http://mirrors.aliyun.com/ubuntu-releases/14.04/
ubuntu 16.04:
http://mirrors.aliyun.com/ubuntu-releases/16.04/
ubuntu 18.04:
http://mirrors.aliyun.com/ubuntu-releases/18.04/