欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Linux系统管理 构建YUM仓库与安装vsftpd

程序员文章站 2022-07-13 21:39:42
...

前提
1,安装好centos
2查看虚拟机中的虚拟光驱是否已经安装了你所需要的ISO镜像文件
一,构建YUM仓库
[[email protected] ~]# umount /dev/sr0 //卸载原有光驱
[[email protected] ~]# mkdir /media/cdrom //在根目录media下创建cdrom
[[email protected] ~]# mount /dev/sr0 /media/cdrom/ //将光盘挂载到/media/cdrom下
[[email protected] ~]# cd /etc/yum.repos.d/ //进入/erc/yum.repos.d路径下
[[email protected] yum.repos.d]# mkdir a //在当前路径创建a文件夹
[[email protected] yum.repos.d]# mv C
a //将当前文件夹所有C开头的文件移到a文件夹下
[[email protected] yum.repos.d]# cp a/M ./ //从a文件夹中拷贝中间有M的文件到当前路径
[[email protected] yum.repos.d]# vi CentOS-Media.repo 进入CentOS-Media.repo这个文档

  1 # CentOS-Media.repo
  2 #
  5 #  DVD ISO that we release.
  6 #
  8 #  yum --enablerepo=c6-media [command]
  9 #
 10 # or for ONLY the media repo, do this:
 11 #
 12 #  yum --disablerepo=\* --enablerepo=c6-media [command]
 13 
 14 [c6-media]
 15 name=CentOS-$releasever - Media
 16 baseurl=file:///media/CentOS/
 17         file:///media/cdrom/
 18         file:///media/cdrecorder/
 19 gpgcheck=1
 20 enabled=0 //将20行0修改为1 然后按esc推出修改模式再按:输入wq保存退出(x 或shift加两下z键也行)
 21 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 [[email protected] yum.repos.d]# yum -y clean all 清楚本地缓存

Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: c6-media
Cleaning up Everything
Cleaning up list of fastest mirrors
[[email protected] yum.repos.d]# yum makecache 创建yum仓库
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile

  • c6-media:
    file:///media/CentOS/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/CentOS/repodata/repomd.xml
    Trying other mirror.
    file:///media/cdrecorder/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrecorder/repodata/repomd.xml
    Trying other mirror.
    c6-media | 4.0 kB 00:00 …
    c6-media/group_gz | 220 kB 00:00 …
    c6-media/filelists_db | 5.8 MB 00:00 …
    c6-media/primary_db | 4.4 MB 00:00 …
    c6-media/other_db | 2.7 MB 00:00 …
    Metadata Cache Created
    二,安装vsftpd
    [[email protected] yum.repos.d]# rpm -q vsftpd //查看是否安装vsftpd
    package vsftpd is not installed //查询结果没有安装vsftpd
    [[email protected] yum.repos.d]# yum -y install vsftpd //用yum安装vsftpd
    Loaded plugins: fastestmirror, refresh-packagekit, security
    Loading mirror speeds from cached hostfile
  • c6-media:
    Setting up Install Process
    Resolving Dependencies
    –> Running transaction check
    —> Package vsftpd.x86_64 0:2.2.2-11.el6_4.1 will be installed
    –> Finished Dependency Resolution

Dependencies Resolved

=================================================================
Package Arch Version Repository Size

Installing:
vsftpd x86_64 2.2.2-11.el6_4.1 c6-media 151 k

Transaction Summary

Install 1 Package(s)

Total download size: 151 k
Installed size: 331 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : vsftpd-2.2.2-11.el6_4.1.x86_64 1/1
Verifying : vsftpd-2.2.2-11.el6_4.1.x86_64 1/1

Installed:
vsftpd.x86_64 0:2.2.2-11.el6_4.1

Complete!
[[email protected] yum.repos.d]# rpm -q vsftpd //再次查询是否安装vsftpd
vsftpd-2.2.2-11.el6_4.1.x86_64 //查询安装了vsftpd

包含的命令:
mkdir 创建文件夹目录
cp 复制文件:
cp –f强行复制替换
cp –i提醒用户确认
cp -p保持源文件属性,权限,时间
cp –r递归复制
mv剪切文件或目录
vi进入文本文档
cd移动自身所在路径
install 安装
remove卸载