linux 中设备的访问与软件安装

linux设备的访问与软件的安装
1.安装软件
1.rpm
rpm -ivh    name.rpm    安装 ,-v显示过程,-h指定加密方式为hash
    -e  name            卸载
    -ql name            查询软件生成文件
    -qlp    name.rpm    查询软件安装后会生成什么文件
    -qa                 查询系统中安装的所有软件名称
    -qa |grep name      查询软件是否安装
    -qp name.rpm        查询软件安装包安装后的名字
    -qf filename        查看filename属于那个安装包
    -ivh name.rpm --force   强制安装
    -qi name        查看软件信息
    -Kv name.rpm        检测软件包是否被篡改
    -qp name.rpm --scripts  检测软件在安装或卸载过程中执行的动作
[root@localhost ~]# rpm -ivh linuxqq-v1.0.2-beta1.i386.rpm
2.yum源搭建
(1).获得拷贝iso镜像文件
rhel-server-7.1-x86_64-dvd.iso

(2).把rhel-server-7.1-x86_64-dvd.iso挂在到/rhel7.2以便访问镜像中的文件
mount /iso/rhel-server-7.1-x86_64-dvd.iso /rhel7.2

(3).配置本机yum源指向
rm -fr /etc/yum.repos.d/*
vim /etc/yum.repos.d/yum.repo
[Server]
name=rhel7.1
baseurl=file:///rhel7.2
gpgcheck=0

[root@localhost ~]# mkdir /iso
[root@localhost ~]# mkdir /rhel7.2
[root@localhost ~]# scp root@172.25.254.61:/home/kiosk/Desktop/脚本和镜像/rhel-server-7.2-x86_64-dvd.iso /iso
root@172.25.254.61's password:
rhel-server-7.2-x86_64-dvd.iso               100% 3856MB  26.6MB/s   02:25  
[root@localhost ~]# mount /dev/cdrom /rhel7.2/
mount: /dev/sr0 is write-protected, mounting read-only
[root@localhost ~]# vim /etc/yum.repos.d/yum.repo
[root@localhost dhcp]# cat /etc/yum.repos.d/yum.repo
[WESTOS]
name=rhel7.2
baseurl=file:///rhel7.2
gpgcheck=0
[root@localhost ~]# yum clean all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.
Cleaning repos: WESTOS
Cleaning up everything
3.yum源资源共享
[root@localhost ~]# mkdir /iso
[root@localhost ~]# mkdir /rhel7.2
[root@localhost ~]# scp root@172.25.254.61:/home/kiosk/Desktop/脚本和镜像/rhel-server-7.2-x86_64-dvd.iso /iso
root@172.25.254.61's password:
rhel-server-7.2-x86_64-dvd.iso               100% 3856MB  26.6MB/s   02:25  
[root@localhost ~]# mount /dev/cdrom /rhel7.2/
mount: /dev/sr0 is write-protected, mounting read-only
[root@localhost ~]# vim /etc/yum.repos.d/yum.repo
[root@localhost dhcp]# cat /etc/yum.repos.d/yum.repo
[WESTOS]
name=rhel7.2
baseurl=file:///rhel7.2
gpgcheck=0
[root@localhost ~]# yum clean all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can usesubscription-manager to register.
Cleaning repos: WESTOS
Cleaning up everything
[root@localhost ~]# systemctl install httpd
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl enable httpd
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# mkdir /var/www/html/rhel7.2
[root@localhost ~]# umount /rhel7.2
[root@localhost ~]# mount /iso/rhel-server-7.2-x86_64-dvd.iso/var/www/html/rhel7.2/
mount: /dev/loop0 is write-protected, mounting read-only
[root@localhost ~]# vim /etc/rc.d/rc.local
[root@localhost dhcp]# cat /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
mount /iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2
[root@localhost ~]# setenforce 0
[root@localhost ~]# vim /etc/yum.repos.d/yum.repo
[root@localhost dhcp]#  cat/etc/yum.repos.d/yum.repo
[WESTOS]
name=rhel7.2
baseurl=file:///var/www/html/rhel7.2
gpgcheck=0
注释:安装httpd服务,关闭防火墙,修改配置文件
在浏览器中输入:http://本机ip/rhel7.1
可以看到镜像中的内容
4.第三方仓库的搭建
.第三方软件仓库的搭建
把所有的rpm软件包放到一个目录中,这个目录中只能存在rpm文件
createrepo -v /rpm存放目录
vim /etc/yum.repos.d/xxx.repo
[Software]
name=software
baseurl=file:///rpm存放目录
gpgcheck=0

client指向端
vim /etc/yum.repos.d/xxxx.repo      仓库指向文件位置
[xxxx]                  自定义软件仓库名称
name=xxxx               自定义软件仓库描述
baseurl=ftp://|http://|file://      仓库位置
gpgcheck=0              不检测gpgkey

yum clean all               ##清空yum缓存识别新配置

5.yum命令
yum     install     softwarename    安装
        repolist            列出设定yum源信息
        remove      softwarename    卸载
        list        softwarename    查看软件源中是否有次软件
        list all            列出所有软件名称
        list installd           列出已经安装的软件名称
        list available          列出可以用yum安装的软件名称
        clean all           清空yum缓存
        search      softwareinfo    根据软件信息搜索软件名字
        whatprovides    filename    在yum源中查找包含filename文件的软件包    
6.设备的挂载与卸载
mount       设备        挂载点
mount       /iso/#           /mnt       把/iso下的#挂载到/mnt
umout       /mnt                            卸载/mnt
注释:df命令可以查看系统设备挂载状态
7软硬链接
ls -i               查看文件节点号
ln -s /file /file1      软链接    一个结点对应多个区域
ln /file /file1         硬链接    多个节点对应一个区域,需要删除两次
8.find命令
find    查找位置    -条件   条件值  -exec 动作 {} \;
            -name
            -not    条件
            -user
            -group
            -size
            -perm
            --maxdepth
            --mindepth
            -a
            -o
            -type   f   文件
                d   目录
                c   字符设备
                b   块设备
                s   套节字
                l   链接
               
find /mnt -user student
find /mnt -group linux
find /mnt -user student -a -group linux
find /mnt -user student -o -group linux
find /mnt -user student -a -group linux
find /mnt -user student
find /mnt -user student -a -not -group linux

dd if=/dev/zero of=/mnt/file1 bs=1024 count=10
dd if=/dev/zero of=/mnt/file2 bs=1024 count=20
dd if=/dev/zero of=/mnt/file3 bs=1024 count=30

find /mnt -size 10k    查找/mnt下文件大小在10k的文件
find /mnt -size -10k   查找/mnt下文件大小小于10k的文件
find /mnt -size +10k   查找/mnt下文件大小大于10k的文件
[root@localhost mnt]# find /mnt -perm 444   ###查找权限是444的文件r--r--r--
[root@localhost mnt]# find /mnt -perm 644   ###查找权限是644的文件rw-r--r--
/mnt/file1
[root@localhost mnt]# find /mnt -perm /444   ###查找拥有r权限的文件
/mnt
/mnt/file1
/mnt/file2
/mnt/file3
[root@localhost mnt]# find /mnt -perm -444   ###查找所有用户都拥有r权限的文件
/mnt
/mnt/file1
/mnt/file3
[root@localhost mnt]# find /mnt -perm -421   ###查找所有人拥有r权限,所有组拥有w权限,其他人拥有x权限

/mnt/file3

unit9-作业
 1.新建用户并满足以下条件

1)asasin、uid=2000

2)sareo、uid=2001

3)这两个用户都属于deho组

4)这两个用户的密码为westos0oll

5)新建用户taromati

6)此用户为系统用户,没有交互式shell

[root@localhost ~]# groupadd deho

[root@localhost ~]# useradd -g deho -u 2000 asasin

[root@localhost ~]# useradd -g deho -u 2001 sareo

[root@localhost ~]# echo westos0oll | passwd --stdin asasin

Changing password for user asasin.

passwd: all authentication tokens updated successfully.

[root@localhost ~]# echo westos0oll | passwd --stdin sareo

Changing password for user sareo.

passwd: all authentication tokens updated successfully.

[root@localhost ~]# useradd taromati

[root@localhost ~]# usermod -s " " taromati

[root@localhost ~]# tail -n 3 /etc/passwd

asasin:x:2000:1004::/home/asasin:/bin/bash

sareo:x:2001:1004::/home/sareo:/bin/bash

taromati:x:2002:2002::/home/taromati:

 

2.新建文件/public并满足以下条件

1)所有用户都可以在此目录中建立文件

2)除sareo用户外任何人在此目录中建立的文件都自动归属到deho组中

3)sareo对此目录中新建所有文件均不能做任何操作

4)任何人在此目录中只能删除属于自己的文件

[root@localhost ~]# mkdir /public

[root@localhost /]# chmod 3777 /public

[root@localhost /]# chgrp deho /public

[root@localhost /]# getfacl /public

getfacl: Removing leading '/' from absolute path names

# file: public

# owner: root

# group: deho

# flags: -st

user::rwx

group::rwx

other::rwx

[root@localhost /]# setfacl -m u:sareo:--- /public

[root@localhost /]# getfacl /public

getfacl: Removing leading '/' from absolute path names

# file: public

# owner: root

# group: deho

# flags: -st

user::rwx

user:sareo:---

group::rwx

mask::rwx

other::rwx

default:user::rwx

default:group::rwx

default:mask::rwx

default:other::rwx

[root@localhost /]# su - sareo

Last login: Tue Apr  4 22:21:46 EDT 2017 on pts/0

[sareo@localhost ~]$ cd /public

-bash: cd: /public: Permission denied

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值