由于后面使用Xshell連接Ubuntu需要,先配置Ubuntu軟件源腾么,并且開啟SSH服務(wù)化焕。
Ubuntu 軟件源簡介
Ubuntu雖然屬于Debian體系左腔,但是擁有自己的軟件包管理系統(tǒng)和軟件源诈泼,所謂Ubuntu的軟件源懂拾,就是一些存有Ubuntu 上各種軟件安裝包的Web服務(wù)器,Ubuntu通過Http 將軟件包下載下來并且安裝铐达。這一切通過apt-get進(jìn)行岖赋,而apt-get是Ubuntu上面最重要也是最常用的軟件安裝方式。
與此同時(shí)瓮孙,Ubuntu 的提供了圖形界面的軟件源更新方式唐断,但是由于我們使用和部署的服務(wù)器,大多數(shù)情況下杭抠,不能通過圖形界面直接訪問脸甘, 我們主要使用命令行方式更新。
查看并且更新源列表
Ubuntu的源列表存儲(chǔ)在/etc/apt/source.list中偏灿,實(shí)驗(yàn)中的Ubuntu14.04 沒有安裝vim丹诀,可以通過vi打開并且查看源列表。
可以看到翁垂,默認(rèn)安裝好的源都是美國的鏡像铆遭,在國內(nèi)訪問時(shí)可能速度較慢。我們需要編輯列表沮峡,將源更新為國內(nèi)鏡像疚脐。
值得一提的是亿柑,Ubuntu已經(jīng)在國內(nèi)被廣泛使用邢疙,軟件源在國內(nèi)也有官方鏡像,目前在阿里云望薄,實(shí)測(cè)速度不錯(cuò)疟游。
應(yīng)當(dāng)盡量避免使用官方以外的源,除非足夠可信痕支,之前就發(fā)生過軟件包被替換颁虐,導(dǎo)致服務(wù)器被黑的情況。
官方源列表
14.04 LTS 源列表
將文件中內(nèi)容替換成為:
deb http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
##測(cè)試版源
deb http://cn.archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
# 源碼
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
##測(cè)試版源
deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
# Canonical 合作伙伴和附加
deb http://archive.canonical.com/ubuntu/ trusty partner
deb http://extras.ubuntu.com/ubuntu/ trusty main
運(yùn)行命令卧须, 更新本機(jī)包信息另绩。
sudo apt-get update
運(yùn)行完成之后,表示本機(jī)軟件源已經(jīng)配置好花嘶。
開啟SSh服務(wù)
輸入命令 :
sudo apt-get install openssh-server
使用命令笋籽,查看ssh服務(wù)開啟情況:
netstat -ant
可以看到22端口已經(jīng)監(jiān)聽,ssh服務(wù)已經(jīng)開啟椭员。
更改SSH默認(rèn)端口
有的時(shí)候车海,為了安全,我們不使用ssh 的默認(rèn)端口進(jìn)行登錄隘击。這就需要修改服務(wù)器ssh 的默認(rèn)端口:
修改文件/etc/ssh/sshd_config ,修改端口為8123侍芝,
重啟ssh服務(wù)研铆,再次查看,ssh端口更改為8123州叠。