Linux中YUM基本配置以及FTP,WEB服務器的搭建

一、配置軟件倉庫

1.yum簡介

基於rpm軟件包的安裝部署機制

自動解決軟件包的依賴關係

需要先配置軟件倉庫

2.配置本地的軟件倉庫

a.放入centos7.iso鏡像文件到光驅中,確保電源開啓

b.命令操作

# umount /dev/cdrom

# ls /mnt

# mount /dev/cdrom /mnt

# ls /mnt

# mkdir -p /repo/cos7dvd

# cp -rf /mnt/* /repo/cos7dvd

# du -sh /repo/cos7dvd  /mnt

image.png

3.客戶端配置yum文件

# ls /etc/yum.repos.d/

# mkdir /etc/yum.repos.d/oldrepo

# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/oldrepo/

# ls /etc/yum.repos.d/

# yum-config-manager --add file:///repo/cos7dvd/

image.png

# vim /etc/yum.conf

...

  8 gpgcheck=0        //把1修改爲0  禁用gpgcheck檢驗

...

image.png

4.驗證

# yum clean all    清楚yum緩存

# yum repolist    驗證倉庫名字,路徑,軟件包數量

(那個是臺灣版,不好用,換了臺虛擬機)


二、yum管理應用程序

1.查詢軟件包

基本用法

格式:yum list [軟件名]  .. ..

eg:

[root@ntd1711 ~]# yum list firefox httpd

image.png

2.獲取軟件包的描述信息

基本用法

格式:yum info [軟件名]  .. ..

eg:

[root@ntd1711 ~]# yum info httpd

[root@ntd1711 ~]# yum info firefox

image.png

3.查詢文件和命令由哪個包生成

基本用法

格式:yum privides "*/程序或文件名".. ..

eg:

[root@ntd1711 ~]# yum provides "*/vim" | more

image.png

4.安裝/卸載應用軟件

安裝:

基本用法

格式:yum [-y] install 軟件名 .. ..

eg:

[root@ntd1711 ~]# yum list httpd

[root@ntd1711 ~]# yum -y install httpd

[root@ntd1711 ~]# yum list httpd

image.png

刪除:

基本用法

格式:yum [-y] remove 軟件名 .. ..

eg:

[root@ntd1711 ~]# yum list httpd

[root@ntd1711 ~]# yum -y remove httpd

[root@ntd1711 ~]# yum list httpd

image.png

重新安裝:

基本用法

格式:yum [-y] reinstall 軟件名 .. ..

eg:

[root@ntd1711 ~]# vim /etc/passwd

[root@ntd1711 ~]# which vim

[root@ntd1711 ~]# rm -rf /usr/bin/vim

[root@ntd1711 ~]# vim /etc/passwd

[root@ntd1711 ~]# yum provides /usr/bin/vim

[root@ntd1711 ~]# yum list vim-enhanced

[root@ntd1711 ~]# yum -y reinstall vim-enhanced

[root@ntd1711 ~]# vim /etc/passwd

image.png

image.png

再次驗證證明VIM重新安裝成功


三、快速部署Web

1.Web服務概述

Web服務器是一種基於B/S架構的網頁資源通信

B    瀏覽器

S    服務器

網頁:以html,htm,jsp,php,asp...等結尾的文件

網站:多個網頁的集合

程序員(Dev):開發網頁/網站(java,.net,Python,php)

    |

測試工程師(QA)

    |

運維工程師(OP):上線(託管到服務器)

職責:

安裝Linux服務器

配置Web服務器

把程序員寫的網站部署到web服務器

測試

2.快速搭建Web服務器站點

a.安裝軟件包

[root@ntd1711 ~]# yum repolist

[root@ntd1711 ~]# yum list httpd

[root@ntd1711 ~]# yum -y install httpd

[root@ntd1711 ~]# yum list httpd

image.png

b.新建缺省主頁

[root@ntd1711 ~]# vim /var/www/html/index.html

This is a test Page!!!

image.png

[root@ntd1711 ~]# cat /var/www/html/index.html

This is a test Page!!!

image.png

c.啓動服務

[root@ntd1711 ~]# systemctl start httpd        //啓動httpd服務

[root@ntd1711 ~]# systemctl enable httpd    //設置httpd開機自啓動

image.png

d.測試

[root@ntd1711 ~]# firefox http://127.0.0.1/index.html  其實訪問的是服務器上面的/var/www/html/index.html

image.png

image.png

四、快速部署Ftp

1.FTP服務概述

基於C/S架構

C 客戶端

S 服務器

文件上傳/下載服務

2.ftp賬戶

    匿名用戶:默認訪問的是/var/ftp

    本地用戶:默認訪問的是/home/xxx

3.快速搭建FTP服務器站點

a.安裝軟件包

[root@ntd1711 ~]# yum repolist

[root@ntd1711 ~]# yum list vsftpd

[root@ntd1711 ~]# yum -y install vsftpd

[root@ntd1711 ~]# yum list vsftpd

image.png

b.修改主配置文件

[root@ntd1711 ~]# useradd vip2018

[root@ntd1711 ~]# passwd vip2018

image.png

c.啓動服務器

[root@ntd1711 ~]# systemctl start vsftpd

[root@ntd1711 ~]# systemctl enable vsftpd

image.png

d.測試

[root@ntd1711 ~]# firefox ftp://127.0.0.1       //默認登錄的是/var/ftp

image.png

[root@ntd1711 ~]# firefox ftp://[email protected]  //登錄到/home/vip2018

image.png

image.png

a.設置vmware虛擬機的網卡爲vmnet8

b.設置win的vmnet8的ip爲自動獲取方式(192.168.72.250)

image.png

c.設置Linux的ip爲192.168.72.0/24

image.png

d.在windows下ping linux確保可以ping通

image.png

image.png

接下來,通過兩種方式遠程登錄Linux

1、PuTTY

image.png

image.png


WinSCP:

image.pngimage.png


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