日踩阿里雲ECS兩坑:ssh訪問佛系 + Ubuntu apt 源sources.list無效

最近阿里雲ECS貌似有點不穩定啊,今天踩了兩個坑。

一、ssh遠程訪問有問題

我xshell遠程訪問時斷時續,後來乾脆登不上去了,提示錯誤:

Socket error Event: 32 Error: 10053. Disconnected from remote host

關鍵我在同一臺電腦上使用阿里雲提供的網頁遠程功能卻可以遠程訪問。

網上試了一些方法都沒效果,比如有

說IP地址衝突的,修改爲固定IP;有說key的權限問題的,重新生成key,並配置權限;有說IP被阿里禁了,怎麼可能,web端訪問正常;有說沒有在ECS安全組裏配置端口的,之前都配置了;有說是xshell的問題,換了個putty還是不行;最後連重啓大法都試了。無奈,吃了個午飯回來居然神奇般地能遠程訪問了。到現在我也沒弄明白是爲什麼,真是佛系,希望有踏過類似坑的大佬幫忙解答。

二、更新系統後,apt源出問題

今天用xshell更新了下阿里雲ECS系統,提示有更新,強迫症的我就更新了,更新完之後apt的源居然出問題了,

apt-get clean           apt-get update        aptitude update 都用不了了

下面是更新之後的apt源: /etc/apt/sources.list 

  1 ## Note, this file is written by cloud-init on first boot of an instance 
  2 ## modifications made here will not survive a re-bundle. 
  3 ## if you wish to make changes you can: 
  4 ## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg 
  5 ##     or do the same in user-data 
  6 ## b.) add sources in /etc/apt/sources.list.d 
  7 ## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl 
  8  
  9 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to 
 10 # newer versions of the distribution. 
 11  
 12 deb http://mirrors.cloud.aliyun.com/ubuntu/ bionic main 
 13 deb-src http://mirrors.cloud.aliyun.com/ubuntu/ bionic main 
 14  
 15 ## Major bug fix updates produced after the final release of the 
 16 ## distribution. 
 17 deb http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-updates main 
 18 deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-updates main 
 19  
 20 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
 21 ## team. Also, please note that software in universe WILL NOT receive any 
 22 ## review or updates from the Ubuntu security team. 
 23 deb http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic universe 
 24 deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic universe 
 25 deb http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-updates universe 
 26 deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-updates universe 
 27                                                                               
 28 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu   
 29 ## team, and may not be under a free licence. Please satisfy yourself as to   
 30 ## your rights to use the software. Also, please note that software in        
 31 ## multiverse WILL NOT receive any review or updates from the Ubuntu          
 32 ## security team.                                                             
 33  deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial multiverse              
 34  deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial multiverse          
 35  deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates multiverse      
 36  deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates multiverse  
 37                                                                               
 38 ## Uncomment the following two lines to add software from the 'backports'     
 39 ## repository.                                                                
 40 ## N.B. software from this repository may not have been tested as             
 41 ## extensively as that contained in the main release, although it includes    
 42 ## newer versions of some applications which may provide useful features.     
 43 ## Also, please note that software in backports WILL NOT receive any review   
 44 ## or updates from the Ubuntu security team.                                  
 45  deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-backports main restricted universe multiverse 
 46  deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-backports main restricted universe multiverse 
 47                                                                               
 48 ## Uncomment the following two lines to add software from Canonical's         
 49 ## 'partner' repository.                                                      
 50 ## This software is not part of Ubuntu, but is offered by Canonical and the   
 51 ## respective vendors as a service to Ubuntu users.                           
 52 # deb http://archive.canonical.com/ubuntu xenial partner                      
 53 # deb-src http://archive.canonical.com/ubuntu xenial partner                  
 54                                                                               
 55 #deb http://mirrors.cloud.aliyun.com/ubuntu bionic-security main              
 56 #deb-src http://mirrors.cloud.aliyun.com/ubuntu bionic-security main          
 57 #deb http://mirrors.cloud.aliyun.com/ubuntu bionic-security universe          
 58 #deb-src http://mirrors.cloud.aliyun.com/ubuntu bionic-security universe      
 59 # deb http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security multiverse     
 60 # deb-src http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security multiverse

搞了半天,阿里雲的apt源居然打不開 http://mirrors.cloud.aliyun.com/ubuntu/ 

最後換了別的源搞定,這裏推薦幾個比較好用的吧:

清華大學的源 https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

中科大的源 http://mirrors.ustc.edu.cn/

網易的源  http://mirrors.163.com/

完畢!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章